My apologies, I was mistaken. You’re right, ApplicationWindow cannot be used with QtQuick2ApplicationViewer which subclasses QQuickView.
Ok, note that QtQuick2ControlsApplicationViewer is not actually part of Qt. Its code is auto-generated when you create a new Qt Quick Controls project. That means you can modify QtQuick2ControlsApplicationViewer however you want.
The code generator forgot to provide a function to get the root context. You can add it yourself. Add this public method to QtQuick2ControlsApplicationViewer:
QQmlContext* QtQuick2ControlsApplicationViewer::rootContext() {
return d->engine.rootContext();
}
There is a bug report that describes this oversight: https://bugreports.qt-project.org/browse/QTCREATORBUG-11048
↧