0

I'm trying to add a currently standalone Qt QML application ("new application") as a display widget in a QMdiArea in a large non-QML Qt application ("main application"). The main application I'm trying to add this to uses Qt 5.6.0, and the new application uses Qt 4.8.

My first step was to get "new application" compiling under Qt 5.6, but the major architectural change for Qt QML applications between Qt 4 and Qt 5 has me stumped. The primary View for "new application" inherits directly from QDeclarativeView and makes heavy use of QWidget and QGraphicsView functionality.

Qt's guide for migrating QML applications from Qt4 to Qt5 (http://doc.qt.io/qt-5/qtquick-porting-qt5.html) seems to suggest using the deprecated declarative module as the solution to this problem, but all of the source code for QDeclarative has been removed from qtquick1 as of 5.6.0 and I can't switch "main application" back to an earlier version of Qt.

I'm new to both Qt and "new application." Is there an easier way to approach this than to get a complete understanding of "new application" as currently designed and then read up on both the old declarative framework and the new qtquick framework and restructure/rewrite everything to use the new qtquick framework?

Kristin
  • 142
  • 1
  • 9

1 Answers1

1

The porting effort to QML2 varies a lot depending on how many custom items you have and how you interact with the declarative view from the main application. Either way, I highly recommend spending the time to actually understand the existing QML code before attempting to port it. Much of the porting code often consists of only replacing QDeclarative* with QQuick*, but you will eventually have to face the QGraphicsView -> OpenGL part of the porting.

For embedding a QML2 scene in a QWidget application, QQuickWidget is what you need.

I'm a bit surprised myself QtQuick1 is removed entirely and not just deprecated in qt 5.6. If you compile and ship your own toolchain then reintroducing the qtquick1 submodule shouldn't be too much effort as there are no major architectual changes in qt5.6 that keeps it from working.

Harald H
  • 58
  • 4