# HG changeset patch # User Matti Hamalainen # Date 1490833628 -10800 # Node ID db8f47446713aec77271581f50c71d0a52578b14 # Parent fec4d0c461f2ea39bfe72876eaf89cc08ff9388c Disable the edit person push button when no person is selected. diff -r fec4d0c461f2 -r db8f47446713 main.cpp --- 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); + } }