QMessageBox exec only returns 1024 or 4194304...
-
I can't find any reference to such issue. I'm trying to add a QMessageBox and the exec function is returning me only 1024 if I click ok or 4194304 if I click cancel. I commented out lines that I initially used but don't change the situation if commented out.
QMessageBox restartBox(this); restartBox.setIcon(QMessageBox::Warning); restartBox.setWindowTitle(tr("Restart required")); restartBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); int exec = restartBox.exec(); Base::Console().Warning("exec %d", exec); if (exec == QDialog::Accepted) {/*never triggered*/}
Any idea what can trigger such behavior?
-
Hi,
QMessageBox::exec returns a QMessageBox::StandardButton.
-
@Paddle Please read the documentation of
QMessageBox::exec()
:When using a QMessageBox with standard buttons, this function returns a StandardButton value indicating the standard button that was clicked.
So it returns
QMessageBox::Ok
= 0x00000400 = 1024, orQMessageBox::Cancel
= 0x00400000 = 4194304. -
@Paddle ni worries !
Since you have it working now, please mark the thread as solved using the "Topic Tools" button or the three dotted menu beside the answer you deem correct so that other forum users may know a solution has been found :-)