Reputation: 4071
I'm having trouble using QSplashScreen on a new Qt Quick 2 project. Here's the project 'main.cpp':
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QPixmap pix("./test80.png");
QSplashScreen splash(pix);
splash.show();
QTest::qSleep(5000);
splash.hide();
QtQuick2ApplicationViewer viewer;
viewer.setMainQmlFile(QStringLiteral("qml/teste/main.qml"));
viewer.showExpanded();
return app.exec();
}
This code compiles. When I run it, application output shows the following message: QWidget: Cannot create a QWidget without QApplication
. So apparently QGuiApplication doesn't inherit from QApplication, so I'm stumped.
Edit: changing QGuiApplication to QApplication seemed to work, but I'm worried that QApplication will lack something needed by Qt Quick 2.
Upvotes: 2
Views: 2479
Reputation: 22734
In fact it's the other way around: QApplication inherits from QGuiApplication. And you need the former to use widgets. :-)
Upvotes: 5