QMessageBox简单使用

首先要调用

#include <QMessageBox>

然后

            QMessageBox msgBox;
            msgBox.setWindowTitle("错误");
            msgBox.setText("除数不能为零");
            msgBox.exec();
    

或者简单点

QMessageBox::warning(this,"错误","除数不能为零");

常用的弹出框类型

  1. Question
    For asking a question during normal operations.
  2. Information
    For reporting information about normal operations.
  3. Warning
    For reporting non-critical errors.
  4. Critical
    For reporting critical errors.
posted on 2016-07-13 21:52  神秘藏宝室  阅读(5270)  评论(0编辑  收藏  举报

 >>>转载请注明出处<<<