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

Unexpected console messages for selection changes in QTreeView

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.10.0, 5.12.2
    • Fix Version/s: None
    • Labels:
      None
    • Platform/s:
      Windows

      Description

      Console messages like the following appear on selection changes of a QTreeView:

      qt.accessibility.core: Cannot create accessible child interface for object: QTreeView(0x1c7b87e5a90, name = "treeView") index: 5
      qt.accessibility.core: Cannot create accessible child interface for object: QTreeView(0x1c7b87e5a90, name = "treeView") index: 5
      qt.accessibility.core: Cannot create accessible child interface for object: QTreeView(0x1c7b87e5a90, name = "treeView") index: 5
      qt.accessibility.core: Cannot create accessible child interface for object: QTreeView(0x1c7b87e5a90, name = "treeView") index: 5
      qt.accessibility.core: Cannot create accessible child interface for object: QTreeView(0x1c7b87e5a90, name = "treeView") index: 5
      qt.accessibility.core: Cannot create accessible child interface for object: QTreeView(0x1c7b87e5a90, name = "treeView") index: 6
      qt.accessibility.core: Cannot create accessible child interface for object: QTreeView(0x1c7b87e5a90, name = "treeView") index: 6
      qt.accessibility.core: Cannot create accessible child interface for object: QTreeView(0x1c7b87e5a90, name = "treeView") index: 6
      qt.accessibility.core: Cannot create accessible child interface for object: QTreeView(0x1c7b87e5a90, name = "treeView") index: 6
      qt.accessibility.core: Cannot create accessible child interface for object: QTreeView(0x1c7b87e5a90, name = "treeView") index: 6
      qt.accessibility.core: Cannot create accessible child interface for object: QTreeView(0x1c7b87e5a90, name = "treeView") index: 5
      qt.accessibility.core: Cannot create accessible child interface for object: QTreeView(0x1c7b87e5a90, name = "treeView") index: 5
      

      The effect only appears when the QTreeView resides in a QGroupBox that comes disabled from the designer. 

      Here some code to reproduce:

      QTreeViewTest.ui:

      <?xml version="1.0" encoding="UTF-8"?>
      <ui version="4.0">
       <class&gt;QTreeViewTestClass</class&gt;
       <widget class="QMainWindow" name="QTreeViewTestClass">
        <property name="geometry">
         <rect>
          <x>0</x>
          <y>0</y>
          <width>885</width>
          <height>645</height>
         </rect>
        </property>
        <property name="windowTitle">
         <string>QTreeViewTest</string>
        </property>
        <widget class="QWidget" name="centralWidget">
         <layout class="QVBoxLayout" name="verticalLayout">
          <item>
           <widget class="QGroupBox" name="groupBox">
            <property name="enabled">
             <bool>false</bool>
            </property>
            <property name="title">
             <string>GroupBox</string>
            </property>
            <layout class="QVBoxLayout" name="verticalLayout_2">
             <item>
              <widget class="QTreeView" name="treeView">
               <attribute name="headerVisible">
                <bool>false</bool>
               </attribute>
              </widget>
             </item>
            </layout>
           </widget>
          </item>
         </layout>
        </widget>
       </widget>
       <layoutdefault spacing="6" margin="11"/>
       <resources>
        <include location="QTreeViewTest.qrc"/>
       </resources>
       <connections/>
      </ui>
      

      QTreeViewTest.h:

      #pragma once
      
      #include <QtWidgets/QMainWindow>
      #include "ui_QTreeViewTest.h"
      
      class QTreeViewTest : public QMainWindow
      {
          Q_OBJECT
      
      public:
          QTreeViewTest(QWidget *parent = Q_NULLPTR);
      
      protected slots:
          void fillTreeView();
      
      private:
          Ui::QTreeViewTestClass ui;
      
      };
      

      QTreeViewTest.cpp:

      #include "QTreeViewTest.h"
      
      #include <QStandardItemModel>
      #include <QTimer>
      
      QTreeViewTest::QTreeViewTest(QWidget *parent)
          : QMainWindow(parent)
      {
          ui.setupUi(this);
      
          //ui.groupBox->setEnabled(false);
      
          QTimer::singleShot(1000, this, &QTreeViewTest::fillTreeView);
      }
      
      void QTreeViewTest::fillTreeView()
      {
          //ui.groupBox->setEnabled(false);
      
          QStandardItemModel *model = new QStandardItemModel();
      
          QStandardItem *parentItem = model->invisibleRootItem();
      
          parentItem->appendRow(new QStandardItem("row1"));
          parentItem->appendRow(new QStandardItem("row2"));
          parentItem->appendRow(new QStandardItem("row3"));
      
          parentItem->child(0)->appendRow(new QStandardItem("subrow11"));
          parentItem->child(1)->appendRow(new QStandardItem("subrow21"));
          parentItem->child(2)->appendRow(new QStandardItem("subrow31"));
      
          ui.treeView->setModel(model);
      
          ui.groupBox->setEnabled(true);
      }
      

       

      The QTreeView is embedded in a QGroupBox. The appearance of the effect depends on the enabled state (i.e. void setEnabled(bool)) of the QGroupBox.

      The following cases list scenarios about appearance of the debug output in dependence of the enabled state of the QGroupBox:
      QGroupBox disabled in Designer: YES
      QGroupBox disabled in constructor of QTreeViewTest: NO
      QGroupBox disabled as first statement in fillTreeView(): NO

      For completeness, the following cases list scenarios about appearance of the debug output in dependence of the enabled state of the QTreeView itself:
      QTreeView disabled in Designer and enabled at the end of fillTreeView(): NO
      QTreeView disabled in constructor of QTreeViewTest and enabled as last statement in fillTreeView(): NO
      QTreeView disabled as first statement in fillTreeView() and enabled as last statement in fillTreeView(): NO

       

      Workaround: QGroupBox is disabled in the constructor of the parent object instead of the designer file.

       

      Tested so far with Qt 5.10.0 and 5.12.2 (debug builds).

        Attachments

          Issue Links

          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:
              rprueckl Robert Prueckl
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes