The implementation of those static dialog methods do it like that they first launch a dialog and depending on the result code the desired variable is asked from the dialog and returned..
Still if it's "hidden" bedind a static method returning something else than a dialogs result code, the internal implementation always checks the result code..
For example QColorDialog::getColor() looks like this:
dlg->setColor(initial);
dlg->selectColor(initial);
int resultCode = dlg->exec();
if (resultCode
== QDialog::Accepted) result = dlg->color();
delete dlg;
return result;
QColorDialog *dlg = new QColorDialog(parent, true); //modal
dlg->setWindowTitle(QColorDialog::tr("Select color"));
dlg->setColor(initial);
dlg->selectColor(initial);
int resultCode = dlg->exec();
QColor result;
if (resultCode == QDialog::Accepted)
result = dlg->color();
delete dlg;
return result;
To copy to clipboard, switch view to plain text mode
Bookmarks