Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Controls2 CheckBox onClicked overwriting checked value
Qt 6.11 is out! See what's new in the release blog

Controls2 CheckBox onClicked overwriting checked value

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 514 Views 1 Watching
  • 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.
  • E Offline
    E Offline
    EStudley
    wrote on last edited by
    #1

    Hey,

    I have a simple CheckBox on screen, why is the value being overwritten when I click? How can I prevent the value from being hijacked from my binding?

    CheckBox {
        text: "Value Set"
        checked: value !== 0
        onClicked: console.log("Don't do anything!") //value++
    
        property int value: 0
    }
    

    How can I make this not set checked to true?

    1 Reply Last reply
    0
    • jpnurmiJ Offline
      jpnurmiJ Offline
      jpnurmi
      wrote on last edited by
      #2

      See CheckBox::nextCheckState. The property was introduced in QtQuick.Controls 2.4 (Qt 5.11).

      1 Reply Last reply
      1

      • Login

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