changeset 1:db8f47446713

Disable the edit person push button when no person is selected.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 30 Mar 2017 03:27:08 +0300
parents fec4d0c461f2
children edc1e8cf6e2c
files main.cpp
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/main.cpp	Thu Mar 30 03:20:08 2017 +0300
+++ b/main.cpp	Thu Mar 30 03:27:08 2017 +0300
@@ -220,6 +220,8 @@
 {
     personID = id;
 
+    ui->button_EditPerson->setEnabled(id >= 0);
+
     if (id >= 0)
     {
         QSqlQuery person;
@@ -290,8 +292,11 @@
 
 void SyntilistaMainWindow::on_button_EditPerson_clicked()
 {
-    EditPerson *person = new EditPerson(this);
-    person->setPerson(personID);
+    if (personID >= 0)
+    {
+        EditPerson *person = new EditPerson(this);
+        person->setPerson(personID);
+    }
 }