I want to add a splash screen to my c++/qt/qml applicaiton. I added the following codes:
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
QQuickView *view = new QQuickView;
view->setSource(QUrl(QLatin1String("qrc:/Splash.qml")));
view->show();
engine.load(QUrl(QLatin1String("qrc:/main.qml")));
view->close();
app.exec();
return 0;
}
And the Splash.qml file:
import QtQuick 2.0
import QtQuick.Controls 2.1
Item {
visible: true
width: 640
height: 480
BusyIndicator {
anchors.centerIn: parent
width: 100
height: 100
running: true
Component.onCompleted: {
console.log("splash screen... " + x + " " + y + " " + width + "x" + height)
visible=true
}
}
}
When the application was starting, the message:"qml: splash screen... 270 190 100x100" was printed, but the QQuickWindow is just in white color. The main window for main.qml can work correctly. I tried to load an image in the Splash.qml,but same problem. And, I can NOT make it to be a frameless window using QQuickView::setWindowFlags. I'm working on win7 64bits OS.