Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. onCheckedChanged vs onCheckStateChanged
Forum Update on Monday, May 27th 2025

onCheckedChanged vs onCheckStateChanged

Scheduled Pinned Locked Moved Solved General and Desktop
checkbox
3 Posts 2 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    chilarai
    wrote on 31 Jul 2020, 06:41 last edited by
    #1

    What is the difference between onCheckedChanged and onCheckStateChanged? 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)
            }
    
        }
    }
    
    K 1 Reply Last reply 31 Jul 2020, 06:47
    1
    • C chilarai
      31 Jul 2020, 06:41

      What is the difference between onCheckedChanged and onCheckStateChanged? 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)
              }
      
          }
      }
      
      K Offline
      K Offline
      KroMignon
      wrote on 31 Jul 2020, 06:47 last edited by KroMignon
      #2

      @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 value Qt.Unchecked, Qt.PartiallyChecked or Qt.Checked (https://doc.qt.io/qt-5/qml-qtquick-controls2-checkbox.html#checkState-prop)

      It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

      C 1 Reply Last reply 31 Jul 2020, 07:10
      2
      • K KroMignon
        31 Jul 2020, 06:47

        @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 value Qt.Unchecked, Qt.PartiallyChecked or Qt.Checked (https://doc.qt.io/qt-5/qml-qtquick-controls2-checkbox.html#checkState-prop)
        C Offline
        C Offline
        chilarai
        wrote on 31 Jul 2020, 07:10 last edited by
        #3

        @KroMignon Thanks

        1 Reply Last reply
        0

        2/3

        31 Jul 2020, 06:47

        • Login

        • Login or register to search.
        2 out of 3
        • First post
          2/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved