messageBox.QMessageBox::Yes
Is just accessing the enum
Yes
, which is going to evaluate the same each time.
You want to capture the actual response from the question and query that, such as:
auto response = QMessageBox::question(this, "Save", "Do you wish to save?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
if (response == QMessageBox::Save) { ... }
See https://doc.qt.io/qt-5/qmessagebox.html#question here for more info.
To keep the same format above you can get the response with messageBox.result()
e.g.
if (messageBox.result() == QMessageBox::Yes) { ... }
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…