Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c++

qt

qt5

qwidget

I want to insert QQuickView to my old qt4 application in some widget layout. How to mix QWidget and QWindow in a single application?

Are there any examples?

like image 220
DEgITx Avatar asked Nov 02 '12 15:11

DEgITx


People also ask

How do I add a layout to Qwidget?

Layouts can be applied on QWidgets only. What you have to do is to insert a widget and apply the new layout to the widget. Tab widgets can contain the layout to align all items in it.

How do I change the layout of a central widget?

Add at least one widget on your MainWindow . Then select your window by clicking on it and click on the VerticalLayout Button at the top of QTCreator . You Vertical Layout is automatically added to the central widget and fills all the surface.

How do I create a window in Qt?

Let's open up Designer by double-clicking the mainwindow. ui to put menu bar and action. Type in "File" at the top menu, and "New Window..." under the "File" menu. We need to press Enter to make a real change in the menu.


1 Answers

This has been fixed in Qt 5.1. Citing [1]

To remedy this problem, Qt 5.1 introduces the function QWidget::createWindowContainer(). A function that creates a QWidget wrapper for an existing QWindow, allowing it to live inside a QWidget-based application. Using QQuickView or QOpenGLContext together with widgets is now possible.

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

like image 73
kfunk Avatar answered Sep 18 '22 17:09

kfunk