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

QTreeview::updateGeometries doesn't take into account the min/max height of the header

    XMLWordPrintable

Details

    • 4829edfa4ec4829c25246c46d3fcf236e6e59657

    Description

      In QTreeview::updateGeometries, the min/max height of the header is not taken into account like it is in QTableView.

      QTreeView::updateGeometries
      void QTreeView::updateGeometries() 
      { 
          Q_D(QTreeView); 
          if (d->header) { 
              if (d->geometryRecursionBlock) 
                  return; 
              d->geometryRecursionBlock = true; 
              QSize hint = d->header->isHidden() ? QSize(0, 0) : d->header->sizeHint(); 
              setViewportMargins(0, hint.height(), 0, 0); 
              QRect vg = d->viewport->geometry(); 
              QRect geometryRect(vg.left(), vg.top() - hint.height(), vg.width(), hint.height()); 
              d->header->setGeometry(geometryRect); 
              QMetaObject::invokeMethod(d->header, "updateGeometries"); 
              d->updateScrollBars(); 
              d->geometryRecursionBlock = false; 
          } 
          QAbstractItemView::updateGeometries(); 
      } 
      

      Replace the line

      QSize hint = d->header->isHidden() ? QSize(0, 0) : d->header->sizeHint(); 
      

      by

      int height = 0; 
      if (!d->header->isHidden()) { 
              height = qMax(d->header->minimumHeight(), d->header->sizeHint().height()); 
              height = qMin(height, d->header->maximumHeight()); 
      } 
      

      Attachments

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

        Activity

          People

            peppe Giuseppe D'Angelo
            ninon.lafourcade lafourcade ninon
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes