Unable to run currency converter app in Qt Creator with ubuntu-sdk

by kiawin

Many rookie like me will find it perplexed when our currency converter app tutorial for Ubuntu SDK failed to work when we click “Preview (qmlscene)” after following steps recommended to invoke qmlscene instead of qmlviewer.

Apparently there were great change in how we install and run ubuntu-sdk at the latest qt5-proper moving from qt5-beta. qt5 is no longer located in /opt/qt5 and qmlscene will certainly not be located in /opt/qt5/bin/qmlscene.

This is further proven as the tutorial app can be ran through commandline but not via Qt Creator.

$ qmlscene /path/to/application.qml

A quick whereis shows that qmlscene was located else where instead.

$ whereis qmlscene
qmlscene: /usr/bin/qmlscene /usr/bin/X11/qmlscene

Hence the correct steps are as follow:

1. In Qt Creator, go to Tools > Options…
2. Choose the External Tools tab, then in the pane click Add > Add Tool
3. Rename “New Tool” to “Preview (qmlscene)”
3. Fill in the following:

  • Executable: /usr/bin/X11/qmlscene
  • Arguments: %{CurrentDocument:FilePath}
  • Effective Arguments: /path/to/application.qml
  • Working directory: %{CurrentDocument:Path}

4. Click on OK to save the changes.

Now you’ll be able to view your app through the Tools > External > Qt Quick > Preview (qmlscene) menu entry, from within the IDE and you won’t need a terminal anymore.

Cheers :)