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

QListView CSS incorrectly highlights multiple items



    • Bug
    • Resolution: Cannot Reproduce
    • P2: Important
    • None
    • 5.6.0
    • Widgets: Itemviews
    • None
    • Windows 7 Professional 64-bit


      Issue appeared when I upgraded from Qt 5.4 to 5.6. Using Qt Creator 3.6.1 and MinGW 4.9.2. Behavior observed in Windows 7 Professional 64-bit.

      I have a QListView on my main window form styled with CSS using "QListView:item:selected" and "QListView:item:selected:active" that changes the background color of the currently-selected item.

      However in 5.6 the background color of both the selected item and the next item in QListView get highlighted, even though only the first one is selected. In fact the selectionMode of my QListView is set to SingleSelection so by definition only one item can be selected at a time and therefore it makes no sense for two to be highlighted.

      My QListView is arranged with items from top to bottom so the effect is that whatever item I click on, it highlights that one and the one below it. Of course if I click on the bottom item, there is nothing after it, so it only highlights that last item.

      If i hold my left mouse button down when I click the list view, and then move the mouse cursor slightly over the selected item while still holding down the left mouse button, I can get the incorrectly highlighted next item to correct itself (it will still be highlighted initially, but after moving the mouse with the button depressed, it will un-highlight). But with the much more natural brief mouse click, both items are always highlighted.

      My other CSS for this QListView works correctly - not selected, hover, etc.

      In the screenshot shown below, I have clicked on the "Functions" item, but you can see that both it and the following "Driving" item are highlighted.


        1. OPCTest.zip
          9 kB
        2. MultiHighlight.png
          68 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            mmutz Marc Mutz
            lukez lukez
            0 Vote for this issue
            4 Start watching this issue



              Gerrit Reviews

                There are no open Gerrit changes