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

Dragging HeaderView works even when the mouse event is accepted by a MouseArea inside an (header) cell

    XMLWordPrintable

Details

    • Linux/Wayland
    • 65c306244 (dev), 9ccfe296f (6.8)

    Description

      When implementing the delegate for HorizontalHeaderView and using a MouseArea to fill the delegate for managing the mouse events, sometimes the Drag&Drop of the column will be activated even when the event is accepted by the MouseArea.

       

      Reproduce:

      1. Set the mouse.accepted = false, for example when using the Alt modifier
      2. Try to drag the column and drop it to another place (using Alt modifier).
      3. Set the mouse.accepted = true, for example when the Alt modifier is not pressed.
      4. Try to drag the column and drop it to another place (using no modifiers).

       

      Expected:

      The Drag&Drop for the column should not work as the mouse is accepted

       

      Observed:

      The column is able to be moved to another place.

       

      Snippet:

       

      HorizontalHeaderView {
          syncView: tableView
          movableColumns: true
          delegate: Rectangle {
              Label {
                  anchors.centerIn: parent
                  text: model.columnName
              }
              MouseArea {
                  anchors.fill: parent
                  onPressed: function(event) {
                      if (event.modifiers === Qt.AltModifier) {
                          event.accepted = false
                          return
                      }
                  }
              }
          }
      }

       

       

      Attachments

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

        Activity

          People

            santhoshkumar Santhosh Kumar Selvaraj
            mhqanbari MohammadHossein Qanbari
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes