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

QTreeWidgetItem: clicking to "collapse" an item can "check" parent item

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.12.3, 5.14.0 Alpha
    • 4.8.7, 5.12.0
    • Widgets: Itemviews
    • 7e60858cbc40b8958482ca2e77bed4fda69b161c (qt/qtbase/5.12)

    Description

      Hi,

      I can craft a QTreeWidget containg a set of QTreeWidgetItem where a click to "collapse" one item triggers the "checking" an unrelated item.

      This happens when a too-long tree of items is scrolled to the very bottom. When collapsing an item by clicking the appropriate box, the list autoscrolls and thus changes the item currently under the mouse-cursor. If if the item appearing under the cursor happens to be a "checkable" parent item, the mouse button release of the click to "collapse" will now toggle the "checked" status of the completely unrelated QTreeWidgetItem.

      See the attached "minimal_example.cpp" file. The screenshots depict the situation before and after collapsing the "rootItem3->scndLevel1" item. Note that the previously unchecked "rootItem3" is checked afterwards although only a single click was performed.

      I would have expected that the QTreeWidget behaves differently, although I do not know how a good solution would look like. I assume this will not be fixed for Qt4 ;-(

      Is the same behavior observed in Qt5?

      Greetings

      Attachments

        1. after_collapsing.png
          after_collapsing.png
          7 kB
        2. before_collapsing.png
          before_collapsing.png
          6 kB
        3. minimalExample.cpp
          1 kB
        For Gerrit Dashboard: QTBUG-61476
        # Subject Branch Project Status CR V

        Activity

          People

            sletta Gunnar Sletta
            marvin2k marvin2k
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes