简体   繁体   English

如何将 QWindow 放入 QWidget 的布局 (Qt5)

[英]How to put QWindow into QWidget's layout (Qt5)

I want to insert QQuickView to my old qt4 application in some widget layout.我想在某些小部件布局中将 QQuickView 插入到我的旧 qt4 应用程序中。 How to mix QWidget and QWindow in a single application?如何在单个应用程序中混合使用 QWidget 和 QWindow?

Are there any examples?有没有例子?

This has been fixed in Qt 5.1.这已在 Qt 5.1 中修复。 Citing [1]引用 [1]

To remedy this problem, Qt 5.1 introduces the function QWidget::createWindowContainer() .为了解决这个问题,Qt 5.1 引入了函数QWidget::createWindowContainer() A function that creates a QWidget wrapper for an existing QWindow, allowing it to live inside a QWidget-based application.一个为现有 QWindow 创建 QWidget 包装器的函数,允许它存在于基于 QWidget 的应用程序中。 Using QQuickView or QOpenGLContext together with widgets is now possible.现在可以将 QQuickView 或 QOpenGLContext 与小部件一起使用。

[1] https://www.qt.io/blog/2013/02/19/introducing-qwidgetcreatewindowcontainer [1] https://www.qt.io/blog/2013/02/19/introducing-qwidgetcreatewindowcontainer

Found this issue on Qt-project bugtracker.在 Qt-project bugtracker 上发现了这个问题

There is some workarounds in comments.评论中有一些解决方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM