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

TableView selection issue when clicking in empty space

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • Some future release
    • 5.2.1
    • Quick: Controls 1
    • None
    • * Qt 5.2.1 (QtQuick Controls 1.1)
      * Ubuntu 13.10 64bit

    Description

      The selection in a TableView behaves very strange when the user clicks on an empty space, i.e. on the "dummy rows" which fill up the viewport with alternating row colors.

      Example Code

      (See also attachment)

      tableview-test.qml
      import QtQuick 2.2                          
      import QtQuick.Controls 1.1 
      
      TableView {
          width: 300 
          height: 300 
          focus: true
      
          model: [{text:'foo'}, {text:'bar'}, {text:'baz'}]
      
          // Also try single selection (comment out)
          selectionMode: SelectionMode.ExtendedSelection
      
          TableViewColumn {
              width: 200 
              role: 'text'
              title: 'Text'
          }   
      }
      

      User input

      The following two scenarios result in the same behavior.

      • Select the last row. Then click on the empty space multiple times. For some clicks, nothing happens (selection stays the same), but for some, the issue is visible (see below).
      • Select any (non-empty) row but keep the mouse button pressed; drag downwards. As soon as the mouse enters the empty space, the issue is visible (see below).

      Issue / Actual Behavior

      • In single selection mode, the first row will be selected.
      • In extended selection mode, the selection will be extended to the first row, i.e. when the last row was previously selected, now everything is selected.

      Expected Behavior

      (In my opinion)

      • In single selection mode, nothing should change
      • In extended selection mode, the selection should be cleared.

      Suspicion / Possible Reason

      The TableView acts as if the "dummy rows" were the first row. Therefore it might be the case that they report to the selection logic that row 0 was clicked if you click on them; that should be suppressed. What's strange is that not every click shows the issue.

      Note that keyboard interaction doesn't show the same issue, yet it is also not perfect. In single selection mode, everything is fine. But in extended selection mode, if the user selects the first row and extends the selection with shift+down key, after navigating below the last row, the selection is cleared.

      Possibly related: https://bugreports.qt-project.org/browse/QTBUG-38271

      Attachments

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

        Activity

          People

            bachewii Jens
            leemes Sebastian Lehmann
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes