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

QTreeWidget animated crashes when QTreeWidgetItems are set hidden to true

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4: Low
    • Resolution: Done
    • Affects Version/s: 5.3.1, 5.4.0 Beta
    • Fix Version/s: 5.15.5, 6.0.3, 6.1.0 RC
    • Component/s: Widgets: Itemviews
    • Labels:
      None
    • Environment:
      Windows 8.1, Windows 7
    • Platform/s:
      All
    • Commits:
      f140ef04a0c54c2c8a699db33433b8d7235d137c (qt/qtbase/dev) 3a2fe41c9fa1082e1ef89f8745777950270ed44c (qt/qtbase/6.0) 13cb272a705359beee0b28dccd544485b49c9eff (qt/qtbase/6.1) c6803b0ef71278e68c371158db368d59ab198bc1 (qt/tqtc-qtbase/5.15)

      Description

      We create a QTreeWidget with setAnimation to true, and we add two top level items with 1 children in both of them; we connect the itemExpanded(QTreeWidgetItem*) SIGNAL with a method that hides all top level items except the expanded one : it crashes.

      Example of code :

          QWidget* l_widget = new QWidget();
          QTreeWidget* l_treeWidget = new QTreeWidget(l_widget);
          l_treeWidget->addTopLevelItem(new QTreeWidgetItem(QStringList("item1")));
          l_treeWidget->addTopLevelItem(new QTreeWidgetItem(QStringList("item2")));
          l_treeWidget->topLevelItem(1)->addChild(new QTreeWidgetItem(QStringList("child1")));
      
          l_treeWidget->setAnimated(true);
          QObject::connect(l_treeWidget, &QTreeWidget::itemExpanded, [=](QTreeWidgetItem* p_item) {
              for (int j = 0; j < l_treeWidget->topLevelItemCount(); ++j)
                  if (l_treeWidget->topLevelItem(j) != p_item) 
                      l_treeWidget->topLevelItem(j)->setHidden(true);
          });
      
          l_widget->show();
      

        Attachments

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

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            lionel.charaix lionel charaix
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes