Installing Desktop Components
-
Hello -
A friend has strongly pushed for me to try QML, and the make-or-break for me is desktop components. I tried downloading from git and keep coming into issues during the install process, and I'm not sure what I'm doing wrong. I'm installing on Linux, Ubuntu Lucid specifically with Qt Creator 2.4.0 installed, which uses Qt 4.7.4 (32 bit).
Below is the pastebin link to the output when attempting to download & compile. If you can help me figure out what is wrong (or what I'm doing wrong, whichever is applicable), I would be most appreciative. I did try the 'qmake && make install' approach as well, with similar results. Thanks!!
"PasteBin": http://pastebin.com/wyMPh7Kt
-
The pastebin output looks okay. You haven't indicated exactly what error you are getting when you try to use the desktop components. FWIW my Archlinux system installs the components in this path so perhaps make a copy or symlink from your current /usr/lib/qt4 path to the below...
@/usr/lib/qt/imports/QtDesktop/@
-
The parts that made me think this was an install issue were:
Line 15: make[1]: Nothing to be done for
first'. Line 136: make[1]: Nothing to be done for
install'.I was worried I did something wrong to cause those, but if you think that those are ok, then I must be doing something wrong with how I'm configuring Qt Creator for running this.
So all I did was create a new Qt Quick Application project, changed the label to a Button, and the version of QtQuick was changed from 1.0 to 1.1. The QML code looks like this:
@import QtQuick 1.1
import Buttom.qml 1.1Rectangle { width: 360 height: 360 Button { id: myButton text: qsTr("Hello World") anchors.centerIn: parent } MouseArea { anchors.fill: parent onClicked: { Qt.quit(); } } }
@
I also added this to the .pro file:
QML_IMPORT_PATH = /usr/lib/qt4/imports/QtDesktop
When I try to run this, the first error I get is: Desktop_Qt_4_7_3_for_GCC__Qt_SDK__Debug/qml/RulezGen/main.qml:2:1: module "QtQuick" version 1.1 is not installed
import QtQuick 1.1Not sure why that's not installed considering I have the most recent version, so I try switching back to 1.0. Then I get this: file:///home/jazzyeagle/Qt_Apps/RulezGen-build-desktop-Desktop_Qt_4_7_3_for_GCC__Qt_SDK__Debug/qml/RulezGen/main.qml:3:5: module "Buttom.qml" is not installed
import Buttom.qml 1.1Switching Button's version to 1.0 yields the same last result. So, I see several potential issues, but I'm not entirely sure in what order to try things. At this point, here are my questions:
- Did I have an install issue, or was everything ok?
- Do I need to install QtQuick 1.1 or even 2.0?
- If I install QtQuick separately, will I have to do anything different to get Qt Creator to recognize it?
- Will I have to change a setting in Qt Creator to have it look for qmldesktop viewer as opposed to its default? If so, where?
- Is there anything else I need to do in order to get the new desktop components to integrate with Qt Creator? I really like Qt Creator, and I really don't like the thought of using it to write code, then using the CLI to compile and run it.
Thank you for your time.
-
Qt 4.7.4 includes QtQuick 1.1. I'm not sure about Ubuntu but maybe this will tell you the path of your installed Qt plugins folder...
@dpkg -L qt4-x11 | grep imports@
and if it happens to look like /usr/lib/qt/imports/ then just copy what you have in /usr/lib/qt4 into /usr/lib/qt or the other way around (this is a long shot and assuming you installed the Ubuntu package originally, which, if so, you may want to uninstall). For a test try something like this (works for me)...
@import QtQuick 1.1
import QtDesktop 0.1Window {
width: 160; height: 90
visible: true
Button {
id: myButton
text: qsTr("Hello World")
anchors.centerIn: parent
}
MouseArea {
anchors.fill: parent
onClicked: Qt.quit()
}
}@And run it with something like... qmldesktopviewer buttontest.qml
-
I tried the dpkg line you provided, and it didn't indicate the package was installed. Two reasons, I believe for that:
-
I installed using the Qt binary installer (http://qt.nokia.com/downloads/sdk-linux-x11-32bit-cpp), so since I didn't install through a .deb file, dpkg wouldn't know it was installed.
-
I couldn't find a package called qt4-x11 in the Ubuntu Software Center.
Another issue I found was that qmldesktopviewer didn't actually get moved during the install process (I believe it was related to line 136 of my pastebin). When I ran it from the location it was listed, I get the following message:
@
jazzyeagle@Jazzy-MINI:~/Qt_Apps/RulezGen/qml/RulezGen$ ~/Downloads/desktop/qmldesktopviewer/qmldesktopviewer ./main.qml
file:///home/jazzyeagle/Qt_Apps/RulezGen/qml/RulezGen/main.qml:2:5: module "QtQuick" is not installed
import QtQuick 1.1
^
^Z
@I verified again that I have qt 4.7.4, ran the SDK-Update-Tool through the package manager and selected everything I could. Same issue.
I completely uninstalled Qt and reinstalled it using the binary. Same issue.
I'm at a loss now. Any other ideas? Thanks.
-
-
I guess the problem is that you have the SDK and qtcreator works within that environment but when you drop out to a normal shell then doing anything with Qt does not work, so how about trying to build the desktop components from within qtcreator as a normal project?
In qtcreator go to File -> Open File or Project and select desktop.pro from the desktop components folder and build it. If that is successful then go to Projects and look at Build Steps -> Make and click on Details and add "install" to the "Make arguments" field and click Run again. With a bit of luck that will install the components into your SDKs idea of where things should go.
Now if you go to Projects and look at Run Settings you'll see the full path to the qmldesktopviewer program. Use qtcreator to create a new plain text file (a General template) and save it to the working directory (.../desktop/qmldesktopviewer) as "testbutton.qml" with my example as the contents, add "testbutton.qml" to the Run -> Arguments field and click on Run once again and that might now pop up the qmldesktopviewer window with the example button. I just tested this and it worked for me but I'm not using the SDK.
This won't help you build and run RulezGem from outside the SDK but it might get you something that at least works. See how this procedure works first.