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

QColumnView selection bug

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.12.3
    • Active Qt
    • None
    • Windows 10, Qt 5.12.3, Microsoft Visual Studio Community 2022
    • Windows

    Description

      QColumnView selection is not working properly when trying to select an index using the QItemSelectionModel::setCurrentIndex(), QItemSelectionModel::select() or any other method used for selection.

      I have implemented a Qt application which shows a hierarchy. I use QColumnview and I set a custom model to it to build the hierarchy. When I do the selection manually (click on an item in qcolumnview) it works fine.

      The issue: I have my own method in which I look for the index in the model and then try to select it in the QColumnView using the above setCurrentIndex() or select() methods. In some cases the parent levels are not selected in columnView. 

      In the attached screenshot I used the following line:

      columnView->selectionModel()->setCurrentIndex(userIndex, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);

      to select the "User" index in the QColumnView and the first level is not selected. 

      I checked the selected indexes using the method:

      columnView->selectionModel()->selectedIndexes()

      and it gives the correct number of selected indexes. So the problem might be  that the index is selected but is not highlighted.

      Attachments

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

        Activity

          People

            owolff Oliver Wolff
            mihaip Mihai Preda
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes