Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-52558

Behavioral incompatibility between QQuick* checkables and QWidget/Quick.Controls checkables

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.7.0 RC
    • 5.7.0 Alpha
    • Quick: Controls 2
    • None
    • ff9d924d98aac8248ce99aef992920aeb99fda7e

    Description

      It is impossible to use the QQuickAbstractButton's `clicked` signal and `checked` property in a similar way we did for years with QAbstractButton and/or Quick.Controls Button (same for other checkables).

      some parts of a whole issue:

      • when the slot connected to the CheckBox' clicked() signal explicitly sets its checked state (i.e. in tristate case), the checkedChanged() signal could be emitted more than once per click, due to nextCheckState() call
      • in some cases Switch doesn't emit `clicked` and thus it is not always possible to distinguish "toggle due to the user action" and "toggle due to the 'checked' property binding re-evaluation"; it seems like `clicked` means the mouse click here, not the button click.

      (see QAbstractButton::clicked() documentation for more differences)

      The following code could be used to see this issue in action:

      QtObject {
          id: action
          property bool checked: false
          function toggle() { checked = !checked; }
      }
      Button {
          text: "First"
          highlighted: checked
          checked: action.checked
          onClicked: action.toggle()
      }
      CheckBox {
          id: button
          text: "Second"
          checked: action.checked
          onClicked: action.toggle()
      }
      Switch {
          text: "Third"
          checked: action.checked
          onClicked: action.toggle()
      }
      

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-52558
          # Subject Branch Project Status CR V

          Activity

            People

              Unassigned Unassigned
              ritt.ks Konstantin Ritt
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes