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

QTreeWidget: item expanded state not preserved if set before inserting

    XMLWordPrintable

Details

    Description

      Reproducable with this code exemple.

      #include <QtGui>

      int main(int argc, char** argv)
      {
      QApplication a(argc, argv);
      QTreeWidget * tw = new QTreeWidget();

      QTreeWidgetItem * root = new QTreeWidgetItem();
      root->setText(0,"ROOT");
      root->setExpanded( true );

      for(int i=0;i<10;i++)

      { QTreeWidgetItem *l1 = new QTreeWidgetItem( root ); l1->setText(0,QString("level 1 %1").arg(i)); l1->setExpanded( true ); QTreeWidgetItem *l2 = new QTreeWidgetItem( l1 ); l2->setText(0,QString("level 2 %1").arg(i)); l2->setExpanded( true ); QTreeWidgetItem *l3 = new QTreeWidgetItem( l2 ); l3->setText(0,QString("level 3 %1").arg(i)); }

      tw->addTopLevelItem( root );
      tw->show();
      return a.exec();
      }

      The expended state is also lost if you remove and then reinsert an item from the tree widget.

      Attachments

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

        Activity

          People

            monsen Marius Bugge Monsen
            goffart Olivier Goffart (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes