January 15, 2012

jazzyeagle jazzyeagle
Lab Rat
4 posts

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

5 replies

January 15, 2012

markc markc
Lab Rat
29 posts

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…

  1. /usr/lib/qt/imports/QtDesktop/

January 15, 2012

jazzyeagle jazzyeagle
Lab Rat
4 posts

The parts that made me think this was an install issue were:

Line 15: make1: Nothing to be done for `first’.
Line 136: make1: 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:

  1. import QtQuick 1.1
  2.     import Buttom.qml 1.1
  4.     Rectangle {
  5.         width: 360
  6.         height: 360
  7.         Button {
  8.             id: myButton
  9.             text: qsTr("Hello World")
  10.             anchors.centerIn: parent
  11.         }
  12.         MouseArea {
  13.             anchors.fill: parent                                          
  14.             onClicked: {
  15.                 Qt.quit();
  16.             }
  17.         }
  18.     }

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.1

Not 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.1

Switching 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:

1) Did I have an install issue, or was everything ok?
2) Do I need to install QtQuick 1.1 or even 2.0?
3) If I install QtQuick separately, will I have to do anything different to get Qt Creator to recognize it?
4) 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?
5) 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.

January 15, 2012

markc markc
Lab Rat
29 posts

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…

  1. 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)…

  1. import QtQuick 1.1
  2. import QtDesktop 0.1
  4. Window {
  5.   width: 160; height: 90
  6.   visible: true
  7.   Button {
  8.     id: myButton
  9.     text: qsTr("Hello World")
  10.     anchors.centerIn: parent
  11.   }
  12.   MouseArea {
  13.     anchors.fill: parent                                          
  14.     onClicked: Qt.quit()
  15.   }
  16. }

And run it with something like… qmldesktopviewer buttontest.qml

January 16, 2012

jazzyeagle jazzyeagle
Lab Rat
4 posts

I tried the dpkg line you provided, and it didn’t indicate the package was installed. Two reasons, I believe for that:

1) 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.

2) 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:

  1. jazzyeagle@Jazzy-MINI:~/Qt_Apps/RulezGen/qml/RulezGen$ ~/Downloads/desktop/qmldesktopviewer/qmldesktopviewer ./main.qml
  2. file:///home/jazzyeagle/Qt_Apps/RulezGen/qml/RulezGen/main.qml:2:5: module "QtQuick" is not installed
  3.          import QtQuick 1.1
  4.          ^
  5. ^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.

January 16, 2012

markc markc
Lab Rat
29 posts

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.

  ‹‹ Use of transparent .png and .gif      "error PRJ0019"-How can I resolve this? ››

You must log in to post a reply. Not a member yet? Register here!