bool QGraphicsVideoItemPrivate::eventFilter(QObject *object, QEvent *event) { if (windowControl && object == videoWidget && QEvent::WinIdChange == event->type()) { windowControl->setWinId(videoWidget->effectiveWinId()); } else { bool updateEventFiltersRequired = false; bool refreshDisplayRequired = false; foreach (QPointer<QObject> target, eventFilterTargets) { if (object == target.data()) { switch (event->type()) { case QEvent::ParentChange: updateEventFiltersRequired = true; refreshDisplayRequired = true; break; case QEvent::Move: case QEvent::Resize: refreshDisplayRequired = true; break; } } } if (updateEventFiltersRequired) updateEventFilters(); #ifdef Q_OS_SYMBIAN if (refreshDisplayRequired && windowControl) QMetaObject::invokeMethod(windowControl, "refreshDisplay"); #endif } return false; }
void QGraphicsVideoItemPrivate::setWidget(QWidget *widget) { if (videoWidget != widget) { videoWidget = widget; if (widget) { windowControl->setWinId(widget->winId()); widget->installEventFilter(this); } } }
void QGraphicsVideoItemPrivate::updateWindowId() { const WId winId = videoWidget->winId(); // If the window ID is 0, it was not possible to promote the video widget from an alien widget // to a native widget. As a last resort use the native ancestor instead. if (winId == 0) { // Do not use videoWidget->effectiveWinId(), it will assert inside qtwidget // This stuff is broken in QPA. QWidget *parent = videoWidget; while (parent && !parent->winId()) { parent = parent->parentWidget(); } if (parent) { windowControl->setWinId(parent->winId()); QPoint topLeft = videoWidget->mapTo(parent, QPoint(0, 0)); windowControl->setDisplayRect(QRect(topLeft, videoWidget->size())); } } else { windowControl->setWinId(winId); } }