Setting up Ubuntu SDK on Kubuntu with backports enabled

Gah... So once again my temptation to install the latest and greatest causes a conflicting system setup. This time it was my attempt at installing the Ubuntu SDK on a Kubuntu system with backports enabled that conflicted. Backports are packages that are only available to newer versions of Ubuntu rebuilt for older versions, like when you want to use KDE 4.10 for Ubuntu 12.04. Although rare, when you want to install newer versions of other software you might end up with conflicts.

The result this time was the following error message upon installing the ubuntu-sdk package:

Unpacking qtchooser (from .../qtchooser_0.0.1~git20121229.g8f08405-0ubuntu1~precise1~test6_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/qtchooser_0.0.1~git20121229.g8f08405-0ubuntu1~precise1~test6_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/qdbuscpp2xml', which is also in package libqt4-dev-bin 4:4.8.2+dfsg-2ubuntu1~precise1~ppa2
Processing triggers for man-db ...
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

Trying to fix the error by removing libqt4-dev-bin only resulted in a long line of dependencies that will eventually conflict with the kde-workspace package, and you really don't want to remove that (unless you want to get rid of KDE altogether).

To fix this, I tried a multitude of other options, only to realize that I could install all other packages in ubuntu-sdk to get what was needed to start developing apps for Ubuntu Phone and Tablet. These were installed by the single command:

sudo apt-get install qtdeclarative5-dev libqt5xmlpatterns5-dev qtscript5-dev qttools5-dev libqt5webkit5-dev qt3d5-dev qtmultimedia5-dev libqt5svg5-dev libqt5graphicaleffects5 qmlscene qtdeclarative5-dev-tools qttools5-dev-tools qtlocation5-dev qtsensors5-dev qtpim5-dev qtcreator ubuntu-qtcreator-qt5libs ubuntu-qtcreator-plugins qt-components-ubuntu qt-components-ubuntu-demos qt-components-ubuntu-examples

After this, you may launch ubuntu-qtcreator from terminal. It won't find the Qt5 installation however, but you can point it to it by going to Tools > Options > Build & Run > Qt Versions and adding /usr/lib/x86_64-linux-gnu/qt5/bin/qmake:

qt-options-qt5-ubuntu{.aligncenter .size-large .wp-image-840 width="640" height="387"}

Now you just need to add a new Kit pointing to the new Qt version. Before you do this, click OK and then open Options again to refresh your Qt versions available for Kits.

That's it. Now you should be able to add a new Ubuntu UI project in Qt Creator and get started!