There are not so many components for QML. To use buttons, tabs, windows etc, you need Qt Components for Desktop.
Qt Labs blog article says that you can install Qt Components for Desktop with “qmake && make install”. But it is too difficult to understand for newbies like me. I’ll explain how to install.
# My environment is Linux. On Windows and Mac, not same way can be used.
First, download Qt Components for Desktop.
Open this URL and “download master as tar.gz” to download latest version. Using January 24 2012 version is also good choice. I succeeded with this version.
# Of course you can download via git instead. Execute “git clone git://gitorious.org/qt-components/desktop.git”
Extract the tar.gz file. This time, extracted directory will be named as “qt-components-desktop”
Move to “qt-components-desktop” directory and check the contents with ls.
$ > cd /home/phanect/Desktop/qt-components-desktop $ > ls components desktop.pro desktop.qmlproject examples Makefile qmldesktopviewer README src
Next, let’s compile and install.
At fitst, we have to execute qmake command. You should use qmake included in QtSDK. I failed to install when I use qmake provided by linux distributer. (openSUSE)
Just execute following command.
/home/phanect/bin/QtSDK/Desktop/Qt/4.8.0/gcc/bin/qmake
# I’m using Qt 4.8.0.
And, execute make install. This make command should be installed from system repository.
make install
Then see /home/phanect/bin/QtSDK/Desktop/Qt/4.8.0/gcc/imports/QtDesktop/ and you can find various files.
Then, you can use various components.
import QtQuick 1.1
import QtDesktop 0.1
Rectangle {
width: 360
height: 360
Button {
}
}
Write “import QtDesktop 0.1″ to use components.
hi, i have downloaded qt components for desktop but after extracting there is no ‘Makefile’ in “qt-components-desktop”, how to solve that?
Hi ksiedzulek.
Ordinary Qt project don’t have Makefile.
I think Makefile will be generated by qmake command.
Try executing
/home/phanect/bin/QtSDK/Desktop/Qt/4.8.0/gcc/bin/qmake
in qt-components-desktop directory then you will find Makefile in the directory.
…Probably (^^;