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

QTreeView viewportSizeHint is wrong when called before showing the widget

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.13.0 Alpha 1
    • 5.6.3
    • Widgets: Itemviews
    • None
    • 3e59a88e8968c6cdac788926bec34c259146b6a8 , 8c18a245b (dev), 0c9787bab (6.6), c26e7f278 (6.5)

    Description

      I noticed that QTreeView::sizeHint() with setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents) was correct when the widget got already shown, but was to small in height when asking sizeHint before show.

      By looking into the source code it is obvious that this is broken, as isVisible() is used to check header visibility which would also be false if the parent (treeview) is no visible ...

      so, that should be either d->header->isVisibleTo(this) ... or !isHeaderHidden(), is Hidden works as it is not implicit bubbling through the children

      ... scrollbars will probably need a similar treatment, but as I was only interested in height, I haven't verified

      ... QTableView::viewportSizeHint seems to have only wrong scrollbars, but headers are done properly

       

      Btw. I reporting that with 5.6 as I still have to use that ... but the implementation is the same in 5.11.1 sourcecode

      Attachments

        Issue Links

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

          Activity

            People

              chehrlic Christian Ehrlicher
              sl.sy.ifm Stefan Langer
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes