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

On Linux when sorting is enabled, the QHeaderViews cell size is calculated incorrectly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Out of scope
    • Icon: Not Evaluated Not Evaluated
    • None
    • 4.8.2
    • Widgets: Itemviews
    • None
    • Ubuntu 10.04 32-bit

      The example below can be used to reproduce the issue:

      void
      createTreeWidget(bool showBug)
      {
        QTreeWidget *tw = new QTreeWidget();
      
        QTreeWidgetItem *hdr = new QTreeWidgetItem();
        hdr->setText(0,QLatin1String("Column-1"));
        hdr->setText(1,QLatin1String("Column-2"));
      
        tw->setHeaderItem(hdr);
        tw->setRootIsDecorated(false);
      
        if (!showBug)
        {
            tw->setSortingEnabled(true);
        }
      
        tw->header()->resizeSections(QHeaderView::ResizeToContents);
      
        if (showBug)
        {
            tw->setSortingEnabled(true);
        }
      
        tw->show();
      }
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
          createTreeWidget(true);
          createTreeWidget(false);
      
          return app.exec();
      }
      

      If tw->header()->resizeSections(QHeaderView::ResizeToContents); is called before the sorting is enabled, the sorting arrow is drawn over the header text

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

            stephen.kelly Stephen Kelly (Unused account) (Inactive)
            qtcomsupport Qt Support
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes