Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.4.0 Alpha
-
All
Description
People apparently have various expectations what QWindow::fromWinId() does. The original commit https://codereview.qt-project.org/#/c/42990/ added it as a means of handling XEmbed, that is, the resulting QWindow is just a wrapper around a foreign window on which QWindow's could be parented. For this use case, it is unexpected that for example QWindow::setGeometry(), setWindowFlags() have an impact on it.
Other use cases from the related reports:
- Wrap around a foreign window and access its properties using fex QWindow::geometry().etc. This does not work as the values are not synced at construction time (should they ? - using events?)
- Should it be possible to wrap foreign child windows (see
QTBUG-43252) and what should be the behavior wrt geometry, maptoGlobal - currently ForeignWindow = 0x00000020 | Window implies that it is toplevel only.
- Fully control the window, retrieve events, etc.
- Conceivably, it could also be used to fix/work around
QTBUG-33079
OS X notes:
We want to support two use cases:
- Embed a QWindow in a foreign NSView hierarchy. This should be done by retrieving the internal NSView pointer via QWindow::winId() and then reparenting that NSView. The foreign view then controls the geometry and visibility status of the Qt view. This corresponds to QMacNativeWidget in Qt 4/5
- Embed a foreign NSView in a QWindow hierarchy. This should be done by using the QWindow::fromWinId() constructor and parenting that QWindow to some other Qt window. QWindow can then be used to control the geometry and visibility status of the foreign view. Retrieving arbitary events from the foreign view is not in scope. This corresponds to QMacCocoaViewContainer in Qt 4/5
(Note that QMacNativeWidget currently uses private QPlatformNativeInterface API. This will be replaced with winId() and fromWinId())
QMacCocoaViewContainer was refactored in https://codereview.qt-project.org/#/c/172969/
Other work in clarifying the situation: https://gist.github.com/torarnv/c5dfe2d2bc0c089910ce
Attachments
Issue Links
- relates to
-
QTBUG-33079 Windows: QWidget::create() ignores winId() passed in
- Closed
-
QTBUG-45767 QWindow::fromWinId
- Reported
-
QTBUG-50206 Dialog popup on wrong screen when parent is ActiveX embedded
- Reported
-
QTBUG-45275 Wrong display with foreign widget with QWidget::createWindowContainer()
- Closed
-
QTBUG-64116 Touch events are not correctly handled when QWindow is reparented onto native Window, resulting in touch offset
- Closed
-
QTBUG-34771 Not possible to embed qt widgets to external application (via QX11Embed)
- Closed
-
QTBUG-39851 iOS: QWindow::fromWinID() fails
- Closed
-
QTBUG-54430 [REG 5.6->5.7] Windows: Mouse wheel events are not propagated to ForeignWindow properly
- Closed
-
QTBUG-44404 Bad geometry for widgets created with QWidget::createWindowContainer(QWindow::fromWinId())
- Closed
-
QTBUG-43252 [Windows] QWindow::mapToGlobal() provides the wrong result if the window is embedded in a native window which also has a parent
- Closed
-
QTBUG-47079 Transparent and frameless widget hides native child widget
- Closed
- resulted from
-
QTBUG-40320 Multiple issues with foreign windows from QWindow::fromWinId() and QWidget::createWindowContainer()
- Reported
-
QTBUG-41041 Keyboard control lost when embedding QAxWidget to another process via QWidget::createWindowContainer
- Closed