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

Mouse input from QWindow with Qt::WindowTransparentForInput set is forwarded with wrong coords when embedded in a widget.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.10.1, 5.11.0, 5.11.1, 5.13.1
    • None
    • windows 10, Visual Studio 2017

    Description

      I have a QWindow with Qt::WindowTransparentForInput flag set. When I embed it in a widget with QWidget::createWindowContainer and hover mouse over the window the hosting widget gets mouse input in embedded window's coordinates.

      This is a regression found when migrating from Qt 5.6.2, where it worked correctly.

      Example code:

       

      int main(int argc, char *argv[])
      {
         QApplication a(argc, argv);
         QWidget w;
         w.setFixedSize(300, 50);
         auto menubar = new QMenuBar;
         menubar->addAction("Foo");
         menubar->addAction("Bar");
         menubar->addAction("Bazz");
         auto win = new QWindow();
         win->setFlag(Qt::WindowTransparentForInput);
         auto container = QWidget::createWindowContainer(win);
         w.setLayout(new QVBoxLayout);
         w.layout()->setMenuBar(menubar);
         w.layout()->setContentsMargins(0,0,0,0);
         w.layout()->addWidget(container);
         w.show();
         return a.exec();
      }
      

      Result:

       

      Attachments

        1. error.gif
          error.gif
          33 kB
        2. qtbug-68221.patch
          4 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            chrisaverage Krzysztof Kawa
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes