Module "QtQUick" version 2.0 is not installed, using QDeclarativeView in UI Form
-
Hello,
I am trying to integrate a QML control into a Form window (following the QMLTest example with the timer/green/blue square), which uses a QDeclarativeView in the form.
This works fine with QtQuick 1.0 but apparently not with QtQuick 2.0
When i change to QtQuick 2.0, I get the error:
module "QtQuick" version 2.0 is not installed in the Application Output window. I tried many of the suggestions in different posts (i.e. adding QML_IMPORT_PATH etc... ) but to no avail: these solution seems to be geared towards QtQuick applications based on the QuickQmlViewer, not using Forms.I'm pretty new to Qt, and I'm a bit confused by the changes between QtQuick 1.0 and 2.0, but it seems like there are major differences. Is using QDeclarativeView still the way to go to use QML Quick 2.0 controls in a form? I hear post saying QQuickView should be used instead, but it's not one of the options in the Designer in QtCreator. Would that mean it's the new way to go but it needs to be done in code? It seems quite painful to resort to this option: the whole point of using forms and QML for me was to make it easy for the designer!
So, some light on the proper recommended way to integrate QML QtQuick 2.0 controls in a Form Window would be great. i need to use some of the Form fonctionalities (i.e. menus, tabs and docking widgets) but integrate my custom UI built on QML in those.
Let me know what you think...
and if there is a way to configure the project properly to use QML QtQuick 2.0 controls in Forms, any help on how I should make it happen would be very much appreciated.
-
QDeclarativeView (and in general, the QDeclarativeWhatever classes) are for QtQuick1 only. You cannot use them for QtQuick2.
For QtQuick2, use QML2_IMPORT_PATH, not QML_IMPORT_PATH. You can set QML_IMPORT_TRACE=1 in your environment to get more debugging information about what's going on with imports in your application when you run it.
I don't know if the form designer in QtCreator supports QtQuick2 yet - if it doesn't, it almost certainly will once the QtQuick Controls project is released (soon). For now, though, probably writing your QML forms by hand is the best option.
Cheers,
Chris. -
So if QDeclarativeView is for QtQuick 1.0, is it QQuickView I need to use?
When i look into QQuickView, it doesn't seem ot be possible to add this to a Widget because it inherits from a QWindow not a QWidget...
So, does that mean there is no way to add a QtQuick 2.0 control to a UI form? That seems a bit absurd... unless there are new features coming that would get rid of Forms.
Is that what you mean by QtQuick Controls? What is it about?There are a lot of limitations to QtQuick 1.0, especially in terms of shader/effects... that's why i want to use 2.0
-
digging a little, it seems like the solution is coming... but not in a release yet.
-
Yes, all QDeclarative* classes have been renamed to either QQuick* classes or QQml* classes. See this "porting guide":http://qt-project.org/doc/qt-5.0/qtquick/qtquick-porting-qt5.html#c-code for a full list.
Qt Quick 1 was a new technology and has many limitations as you've found, so the Qt developers redesigned it to produce Qt Quick 2. Qt Quick 1 is now deprecated.
Qt Quick Controls brings QWidget-like components to QML (see http://blog.qt.digia.com/blog/2012/06/06/desktop-components-for-qt-5/ ) It will be released with Qt 5.1, which has its beta is scheduled to be ready in a few more weeks.
Unfortunately there's no way to incorporate Qt Quick 2 components directly in the Forms window yet. If you want, you can use the bug report's suggestions as a workaround: Create a custom "QWidget which takes a QQuickView":http://blog.qt.digia.com/blog/2013/02/19/introducing-qwidgetcreatewindowcontainer/ and then "promote":http://qt-project.org/doc/qt-4.8/designer-using-custom-widgets.html#promoting-widgets that widget in your Form.