cordial/qml/main.qml

57 lines
1.3 KiB
QML
Raw Normal View History

2023-03-17 08:41:24 +00:00
// SPDX-FileCopyrightText: 2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
// SPDX-FileContributor: Andrew Hayzen <andrew.hayzen@kdab.com>
// SPDX-FileContributor: Gerhard de Clercq <gerhard.declercq@kdab.com>
//
// SPDX-License-Identifier: MIT OR Apache-2.0
// ANCHOR: book_main_qml
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Window 2.12
// ANCHOR: book_qml_import
// This must match the qml_uri and qml_version
// specified with the #[cxx_qt::qobject] macro in Rust.
import com.kdab.cxx_qt.demo 1.0
// ANCHOR_END: book_qml_import
Window {
height: 480
title: qsTr("Hello World")
visible: true
width: 640
MyObject {
id: myObject
number: 1
string: "My String with my number: " + myObject.number
}
Column {
anchors.fill: parent
anchors.margins: 10
spacing: 10
Label {
text: "Number: " + myObject.number
}
Label {
text: "String: " + myObject.string
}
Button {
text: "Increment Number"
onClicked: myObject.incrementNumber()
}
Button {
text: "Say Hi!"
onClicked: myObject.sayHi(myObject.string, myObject.number)
}
}
}
// ANCHOR_END: book_main_qml