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 installableThe 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.
3 Answers
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-devIf you haven't already, download and install the QtSDK from .
For Ubuntu 64-bit run:
cd ~
wget
mv qt-linux-opensource-5.0.0-x86_64-offline.run qt5-installer.runFor Ubuntu 32-bit run:
cd ~
wget
mv qt-linux-opensource-5.0.0-x86-offline.run qt5-installer.runThen make it executable:
chmod +x qt5-installer.runNow run it as root in order to install it to /opt:
sudo ./qt5-installer.runFollow 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 QtProjectNow for the Qt Ubuntu Components, download the source file and unpack it:
wget
tar -zxvf qt-components-ubuntu_0.1.24~quantal1.tar.gzNow 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/qt5For Ubuntu 32-bit run:
sudo ln -s /opt/QtSDK/5.0.0/gcc /opt/qt5One 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' >> ~/.bashrcNow we need generate a Makefile an build the Qt Ubuntu Components:
cd ~/trunk
qmake ubuntu-sdk.pro
make
sudo make installIf 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!
3Thanks 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/modulesTry to execute components demo with
ubuntu-sdk.prowith this command:/opt/qt5/bin/qmake -o Makefile ubuntu-sdk.pro qmlscene --fullscreen -I modules demos/PhoneComponentShowcase.qmlor
qmlscene -I modules demos/ComponentShowcase.qmlTo 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 to the sources.list. After that a
sudo apt-get update followed by your installation command should fix the problem.
2