onCheckedChanged vs onCheckStateChanged
Solved
General and Desktop
-
What is the difference between
onCheckedChanged
andonCheckStateChanged
? Both yield the same result when I check/uncheck the box.import QtQuick 2.12 import QtQuick.Controls 2.4 import QtQuick.Layouts 1.3 Page { id : somepageid CheckBox { checked: true text: qsTr("Check Me") indicator.width: 15 indicator.height: 15 onCheckedChanged: { console.log(checked) } onCheckStateChanged: { console.log(checked) } } }
-
@chilarai said in onCheckedChanged vs onCheckStateChanged:
What is the difference between onCheckedChanged and onCheckStateChanged? Both yield the same result when I check/uncheck the box.
As written in documentation:
checked
is a boolean (https://doc.qt.io/qt-5/qml-qtquick-controls2-abstractbutton.html#checked-prop)checkState
is an enumeration valueQt.Unchecked
,Qt.PartiallyChecked
orQt.Checked
(https://doc.qt.io/qt-5/qml-qtquick-controls2-checkbox.html#checkState-prop)