I have installed the latest Qt 5.5.0, but there seems to be only QtQuick.Controls 1.0 and 1.1. I want to use TreeView
, which is contained in the 1.4 version.
3 Answers
You should already have it. Try to find the TreeView.qml
by using locate TreeView.qml
. Also, QtCreator or your IDE should have proper QML_IMPORT_PATH
which is taken from environment. For example, my QtCreator
does not have set proper paths so I use it with shell script which sets the path and runs /usr/bin/qtcreator
after - this makes QtCreator
to see new QML
modules. I don't know is this a bug or just a ubuntu-package problem, but it worked for me only when I set the QML_IMPORT_PATH
manually.
You say you have these paths:
~/Qt5.5.0/5.5/Src/qtquickcontrols/src/controls/TreeView.qml
~/Qt5.5.0/5.5/gcc_64/qml/QtQuick/Controls/TreeView.qml
~/Qt5.5.0/Tools/QtCreator/bin/qml/QtQuick/Controls/TreeView.qml
Looks like you installed it by downloading official installer from Qt's site. So, the first path is a sources path. Don't use it ever, it is only needed to be installed into correct directory after compiling Qt from sources and performing make install
.
The third one is integrated with your QtCreator
installation, but it seems it does not work for you.
I'd say, your choice is to use second path (~/Qt5.5.0/5.5/gcc_64/qml/QtQuick/Controls/TreeView.qml
). It is usually installed automatically to /usr/lib/x86_64-linux-gnu/qt5/
on amd64 architecture and to /usr/lib/i386-linux-gnu/
for i386 architecture.
So, create a script in /usr/bin/
, call it dev-qtcr
for example and put inside it:
#!/bin/bash
export QML_IMPORT_PATH=/home/user/Qt5.5.0/5.5/gcc_64/qml
qtcreator
Be sure to change /home/user
to your home directory.
An other solution, which is quite ugly, is to edit the qmldir
file from gcc/qml/QtQuick/Controls
and add the following line:
TreeView 1.4 TreeView.qml
As a result for me :
module QtQuick.Controls
plugin qtquickcontrolsplugin
classname QtQuickControlsPlugin
typeinfo plugins.qmltypes
designersupported
depends QtQuick.Window 2.2
TreeView 1.4 TreeView.qml
You can do so for each QML file which is in the QtQuick/Controls
directory.
In this way, TreeView
and all other QML types you will add to this file will be recognized by QtCreator.
~/Qt5.5.0/5.5/Src/qtquickcontrols/src/controls/TreeView.qml--- ~/Qt5.5.0/5.5/gcc_64/qml/QtQuick/Controls/TreeView.qml--- ~/Qt5.5.0/Tools/QtCreator/bin/qml/QtQuick/Controls/TreeView.qml
Which one should I add to the path? @VictorPolevoy – ZenTreeView
component is not found, it works. Thanks @Mitch – Zen