Qt 自定义消息窗口

用于设置取消时,询问是否保存修改的DLG
void SetWindow::cancelButton()
{
    if( m_IsChange)
    {
        QMessageBox msgBox;
        msgBox.setText(tr("The crap has been changed."));
        msgBox.setInformativeText(tr("Do you want to save your changes?"));
        msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
        msgBox.setDefaultButton(QMessageBox::Save);
        int ret = msgBox.exec();
        switch (ret)
        {
            case QMessageBox::Discard:
                m_IsChange = false;
            case QMessageBox::Save:
                okButton();
                break;
            case QMessageBox::Cancel:
            default:
                break;
        }
    }
    else
    {
        okButton();
    }
}
上一篇:Qtcreator中经常使用快捷键总结


下一篇:黑马----JAVA内部类