aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2016-11-27 20:08:26 +0100
committerPeter Wu <peter@lekensteyn.nl>2016-11-28 19:41:39 +0000
commitc4aba11ee32411bcd31d08c5ff9798c56e806271 (patch)
tree067af7a1a8a393d964afccbabd5c9a8a0f55f5b1 /ui/qt
parent7c3aa5a88ca78bf029fd16aea2a9a1f4861227db (diff)
Qt: Update UAT OK button enabled on delete.
Check if the OK button should be enabled when removing a row in a UAT dialog. Also update the error hint. Change-Id: Icb5c47c2b2e65ed266fd2c7e3a1535f6a3a50279 Reviewed-on: https://code.wireshark.org/review/18967 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/uat_dialog.cpp10
-rw-r--r--ui/qt/uat_dialog.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/ui/qt/uat_dialog.cpp b/ui/qt/uat_dialog.cpp
index 4d039bd33f..b9978b9f16 100644
--- a/ui/qt/uat_dialog.cpp
+++ b/ui/qt/uat_dialog.cpp
@@ -113,6 +113,8 @@ void UatDialog::setUat(epan_uat *uat)
connect(uat_model_, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(modelDataChanged(QModelIndex)));
+ connect(uat_model_, SIGNAL(rowsRemoved(QModelIndex, int, int)),
+ this, SLOT(modelRowsRemoved()));
connect(ui->uatTreeView, SIGNAL(currentItemChanged(QModelIndex,QModelIndex)),
this, SLOT(viewCurrentChanged(QModelIndex,QModelIndex)));
ok_button_->setEnabled(!uat_model_->hasErrors());
@@ -135,6 +137,14 @@ void UatDialog::modelDataChanged(const QModelIndex &topLeft)
ok_button_->setEnabled(!uat_model_->hasErrors());
}
+// Invoked after a row has been removed from the model.
+void UatDialog::modelRowsRemoved()
+{
+ const QModelIndex &current = ui->uatTreeView->currentIndex();
+ checkForErrorHint(current, QModelIndex());
+ ok_button_->setEnabled(!uat_model_->hasErrors());
+}
+
// Invoked when a different field is selected. Note: when selecting a different
// field after editing, this event is triggered after modelDataChanged.
void UatDialog::viewCurrentChanged(const QModelIndex &current, const QModelIndex &previous)
diff --git a/ui/qt/uat_dialog.h b/ui/qt/uat_dialog.h
index 9bfa49a8b0..68d92cb2e5 100644
--- a/ui/qt/uat_dialog.h
+++ b/ui/qt/uat_dialog.h
@@ -51,6 +51,7 @@ public:
private slots:
void modelDataChanged(const QModelIndex &topLeft);
+ void modelRowsRemoved();
void viewCurrentChanged(const QModelIndex &current, const QModelIndex &previous);
void acceptChanges();
void rejectChanges();