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

"Phantom" header row remains after resetting QTableView.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.0.0
    • 4.7.4
    • Widgets: Itemviews
    • None
    • Windows XP, Windows7, Linux Ubuntu 10.04
    • 5.0: aa2578a1006f17cff50ca39090bae2e1e090b59b, 4.8: 5ec6e2aca2950634d39195cc858bf062a2e2618d

    Description

      When the model backing a QTableView resets and in the process loses all row/columns, an unsightly grey stripe sometimes remains where the vanished headers were. Initially the view does not show this, and sometimes odd things (like changing tabs) will heal it.

      The bug appears to be that the call stack QHeaderView::reset()>initializeSections()>clear() (the case when columnCount() is 0) does not invalidate the cached size hint. Thus, a horizontal header view with d->sectionCount=0 (which does not paint any headers) continues to take up however much height it did before being reset, until something unrelated invalidates the cached size hint, at which point it recomputes to 0 and disappears properly.

      See attached repro app for an isolated testcase: the view begins empty, when you hit fill a column appears, when you hit empty it disappers but continues the horizontal header continues to take up space, if you flip between the tabs the spurious header will go away (but comes back if you hit fill and empty again).

      Possible fix could be as simple as adding invalidateCachedSizeHint() to QHeaderViewPrivate::clear().

      Attachments

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

        Activity

          People

            liaqi Liang Qi
            qtcomsupport Qt Support
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes