• 3870阅读
  • 2回复

[提问]QMessageBox问题 [复制链接]

上一主题 下一主题
离线luoxianhui
 
只看楼主 倒序阅读 楼主  发表于: 2012-02-15
void MainWindow::do_file_SaveOrNot()
{
    if(ui->textEdit->document()->isModified())
    QMessageBox box;
    box.setWindowTitle(tr("Alarm"));
    box.setIcon(QMessageBox::Warning);
    box.setText(curFile+tr("is not be saved,would you want to save it?"));
    box.setStandardButtons(QMessageBox::Yes|QMessageBox::No);
    if(box.exec()==QMessageBox::Yes)
    {
    do_file_Save();
    }
运行提示‘box’was not declared in this

scope.我是菜鸟,求高手相助.

}
离线abcdlcq

只看该作者 1楼 发表于: 2012-02-15
#include <QMessageBox >
离线luoxianhui
只看该作者 2楼 发表于: 2012-02-15
谢谢已解决,开始直接在main.cpp添加没效果,在头文件添加就好了!
快速回复
限100 字节
 
上一个 下一个