13

First of all i need to create a "hello world" app using QML & QT Creator as described here http://developer.ubuntu.com/get-started/gomobile/

Second, when i was trying to install QML platform and the dependencies i couldn't run the step 2 (of "Install the Ubuntu QML toolkit preview") because i have a distro (backbox) based on ubuntu 12.04 but i solve it by following the instructions of this post: https://askubuntu.com/questions/235440/how-do-i-install-the-qml-toolkit-on-12-04

Third, when i open QTCreator and trying to execute CurrencyConverter (helloWorld app) the program can't find the following packages:

import Ubuntu.Components 0.1

What can i do in order to run the app?

thanks in advance.

import QtQuick 2.0
import Ubuntu.Components 0.1

Rectangle {
    id: root
    width: units.gu(60)
    height: units.gu(80)
    color: "lightgray"

    property real margins: units.gu(2)
    property real buttonWidth: units.gu(9)

    Label {
       id: title
       ItemStyle.class: "title"
       text: i18n.tr("Currency Converter")
       height: contentHeight + root.margins
       anchors {
           left: parent.left
           right: parent.right
           top: parent.top
       }
    }
}
CodeArtist
  • 387
  • 1
  • 3
  • 11

4 Answers4

3

I found out the solution at least for ubuntu 12.04. I had to go to the official site http://qt-project.org/downloads#qt-creator and download the latest Qt package which is Qt 5.0.0.

*Note: Ubuntu 12.04 doesn't include the latest Qt version, so you have to download it manually.

*Note: Before the installation i removed the previous version of QtCreator (2.5.0)

All you have to do in order to install Qt5 package is:

  • chmod 755 qt-linux-opensource-5.0.0-x86_64-offline.run

Then just execute the package and run the installer with the default settings.

  • ./qt-linux-opensource-5.0.0-x86_64-offline.run

  • Now should exist /opt/qt5/imports/Ubuntu/Components path, with all the libraries!

After that i followed the instructions of the CurrencyConverter

*Note that line: import Ubuntu.Components 0.1 is still highlighted with a red line but the program runs normally by choosing Tools > External > Qt Quick > Preview (qmlviewer) (thanks to @David Planella)

CodeArtist
  • 387
  • 1
  • 3
  • 11
0

You can actually go to options -> build and run -> qt versions (I have Polish version so I had to translate it back to English - sorry if names are slightly different). Then you add latest version of qt, which you already have installed - it's in /opt/qt5/bin.

bender
  • 1,854
Tomasz
  • 1
0

If you have QT5 properly installed and still import Ubuntu.Components 0.1 is highlighted you should do this:

  • open .qmlproject file (included in automatically generated project)
  • add this text: importPaths: [ "/opt/qt5/imports" ] before last closing: }

...and problem should gone.

0

You're probably going to want to run/build all the qt demos by opening the .pro files for the specific examples.

chown -R yourusername /opt/qt5/examples/

When I went to build the opengl/textures example by opening the textures.pro file within qtcreator, it automatically configured the project BUT it was pointing to QT4 by default. I got a strange error that said it could not find QtWidgets when I was trying to build using qt4. With Qt5 as the build tool, the problem went away.

MAKE SURE YOU POINT TO QT5 as the project build for debug/release because it's not the default in qtcreator. Otherwise you will get strange errors when building. This problem is easy to spot in the compilation output which should be showing qt5 include and qt5 libs paths.

2:58:51: Running steps for project textures...
12:58:51: Starting: "/usr/bin/make" clean -w
make: Entering directory `/opt/qt5/examples/qtbase/opengl/textures-build-Desktop Release'
rm -f qrc_textures.cpp
rm -f moc_glwidget.cpp moc_window.cpp
rm -f glwidget.o main.o window.o qrc_textures.o moc_glwidget.o moc_window.o
rm -f *~ core *.core
make: Leaving directory `/opt/qt5/examples/qtbase/opengl/textures-build-Desktop-Release'
12:58:52: The process "/usr/bin/make" exited normally.
12:58:52: Configuration unchanged, skipping qmake step.
12:58:52: Starting: "/usr/bin/make" -w
make: Entering directory `/opt/qt5/examples/qtbase/opengl/textures-build-Desktop-Release'
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++-64 -I../textures -I../../../../include -I../../../../include/QtOpenGL -I../../../../include/QtWidgets -I../../../../include/QtGui -I../../../../include/QtCore -I. -I. -o glwidget.o ../textures/glwidget.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++-64 -I../textures -I../../../../include -I../../../../include/QtOpenGL -I../../../../include/QtWidgets -I../../../../include/QtGui -I../../../../include/QtCore -I. -I. -o main.o ../textures/main.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++-64 -I../textures -I../../../../include -I../../../../include/QtOpenGL -I../../../../include/QtWidgets -I../../../../include/QtGui -I../../../../include/QtCore -I. -I. -o window.o ../textures/window.cpp
/opt/qt5/bin/rcc -name textures ../textures/textures.qrc -o qrc_textures.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++-64 -I../textures -I../../../../include -I../../../../include/QtOpenGL -I../../../../include/QtWidgets -I../../../../include/QtGui -I../../../../include/QtCore -I. -I. -o qrc_textures.o qrc_textures.cpp
/opt/qt5/bin/moc -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++-64 -I../textures -I../../../../include -I../../../../include/QtOpenGL -I../../../../include/QtWidgets -I../../../../include/QtGui -I../../../../include/QtCore -I. -I. ../textures/glwidget.h -o moc_glwidget.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++-64 -I../textures -I../../../../include -I../../../../include/QtOpenGL -I../../../../include/QtWidgets -I../../../../include/QtGui -I../../../../include/QtCore -I. -I. -o moc_glwidget.o moc_glwidget.cpp
/opt/qt5/bin/moc -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++-64 -I../textures -I../../../../include -I../../../../include/QtOpenGL -I../../../../include/QtWidgets -I../../../../include/QtGui -I../../../../include/QtCore -I. -I. ../textures/window.h -o moc_window.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/linux-g++-64 -I../textures -I../../../../include -I../../../../include/QtOpenGL -I../../../../include/QtWidgets -I../../../../include/QtGui -I../../../../include/QtCore -I. -I. -o moc_window.o moc_window.cpp
g++ -m64 -Wl,-O1 -Wl,-rpath,/opt/qt5/lib -o textures glwidget.o main.o window.o qrc_textures.o moc_glwidget.o moc_window.o   -L/usr/X11R6/lib64 -L/opt/qt5/lib -lQtOpenGL -lQtWidgets -lQtGui -lQtCore -lGL -lpthread 
make: Leaving directory `/opt/qt5/examples/qtbase/opengl/textures-build-Desktop-Release'
12:58:57: The process "/usr/bin/make" exited normally.
fabricator4
  • 8,471
  • 1
  • 37
  • 39