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

TableView does not select cell when cell tapped

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P1: Critical
    • None
    • 6.5
    • None
    • Qml Runtime 6.5.1
      Linux 6.3.9-arch1-1

    Description

      In the QTableView from QtWidgets, clicking on a cell in a table sets the current index to that cell and selects it (see attached widgets.py). However, in the TableView from QtQuick.Controls, clicking on a cell only sets the current index, the selection is cleared (see attached controls.qml).

      This is stated in the documentation, but it means that the example from https://doc.qt.io/qt-6/qml-qtquick-tableview.html#selecting-items doesn't seem to work, since tapping on a cell causes no visible change, the only way to get a selection is to use Shift+arrow keys.

      To fix this, either:

      • Clicking on a cell should set the selection to contain only that cell, this may require a new option for backwards compatibility reasons
      • Or the documentation should be clearer, and show how to get around this (e.g. onCurrentChanged: (curr, prev) => select(curr, ItemSelectionModel.Select))

      Attachments

        1. controls.qml
          0.7 kB
        2. widgets.py
          0.3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            santhoshkumar Santhosh Kumar Selvaraj
            matsjoyce Matthew Joyce
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes