From 9f9432311e274be2dc00b6085fb5b480a83aa7e9 Mon Sep 17 00:00:00 2001 From: Arto Jonsson Date: Mon, 22 Dec 2008 20:51:14 +0200 Subject: [PATCH] Refactor the update UI code in EngineManagementDlg class. This simplifies the engine selection and also enables user to select engines by using the keyboard. --- projects/gui/src/enginemanagementdlg.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/projects/gui/src/enginemanagementdlg.cpp b/projects/gui/src/enginemanagementdlg.cpp index a3b4730..9ed6b01 100644 --- a/projects/gui/src/enginemanagementdlg.cpp +++ b/projects/gui/src/enginemanagementdlg.cpp @@ -39,9 +39,8 @@ EngineManagementDialog::EngineManagementDialog( m_filteredModel, SLOT(setFilterWildcard(const QString&))); // Signals for updating the UI - connect(m_enginesList, SIGNAL(clicked(const QModelIndex&)), - this, SLOT(updateUi())); - connect(m_filteredModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), + connect(m_enginesList->selectionModel(), + SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), this, SLOT(updateUi())); // Add button @@ -58,8 +57,7 @@ EngineManagementDialog::EngineManagementDialog( void EngineManagementDialog::updateUi() { // Enable buttons depending on item selections - if (m_filteredModel->rowCount() > 0 && - m_enginesList->selectionModel()->hasSelection()) + if (m_enginesList->selectionModel()->hasSelection()) { m_configureBtn->setEnabled(true); m_removeBtn->setEnabled(true); -- 2.11.4.GIT