3

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?

1 Answer 1

3

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .