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

QTreeView: height of items in column that is hidden from view is not taken into account when using column sort on a column that is shown.

    XMLWordPrintable

Details

    Description

      The following code reproduces the problem by drawing a tree view that has 32x32 icons in its first column. If a column sort is done while column 0 is showing, the items are sorted. If the horizontal scroller is used to hide column 0, and a column sort is then done, the items are sorted but column 0 items are truncated to the same height as the smaller items in other columns.

       #include <QtGui> 
       int main(int argc, char *argv[]) 
       { 
       QApplication app(argc, argv); 
       
       // Create a 32x32 icon 
       QPixmap pixmap(32,32); 
       QPen pen(Qt::green, 1, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin); 
       QPainter painter(&pixmap); 
       painter.fillRect(QRectF(0,0,32,32), Qt::white); 
       painter.setPen(pen); 
       painter.drawRect(QRect(1,1, 30, 30)); 
       
       
       QTreeWidget tree; 
       tree.setColumnCount(10); 
       tree.setSortingEnabled(true); 
       
      for (int row=0; row<10; ++row) 
       { 
       QStringList list; 
       for (int col=0; col<10; ++col) 
       list << QString("R%1 C%2").arg(row).arg(col); 
       QTreeWidgetItem *item = new QTreeWidgetItem(&tree, list); 
       item->setData(0, Qt::DecorationRole, pixmap); 
       tree.addTopLevelItem(item); 
       } 
       
       tree.show(); 
       
       return app.exec(); 
       } 
      

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            cattell Matthew Cattell (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes