Testing QtQuick on Raspberry Pi

12/12/2017 - 17:07
Average: 3 (1 vote)

So now you have a shiny new Qt build on your Raspberry Pi. Now what ? Testing!

This tutorial presents a very simple, sort-of a Hello World QtQuick applications.

Start your favorite editor (nano, vi, emacs, editor-of-choice) and paste the following code into it and then save it as main.qml

A simple QtQuick example

import QtQuick 2.8
import QtQuick.Window 2.2
import QtQuick.Controls 2.0

ApplicationWindow {
    visible: true
    width: 1920
    height: 1080
    visibility: Window.FullScreen
    title: qsTr("Hello World")

    Page {
        anchors.fill: parent
        focus: true
        Rectangle {
            color: "#e8e8e8"
            anchors.centerIn: parent
            width: 800
            height: 600
            Image {
                id: debianLogo
                fillMode: Image.PreserveAspectFit
                anchors.centerIn: parent
                source: "/usr/share/pixmaps/debian-logo.png"
            Label {
                anchors.top: debianLogo.bottom
                text: "Hello World From QtQuick!"
        Keys.onReleased: {
            if (event.key === Qt.Key_Escape) {

Run the example QtQuick application

As this example  is pure QtQuick, no C++, we can run it with qmlscene. Run the following command, adjust the path for your Qt installation prefix:

<path-to-qt-5.x>/bin/qmlscene main.qml

You should now see grey box in the middle of the screen with the Debian logo in the center. Press ESC to exit the test application.

Qt, QtQuick, Raspberry Pi