错误:'(QMessageBox::Icon)1u' cannot be used as a function
来源:互联网 发布:数据库系统概论萨师煊 编辑:程序博客网 时间:2024/04/27 23:56
程序代码如下:
<span style="font-size:18px;background-color: rgb(255, 255, 255);">void MainWindow::on_commandLinkButton_clicked()</span>
<span style="font-size:18px;background-color: rgb(255, 255, 255);">{</span>
<span style="font-size:18px;background-color: rgb(255, 255, 255);"><span style="white-space:pre"></span>if(this->currentImage == 4) </span>
</pre><pre class="cpp" name="code">
<span style="font-size:18px;background-color: rgb(255, 255, 255);"><span style="white-space:pre"></span>this->currentImage = 0; </span>
<span style="font-size:18px;background-color: rgb(255, 255, 255);"><span style="white-space:pre"></span>else </span>
<span style="font-size:18px;background-color: rgb(255, 255, 255);"><span style="white-space:pre"></span>this->currentImage ++;//更新当前图片 </span>
<span style="font-size:18px;background-color: rgb(255, 255, 255);"><span style="white-space:pre"></span>QString fileName = list.at(this->currentImage); </span>
<span style="font-size:18px;background-color: rgb(255, 255, 255);"><span style="white-space:pre"></span>if(!fileName.isEmpty()) //图片是否存在 </span>
<span style="font-size:18px;background-color: rgb(255, 255, 255);"><span style="white-space:pre"></span>{ </span>
<span style="font-size:18px;background-color: rgb(255, 255, 255);"><span style="white-space:pre"></span>QImage image(fileName); </span>
<span style="font-size:18px;background-color: rgb(255, 255, 255);"><span style="white-space:pre"></span>if(image.isNull()) </span>
<span style="font-size:18px;background-color: rgb(255, 255, 255);"><span style="white-space:pre"></span>{ </span>
<span style="font-size:18px;background-color: rgb(255, 255, 255);"><span style="white-space:pre"></span>QMessageBox::Information(this,tr("Image Viewer"),tr("Cannot load %1.").arg(fileName)); </span>
<span style="font-size:18px;background-color: rgb(255, 255, 255);"><span style="white-space:pre"></span>return; </span>
<span style="font-size:18px;background-color: rgb(255, 255, 255);"><span style="white-space:pre"></span>} </span>
<span style="font-size:18px;background-color: rgb(255, 255, 255);"><span style="white-space:pre"></span>ui->imageLabel->setPixmap(QPixmap::fromImage(image)); //用图片填充imageLabel </span>
<span style="font-size:18px;background-color: rgb(255, 255, 255);"><span style="white-space:pre"></span>}</span>
<span style="font-size:18px;background-color: rgb(255, 255, 255);">}</span>
编译报错:
/home/xiaofeng/qt/CommandLinkButton/ComLinButton/mainwindow.cpp:48:
错误:'(QMessageBox::Icon)1u' cannot be used as a function
进过分析发现:
<span style="background-color: rgb(255, 255, 255);"><span style="font-size:18px;">QMessageBox::Information(this,tr("Image Viewer"),tr("Cannot load %1.").arg(fileName));</span></span>
中的,Information有问题,应该是information,没注意首字母大小写,QMessageBox::information,才是静态成员函数
0 0
- Qt错误:'(QMessageBox::Icon)1u' cannot be used as a function
- 错误:'(QMessageBox::Icon)1u' cannot be used as a function
- cannot be used as a boolean
- 【android】setOnItemClickListener cannot be used with a spinner的错误
- 关于The function get must be used with a prefix when a default namespace is not specified的错误
- 调试CRF出现的错误:cannot be interpreted as a Tensor.
- As of ADT 14, resource fields cannot be used as switch cases
- As of ADT 14, resource fields cannot be used as switch cases.
- android出现问题As of ADT 14, resource fields cannot be used as switch cases.
- As of ADT 14, resource fields cannot be used as switch
- As of ADT 14, resource fields cannot be used as switch cases
- As of ADT 14, resource fields cannot be used as switch cases.
- error C2899: typename cannot be used outside a template declaration
- u-boot移植时出现inline function 'coloured_LED_init' cannot be declared weak及相关错误时的解决办法!
- u-boot移植时出现inline function 'coloured_LED_init' cannot be declared weak及相关错误时的解决办法!
- u-boot移植时出现inline function 'coloured_LED_init' cannot be declared weak及相关错误时的解决办法!
- u-boot移植时出现inline function 'coloured_LED_init' cannot be declared weak及相关错误时的解决办法
- a pointer to a bound function may only be used to call the function
- IOS 通过脚本自动打包工具 webfrogs/xcode_shell
- 修改mysql数据库的 datadir
- Android RippleEffect波纹效果,重写View
- Xcode断点调试
- 如果要学进制转换可以参考这篇通俗易懂(杭电2031)
- 错误:'(QMessageBox::Icon)1u' cannot be used as a function
- MagicalRecord
- 参数检验与非参数检验
- DevComponents.DotNetBar2.dll 使用教程
- Unsupported major.minor version 51.0解决办法
- IO基础入门之I/O多路复用技术
- 怎样学习框架
- SAT数学题目有哪些特点
- 职场第一天