QWindow::fromWinId only implemented for XCB - How about windows?

  • Hi All,

    I was wondering, why the static method QWindow::romWinId() is only implemented in the XCB plugin and not in the windows platform plugin?

    I would really need it for my project currently. Are there any objectives or is it planned for a later release?

  • Lifetime Qt Champion


    What version of Qt are you using ?

    fromWinID is currently implemented in the gui module and all 3 desktop platforms support foreign windows.

  • Hi SGaist,

    thanks for the hint. I'm using Qt 5.1
    I was confused because the documentation of QWindow *QWindow::fromWinId(WId id) said:

    bq. Creates a local representation of a window created by another process or by
    using native libraries below Qt.
    Given the handle \a id to a native window, this method creates a QWindow object which can be used to represent the window when invoking methods like setParent() and setTransientParent(). This can be used, on platforms which support it, to embed a window inside a container or to make a window stick on top of a window created by another process.

    But the documentation of setParent (which is the method I wanted to use) said:

    bq. If \a parent is a window created by fromWinId(), then the current window will be embedded inside \a parent, if the platform supports it. Window embedding is currently supported only by the X11 platform plugin.

    A look into QWindowsIntegration::hasCapability showed that Qt::ForeignWindows was not defined. So I assumed after merging all this information together I thought its not working with windows.

    However, I had a look into the latest git sources and there were some changes.
    What I want to do is, put a QML project into a shared library and run it as a plugin in a native MFC application. The QML Window {} should be a child of the applications main window. You think this is possible?

  • Lifetime Qt Champion

    Very good question, but sorry, I don't know. Since it's an unusual case, you should ask this on the interest mailing list. You'll find Qt's developers/maintainers there (this forum is more user oriented)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.