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

Narrator stops working on UI when adding a native widget

    XMLWordPrintable

Details

    • Windows
    • 5f3f23462e7990800b7d93daecd4ab8e895ef036 (qt/qtbase/dev) 89ec3ed8e545b9bfa6a82e5bb200598d18a1e167 (qt/qtbase/5.15)

    Description

      See following code:

       

      #include <QApplication>
      #include <QWidget>
      #include <QLabel>
      #include <QVBoxLayout>
      
      class QNativeWidget : public QWidget
      {
      public:
          QNativeWidget()
          {
              winId();
              QVBoxLayout* l = new QVBoxLayout(this);
              l->addWidget(new QLabel("native"));
          }
      };
      
      class QTestView : public QWidget
      {
      public:
          QTestView()
          {
              QVBoxLayout* l = new QVBoxLayout(this);
              l->addWidget(new QPushButton("Some Button"));
              auto *b = new QPushButton("Press to add native widget");
              l->addWidget(b);        
              QObject::connect(b, &QPushButton::clicked, [l]()
                  {
                      auto* nativeWidget = new QNativeWidget();
                      l->addWidget(nativeWidget);
                  });
          }
      };
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          QTestView w;    
          w.show();
          return a.exec();
      }
      

      When running Windows Narrator on the application, it works fine until I press the button and add a native widget to the layout. After that, the narrator won't be able to access any widget anymore.

       

      If you comment out the "winId()" call, Narrator keeps working fine.

      I've tried isolating the native widget by wrapping it in a widget with setAttribute(Qt::WA_DontCreateNativeAncestors); and that seems to fix the problem, but there are deeper bugs associated with that flag (for example the native widget is not always resized correctly when maximising the window).

       

      Attachments

        For Gerrit Dashboard: QTBUG-81862
        # Subject Branch Project Status CR V

        Activity

          People

            anrocha André De La Rocha (Inactive)
            bizcot Marco Francescangeli
            Votes:
            4 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes