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

QListView paints item selection wrong

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • 5.12.1, 5.14.0 Alpha
    • 5.11.3, 5.12.0
    • Widgets: Itemviews
    • None
    • Windows 7
      Qt Creator 4.8.0 + MSVC2017
    • Windows
    • 406d1dcfd744c2fca87e1d151a467bbcd914380b (qt/qtbase/5.12.1)

      I updated a project from Qt 5.6 to Qt 5.12 and I noticed that the selection in QListView was being painted incomplete - on the first item the left margin was looking ok, but not the right margin. On the following items neither margin looked good, and on the last item only the right margin was painted correctly.

      After a quick look in the changes of the qlistview.cpp file, I have found the following commit which seems to explain the behavior I have been seeing: https://github.com/qt/qtbase/commit/1aa3edf3f888f394040d32d4a211257f9e9e2791.(QStyleOptionViewItem::viewItemPosition)

      The problem can be reproduced with the latest Qt Creator 4.8.0 where QListViews are being used. I attached three screenshots from the Options dialog where you can see the issue.

        1. qlistview-botom.png
          qlistview-botom.png
          16 kB
        2. qlistview-middle.png
          qlistview-middle.png
          16 kB
        3. qlistview-top.png
          qlistview-top.png
          16 kB
        4. Screenshot_1.png
          Screenshot_1.png
          2 kB
        5. Screenshot_2.png
          Screenshot_2.png
          4 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            reluscorp Aurelian
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes