문제

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