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

QWidget created by createWindowContainer doesn't receive mouse events thru installEventFilter

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.7.1, 5.9.0, 5.9.1
    • None
    • Mac OS X El Capitan

      Qt 5.9.1

      MacBook Pro
    • macOS

    Description

      When I create a QWidget object using createWindowContainer that has qml scene embedded into a QQuickView instance, i.e.

       

      QWidget* wig = QWidget::createWindowContainer(quickView, 0, Qt::Window);

      then

      // this is to support drag and drop 
      wig->setAcceptDrops(true);
      wig->installEventFilter(this);

       

      then adding the following method to myClass to intercept events on wig

      bool myclass::eventFilter(QObject *obj, QEvent *event){
      }

      It seems that the events related to mouse events like drag and drop are not being sent to eventFilter virtual function. i.e. QMouseEvent, QDragEnter, QDropEvent...etc.

      When only I switch to a  QQuickWidget instanct i.e.

       

      QQuickWidget* view = new QQuickWidget;
      view->setSource(QUrl("qrc:/res/purple.qml"));
      view->setAcceptDrops(true);
      view->installEventFilter(this);

       

      I am able to track mouse, drag, drop events normally.

      I've tested the above scenario on Windows 10 and Ubuntu 16.10 along with Qt 5.7.1 and both of them are working fine, I've been able to track mouse and drag/drop events from a QWidget created by QWidget::createWindowContainer.

      The problem happens only on Mac OS X, I've tested it on (El Capitan and Sierra).

      I've attached a working example that demonstrates the issue

      Attachments

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

        Activity

          People

            tvete Paul Olav Tvete
            mohamed.selim@isi.it Mohamed Selim
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes