• 13039阅读
  • 2回复

超级未入门级别小菜鸟求助!错误‘tr’ was not declared in this scope [复制链接]

上一主题 下一主题
离线lilinfeng124
 

只看楼主 倒序阅读 楼主  发表于: 2009-04-18
— 本帖被 XChinux 执行加亮操作(2009-04-18) —
我是才拿了本书开始看的,程序超简单,就是想来试试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 。
各位大虾随便给看看阿!
劳资要过自己想要过的生活,而不是别人希望劳资过的生活
离线cooljeff
只看该作者 1楼 发表于: 2009-04-18
QObject::tr
离线lilinfeng124

只看该作者 2楼 发表于: 2009-04-19
谢谢你!大哥你太cool了!
劳资要过自己想要过的生活,而不是别人希望劳资过的生活
快速回复
限100 字节
 
上一个 下一个