Yes/No message box using QMessageBox

前端 未结 7 2087
渐次进展
渐次进展 2021-01-30 05:59

How do I show a message box with Yes/No buttons in Qt, and how do I check which of them was pressed?

I.e. a message box that looks like this:

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-30 06:35

    QT can be as simple as that of Windows. The equivalent code is

    if (QMessageBox::Yes == QMessageBox(QMessageBox::Information, "title", "Question", QMessageBox::Yes|QMessageBox::No).exec()) 
    {
    
    }
    

提交回复
热议问题