我是才拿了本书开始看的,程序超简单,就是想来试试QMessage,如下:
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <QtGui/QtGui>
#include <QtGui/QApplication>
int main(int argc,char* argv[])
{
QApplication app(argc,argv);
QMessageBox box;
box.setWindowTitle(tr("hello"));
box.setIcon(QMessageBox::Warning);
box.setText(tr("wrong"));
box.setStandardButtons(QMessageBox::Yes|QMessageBox::No);
box.setDetailedText(tr("please check"));
switch(box.exec())
{
case QMessageBox::Yes
box.setText(tr("OK"));
break;
case QMessageBox::No
box.setText(tr"NO");
break;
default:
break;
}
}
错误是tr’ was not declared in this scope 。
各位大虾随便给看看阿!