Qqmlapplicationengine refuse to show me something
Just checked out qt51rc1.
I tried to use qqmlapplicationengine to show a qml file. It seems the application runs silently without showing anything.
I did it very simple:
int main(int argc, char *argv)
QGuiApplication app(argc, argv);
// QtQuick2ApplicationViewer viewer;
QQmlApplicationEngine engine("qml/QMLApplication/main2.qml"); return app.exec();
import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Window 2.0
text: qsTr("Hello World")
If I use the commented out viewer it works.
But Id like to use an ApplicationWindow instead of a Rectangle as root item.
Am I missing something or is this just a bug in qt5.1?
Cheers and thx to everyone
Same problem. No solution yet, sorry.
Window and ApplicationWindow is not visible by default. I suspect you simply have to set visible:true in your window definition
Ah that did the trick! Quite confusing that it doesn't need it with QtQuick2ApplicationViewer, but never mind.
[quote author="Jens" date="1371856261"]Window and ApplicationWindow is not visible by default. I suspect you simply have to set visible:true in your window definition[/quote]
That's just shocking. The examples given for ApplicationWindow e.g. "this example":http://doc-snapshot.qt-project.org/qt5-stable/qtquickcontrols/qtquickcontrols-overview.html don't mention this.
This just bit me too, can someone add a note to http://qt-project.org/doc/qt-5/qqmlapplicationengine.html that mentions it?
Can you provide a minimal example for the note ?