From 2bd6b41642b1b1f37c445b7fe45f15ce61952876 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Sun, 29 May 2016 14:08:01 +0200 Subject: [PATCH] Delete button is disable if no record selected. --- core/gridform.ui | 6 ++++++ core/igridform.cpp | 9 +++++++++ core/igridform.h | 2 ++ 3 files changed, 17 insertions(+) diff --git a/core/gridform.ui b/core/gridform.ui index a201617..8a7663b 100644 --- a/core/gridform.ui +++ b/core/gridform.ui @@ -48,6 +48,9 @@ + + false + Edit record @@ -71,6 +74,9 @@ + + false + Delete record diff --git a/core/igridform.cpp b/core/igridform.cpp index f58f52d..ef75adc 100644 --- a/core/igridform.cpp +++ b/core/igridform.cpp @@ -131,3 +131,12 @@ void IGridForm::on_btnFilter_toggled(bool checked) ui->filterWidget->setVisible(false); } } + +void IGridForm::on_tableView_clicked(const QModelIndex &index) +{ + if (ui->tableView->currentIndex().isValid()) + { + ui->btnEdit->setEnabled(true); + ui->btnDelete->setEnabled(true); + } +} diff --git a/core/igridform.h b/core/igridform.h index f5a1aec..27aead5 100644 --- a/core/igridform.h +++ b/core/igridform.h @@ -53,6 +53,8 @@ private slots: void on_btnFilter_toggled(bool checked); + void on_tableView_clicked(const QModelIndex &index); + private: QString m_pluginId; IFormHandler *m_formHandler;