灰色矩形而不是飞溅Qt
Grey rectangle instead of the splash Qt
我构建并执行了应用程序(下面的代码),启动屏幕显示灰色,而不是图像。我不知道问题在哪里,虽然图像的路径是正确的。
This is my main.cpp:
#include <QApplication>
#include<QSplashScreen>
#include "mainwindow.h"
#include <unistd.h>
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QPixmap pixmap(":/images/splash.png");
QSplashScreen splash(pixmap);
splash.setMask(pixmap.mask());
splash.show();
app.processEvents();
sleep(5);
MainWindow window;
window.show();
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
splash.finish(&window);
return app.exec();
}
有两个选项:
- 你没有解析和编译资源文件(用rcc解析)
- 或者您在qrc文件中添加了错误的路径到您的映像(请参阅qt参考资料),或者您根本没有添加
正如我所说的,尝试使用磁盘上的映像。如果显示正常,则是上述问题之一。
相关文章:
- Qt VTK交互风格的信号到小部件
- QT在错误的班级中寻找空位
- 如何在选项卡视图Qt中设置一个新项目,并保存以前的项目
- 如何在Qt窗口小部件中使用QStringView(或QStringRef)
- 如何在Qt C++中更改光标
- 如何在MS Visual Studio 2019中运行QT UI
- QT通过C++添加映射QML项目
- libssh 的函数在构建 libssh 时无法在 Qt 和 cmake 错误中找到
- 如何将点击的信号和插槽添加到qt中的自定义按钮中
- Qt C++静态thread_local QNetworkAccessManager是线程应用程序的好选择吗
- 使用Qt C++计算类似Git的SHA1哈希
- Qt focusObjectChanged example?
- 如何在cpp文件之间切换窗口?在Qt中
- Qt和C++:将QLineEdit添加到QTabWidget中
- 从数据库实时显示QT c++中的数据
- Qt Quick-如何仅从c++代码与qml属性交互
- 无法使用Qt Creator在Windows中构建yaml-cpp
- 如何在Qt中取消捕获字符串
- 在Qt C++中绘制HSV色轮
- 为Qt中项目交集定义的区域上色