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

QTreeView viewportSizeHint is wrong when called before showing the widget

XMLWordPrintable

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

      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

        For Gerrit Dashboard: QTBUG-69120
        # Subject Branch Project Status CR V

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes