Files
qt6-qml-for-beginners/Qt6QMLBeginnersCode/8-QtQuickControls/4-CheckBox/Main.qml
2025-09-28 17:05:51 +08:00

40 lines
813 B
QML

// Copyright (c) Daniel Gakwaya.
// SPDX-License-Identifier: MIT
import QtQuick
import QtQuick.Window
import QtQuick.Controls
Window {
visible: true
width: 640
height: 480
title: qsTr("CheckBox")
Column {
spacing: 20
anchors.horizontalCenter: parent.horizontalCenter
CheckBox {
text: "Option1"
checked: true
onCheckStateChanged: {
if (checked)
{
console.log("Option1 is checked")
}else{
console.log("Option1 is unchecked")
}
}
}
CheckBox {
text: "Option2"
}
CheckBox {
text: "Option3"
checked: false
enabled: false
}
}
}