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

QTreeView::collapseAll and QTreeView::expandAll do not emit the collapsed and expanded signals

    XMLWordPrintable

Details

    • 80fa4b6c8ef4d4b51c6a8c114aed2f7b1bc4db45 3260aec38ebfdd9f5bc0ce8e5b8e239f30a59c1b 08a632ac1ac48eebdb60d9b87b221e7dbd3c22c4 6a5c6b3ce60f8714824f3ce0224885cb694c1aa4

    Description

      qt/src/gui/itemviews/qtreeview.cpp looks like;

      void QTreeView::expandAll()
      {
          Q_D(QTreeView);
          d->viewItems.clear();
          d->expandedIndexes.clear();
          d->interruptDelayedItemsLayout();
          d->layout(-1);
          for (int i = 0; i < d->viewItems.count(); ++i) {
              if (d->viewItems[i].expanded)
                  continue;
              d->viewItems[i].expanded = true;
              d->layout(i);
              QModelIndex idx = d->viewItems.at(i).index;
              d->expandedIndexes.insert(idx);
          }
          updateGeometries();
          d->viewport->update();
      }
      

      what is missing is a

          d->expandedIndexes.insert(idx);
      + emit expanded(idx);
      

      the same is true for the QTreeView::collapseAll() method which does miss a "emit collapsed(idx);" too.

      This is important cause it's the only way to be informed if the collapsed/expanded state of an item changes and to react to that change.

      Attachments

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

        Activity

          People

            tmartsum Thorbjørn Lund Martsum
            sebsauer Sebastian Sauer
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes