Hi,
In my code I have a dialog box which has an OK button. I show it by calling diag.exec(). The slot on the OK button has the following code:
Qt Code:
void SLOTOkBtn() { QList<QTreeWidgetItem *> selectedItems = ui.m_PackageList->selectedItems(); if ( selectedItems.isEmpty() ) { return; } else { // Provides you with the first selection m_Package = selectedItems.first()->text( 0 ).toAscii().data(); } }To copy to clipboard, switch view to plain text mode
Now if I hit OK and no items are selected, it gets to return;, which is what i would expect - however, rather than staying in exec(), it is closing the dialog box, and the test on the return code from diag.exec() give QDialog::Accepted, even though QDialog::Accept() has not been called.
Any ideas what i am doing wrong?
David
Bookmarks