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 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)
            }
    
        }
    }
    
    KroMignonK 1 Reply Last reply
    1
    • C chilarai

      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)
              }
      
          }
      }
      
      KroMignonK Offline
      KroMignonK Offline
      KroMignon
      wrote on 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
      2
      • KroMignonK KroMignon

        @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 last edited by
        #3

        @KroMignon Thanks

        1 Reply Last reply
        0

        • Login

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