Menu

QML-101

big-bass
Attachments
DEMOS-QML.tar.gz (3119 bytes)

QML-101 with Bacon

The first part of the tutorial I will use
https://zetcode.com/gui/qtquick/
and credit the author for his excellent work
and a link is provided to his site the qml code is unchanged
the main.cpp was modified for bacon

all of those examples to run with bacon!
and are included in one download

you just compile qml1.bac to qml6.bac
and run them as bacon files
it will work for RPI3 and RPI4 and Manajaro and x86_64
with a small uncommenting of the PRAGMA lines

QML is the simple way to code using Qt
and it is a simple readable syntax

one real example

ApplicationWindow {

    width: 300
    height: 200
    title: "Quit button"

    Button {
        x: 20
        y: 20
        text: "Quit"
        onClicked: Qt.quit()
    }
}

the size of the main window is width 300 ,height 200
Button is placed at x 20 and y 20
the callback is QUIT when you click on it
the coding approach is all code is DATA
following a plain text file json styled syntax that will get parsed
like a scripting language using (.qml as the file type)

if you used gtk glade which is xml DATA
we are using a simpler syntax json that is also
automatically generated if you use qtcreator with QML


dependencies for a debian based system

sudo apt-get install qtbase5-dev \
qtdeclarative5-dev \
qtdeclarative5-dev-tools \
qml-module-qtqml-models2 \
qml-module-qtquick-controls \
qmlscene \
qml-module-qtquick-shapes