It appears that since I didn't install the beta1 version of QT5 from the ppa, I'm unable to use the Ubuntu components package. I have the released version QT5 already and not interested in installing a beta version now. Is there a workaround?

The following packages have unmet dependencies:
qt-components-ubuntu : Depends: qtbase but it is not installable
                       Depends: qtdeclarative but it is not installable

The instructions to install the preview toolkit are here. I skipped the step to install QT5 because I already have a newer version straight from qt-project.org.


These instructions were tested on Ubuntu 12.04, Ubuntu 12.10 both 32-bit and 64-bit.

First off we need to install some dependencies. Install these even if you already have Qt5 installed:

sudo apt-get install build-essential libgtk2.0-dev libgl1-mesa-dev

If you haven't already, download and install the QtSDK from http://qt-project.org/downloads.

For Ubuntu 64-bit run:

cd ~
wget http://releases.qt-project.org/qt5/5.0.0/qt-linux-opensource-5.0.0-x86_64-offline.run
mv qt-linux-opensource-5.0.0-x86_64-offline.run qt5-installer.run

For Ubuntu 32-bit run:

cd ~
wget http://releases.qt-project.org/qt5/5.0.0/qt-linux-opensource-5.0.0-x86-offline.run
mv qt-linux-opensource-5.0.0-x86-offline.run qt5-installer.run

Then make it executable:

chmod +x qt5-installer.run

Now run it as root in order to install it to /opt:

sudo ./qt5-installer.run

Follow the prompts and, when asked where to install, select /opt/QtSDK. From now on I will assume that you have it installed to that location, if you already had the Qt installed to a different location, adapt the steps in order to reflect your installation.

After installation I suggest you delete the QtCreator configuration folder as the permissions are wrong. QtCreator will recreate them when restarted.

cd ~/.config
sudo rm -rf QtProject

Now for the Qt Ubuntu Components, download the source file and unpack it:

wget https://launchpad.net/~ui-toolkit/+archive/ppa/+files/qt-components-ubuntu_0.1.24%7Equantal1.tar.gz
tar -zxvf qt-components-ubuntu_0.1.24~quantal1.tar.gz

Now in order to compile and install the components we need to create some sim-links.

For Ubuntu 64-bit run:

sudo ln -s /opt/QtSDK/5.0.0/gcc_x64 /opt/qt5

For Ubuntu 32-bit run:

sudo ln -s /opt/QtSDK/5.0.0/gcc /opt/qt5

One more thing before we compile and install, we need to change two environment variables, PATH and QML_IMPORT_PATH:

export PATH=$PATH:/opt/qt5/bin
export QML_IMPORT_PATH=/opt/qt5/imports
echo 'export PATH=$PATH:/opt/qt5/bin' >> ~/.bashrc
echo 'export QML_IMPORT_PATH=/opt/qt5/imports' >> ~/.bashrc

Now we need generate a Makefile an build the Qt Ubuntu Components:

cd ~/trunk
qmake ubuntu-sdk.pro
sudo make install

If everything went OK, the the components should be built and installed, now we need to try it out to make sure everything went alright. I suggest you log out and the back in before doing the next steps.

  • Open QtCreator, go to Tools -> Options, select the External Tools tab.
  • For Qt Quick 1 Preview (qmlviewer), in the Executable field write: /opt/qt5/bin/qmlviewer
  • For Qt Quick 2 Preview (qmlscene), in the Executable field write: /opt/qt5/bin/qmlscene.
  • Click Apply and close the Options window.

Everything should be working now, one thing to keep in mind is that in order to successfully execute a QML Ubuntu Phone Application, in the .qmlproject file you need to uncomment importPaths and add "/opt/qt5/imports" to it like so:

Project {
    /* List of plugin directories passed to QML runtime */
        importPaths: [ "/opt/qt5/imports" ]

That's about it. For any questions comment and I'll try to get back to you. Have Fun!

  • Worked pretty well; after install, I did have to fix ownership of my ~/.config/QtProject folder as my user account could access the files. The QtSDK installer had left a few files under ~/.config/QtProject with root:root ownership. – MightyWok Jan 5 '13 at 19:10
  • Working through the CurrencyConverter tutorial, the "import" directive checks out, and the Label element is recognized but the ItemStyle attribute isn't. If I comment out the ItemStyle.class attribute then QtCreator is happy again. Odd. – MightyWok Jan 5 '13 at 20:15
  • I don't know what to tell you. I haven't gotten through the tutorial yet. I've only played with individual components and edited some of their properties. But if you do figure one what the problem is I will add it to the answer. – kicsyromy Jan 6 '13 at 8:16

Thanks for your inputs kicsyromy. I just happened to follow below steps to resolve "import QtQuick 2.0" and other issues on executing and testing Ubuntu components on my installation.

  • Untar Ubuntu components (qt-components-ubuntu_0.1.24~quantal1.tar.gz) under any permission directory and you will get the trunk directory like this /home/<user>/UbuntuQt/trunk/

  • Try to override permission for trunk directory as (sometimes I happen to see error as permission denied):

    sudo chown <user-name> -R trunk/
  • Set your QML_IMPORT_PATH to your /home/<user>/UbuntuQt/trunk/modules

  • Try to execute components demo with ubuntu-sdk.pro with this command:

    /opt/qt5/bin/qmake -o Makefile ubuntu-sdk.pro
    qmlscene --fullscreen -I modules demos/PhoneComponentShowcase.qml


    qmlscene -I modules demos/ComponentShowcase.qml
  • To test unit converter, do create qmlproject.user in /trunk/examples/

    /opt/qt5/bin/qmake -o Makefile examples.pro
    qmlscene -I ../../modules unit-converter/converter.qml

Easier way would be to add the PPA from https://launchpad.net/~canonical-qt5-edgers/+archive/qt5-proper to the sources.list. After that a

sudo apt-get update 

followed by your installation command should fix the problem.

  • OP mentioned that he already installed full version of Qt and not interested to install beta version from ppa – Tachyons Feb 2 '13 at 14:25
  • This topic is related to two other topics which refer to this one so it could be helpful for the authors of these threads. – Phidelux Feb 2 '13 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.