Sunday, April 28, 2024
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 4938  / 2 Years ago, thu, january 27, 2022, 12:16:05

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
}
}
}

More From » application-development

 Answers
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)


[#33383] Friday, January 28, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sconhoney

Total Points: 403
Total Questions: 118
Total Answers: 109

Location: Andorra
Member since Mon, Jan 9, 2023
1 Year ago
sconhoney questions
;