سؤال

I'm trying to make a non-blocking QMessageBox as described here.

In the slot msgBoxClosed() I only get a QAbstractButton* back, so how can I check which of the buttons (QMessageBox::Yes, QMessageBox::No) was pressed?

هل كانت مفيدة؟

المحلول

You can use the following function to determine the button QMessageBox::standardButton(QAbstractButton *button). For example:

StandardButton btn = msgBox->standardButton(button)
if (btn == QMessageBox::Ok) {
    [..]
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top