QML form in C++ class
I want build a new project using Qt Quick and the new native widgets available. I want to use C++ for the application logic. This is where I get a bit confusion.
Every example just puts everything in the main.cpp of the program. This is very messy. With old widgets system, I would have a class for every window in the application.
How do I do this with QML? How do I wrap my main.qml file in a C++ class called MainWindow that I can open from main.cpp? How would other window classes be opened from that? I have put my main.qml in a resource file.
Hi, and welcome to the Qt Dev Net!
"QQuickView":http://qt-project.org/doc/qt-5/qquickview.html is the C++ class for showing QML-based GUI elements.
See https://blog.qt.digia.com/blog/2013/02/19/introducing-qwidgetcreatewindowcontainer/ to embed a QQuickView into QWidgets. Qt 5.3 will have a new QQuickWidget class that makes this much simpler.