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

QTableView selectRow didn't work when column 0 is hidden and horizontal header moved.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 5.6.0
    • Widgets: Itemviews
    • None
    • Windows 7/10

    Description

      If a QTableView has column 0 hidden and horizontal header moved, then selectRow function can't select entire row.

      Actually, in the QTableView.cpp line 3252:

      QTableView.cpp
      QModelIndex tl = model->index(qMin(rowSectionAnchor, row), logicalColumn(0), root);
      QModelIndex br = model->index(qMax(rowSectionAnchor, row), logicalColumn(model->columnCount(root) - 1), root);
      if ((verticalHeader->sectionsMoved() && tl.row() != br.row())
                 || horizontalHeader->sectionsMoved()) {
          q->setSelection(q->visualRect(tl)|q->visualRect(br), command);
      }
      

      The tl and br are not considered the hidden column. So that if the column 0 is hidden, the visualRect will return empty QRect(). Then the the entire row will not selected.

      Attachments

        Issue Links

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

          Activity

            People

              peppe Giuseppe D'Angelo
              zhaoy@motic.com ZhaoYu
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes