I'd like to start writing QML applications. I followed this tutorial: http://qt-project.org/doc/qt-4.8/qml-tutorial1.html

my code is:

import QtQuick 1.0

Rectangle {
    id: page
    width: 500; height: 200
    color: "lightgray"

    Text {
        id: helloText
        text: "Hello world!"
        y: 30
        anchors.horizontalCenter: page.horizontalCenter
        font.pointSize: 24; font.bold: true

But I have the following error when I run it using qmlviewer:

qmlviewer: could not exec '/usr/lib/x86_64-linux-gnu/qt5/bin/qmlviewer': No such file or directory

I tried several qml launchers in /usr/lib/x86_64-linux-gnu/qt5/bin/,

qmltestrunner returns:

FAIL!  : qmltestrunner::tst_ubuntutestcase::compile() module "QtTest" is not installed

and qmlscene fails with:

qmlscene: 'import QtQuick 1.0' is no longer supported.
Use qmlviewer to load file 'hello.qml'.

How I'm supposed to run this tutorial?


The correct launcher for simple qml files is qmlscene.

You just need to change your QtQuick version to 2.0 since the Ubuntu SDK is using Qt 5:

import QtQuick 2.0

Visit http://developer.ubuntu.com/apps/qml/ for further examples.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.