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

autorepeat stops in SpinBox stops when mouse or touch moved

    XMLWordPrintable

Details

    • b1909ca4d1d80c36601eb942459db3ff60174c8e

    Description

      How to reproduce it:

      import QtQuick 2.7
      import QtQuick.Controls 2.0
      import QtQuick.Layouts 1.0
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
      
      
          ColumnLayout {
              anchors.fill: parent
              Button {
                  text: "Push me"
                  Layout.alignment: Qt.AlignHCenter
      
                  ToolTip.visible: pressed
                  ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
                  ToolTip.text: qsTr("This is a tool tip.")
              }
              SpinBox {
                  from: 1
                  to: 10
                  Layout.alignment: Qt.AlignHCenter
              }
          }
      }
      

      Press with mouse or touch the SpinBox to increase the number and move a bit the mouse or the touch.
      Result: it stops increasing.
      Expected result: it keeps increasing

      It seems that the autorepeat timer is being stopped anytime the mouse moves in
      QQuickSpinBoxPrivate::handleMouseMoveEvent() via stopPressRepeat().

      I wonder if a guard condition could be placed around this call to only call
      stopPressRepeat() if an indicator was not already being held down. For
      example:

      bool QQuickSpinBoxPrivate::handleMouseMoveEvent(QQuickItem *child, QMouseEvent
      *event)
      {
      Q_Q(QQuickSpinBox);
      QQuickItem *ui = up->indicator();
      QQuickItem *di = down->indicator();
      
      const bool wasPressed = up->isPressed() || down->isPressed();
      
      up->setPressed(ui && ui->isEnabled() &&
      ui->contains(ui->mapFromItem(child, event->pos())));
      down->setPressed(di && di->isEnabled() &&
      di->contains(di->mapFromItem(child, event->pos())));
      
      bool pressed = up->isPressed() || down->isPressed();
      q->setAccessibleProperty("pressed", pressed);
      
      // Don't kill autorepeat timer if mouse is moving while indicator is
      pressed
      if (!wasPressed)
      stopPressRepeat();
      return pressed;
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            karimpinter Karim Pinter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes