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

QHeaderView Private Implementation Indefinately Growing Vector

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.9.4
    • 5.2.1, 5.3.1
    • Widgets: Itemviews
    • None
    • Windows, Linux
    • 93dabeba9dc5f6cbab60e65b3cc8df5fe48745a9

    Description

      Hi,

      If you have a QTreeView with a model that is sorted dynamically and there are hidden columns, qheaderviewprivate's persistentHiddenSections grows indefinitely. Each time the model updates its sort, it will grow by the number of hidden columns. Qt grows this vector in _q_layoutAboutToBeChanged and should clear in _q_layoutChanged, but the clear does not seem to happen (as if _q_layoutChanged is not called).

      Attached is a minimal example. To see the bug, click on any column header to change the sort order (i.e. force a sort) and the console will output the size of persistentHiddenSections before and after _q_layoutAboutToBeChanged as well as after _q_layoutChanged should be called. Every click in this example increases persistentHiddenSections size by 10, the number of hidden columns. To get access to persistentHiddenSections, I had to include the private implementation (i.e. #include "private/qheaderview_p.h"). I have attached Qt's 5.2.1's source code for private/qheaderview_p.h as well as other dependent headers so this will build (place all _p.h files in a folder call private).

      Thanks,
      Marc

      Attachments

        1. HiddenColumnsBug.pro
          0.5 kB
        2. main.cpp
          0.2 kB
        3. MainWindow.cpp
          1 kB
        4. MainWindow.h
          0.3 kB
        5. MainWindow.ui
          0.6 kB
        6. MyHeaderView.cpp
          1 kB
        7. MyHeaderView.h
          0.5 kB
        8. MyTestTree.cpp
          1 kB
        9. MyTestTree.h
          0.8 kB
        10. qabstractitemmodel_p.h
          7 kB
        11. qabstractitemview_p.h
          17 kB
        12. qabstractscrollarea_p.h
          5 kB
        13. qframe_p.h
          3 kB
        14. qgesture_p.h
          5 kB
        15. qgraphicseffect_p.h
          7 kB
        16. qheaderview_p.h
          13 kB
        17. qobject_p.h
          18 kB
        18. qpixmapfilter_p.h
          6 kB
        19. qwidget_p.h
          31 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            chehrlic Christian Ehrlicher
            mudoff Marc
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes