//读取文件
bool MainWindow::do_file_Load(const QString &fileName)
{
QFile file(fileName);
if(!file.open(QFile::ReadOnly | QFile::Text))
//如果打开文件失败,则弹出对话框并返回
{
QMessageBox::Warning(this, tr("读取文件"), tr("无法读取文件 %1:\n %2.").arg(fileName).arg(file.errorString()));
return false;
}
QTextStream in(&file);
ui -> textEdit -> setText(in.readAll());//将文本中的所有内容写入文本编辑器
setWindowTitle(curFile);
return true;
}
E:\Workspace\Qt_2\MainWindow-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK____\..\MainWindow\mainwindow.cpp:80: 错误:
'(QMessageBox::Icon)2u' cannot be used as a function
以上是一个读取文件的函数,红字部分是错误描述,请问怎样才能克服啊,该包含的头文件都已经包含进去了。