Qwidgets can become a part of the main form and a separate form
-
How to design and implement the following functions? Qwidgets can become a part of the main form and a separate form, and can switch freely between these two modes?
It is hard to manage the form and the main window at the same time. -
@nicker-player
Don't totally understand your question. You can create a UI class (e.g. in Designer) and at runtime create separate instances which you put on different forms (i.e. have different parents). If you want to stick with a single instance you will have to re-parent if you want to move it from one form/parent to another. What you cannot do is (somehow) have a single instance which lives on more than one form. Nor can you create a copy of anyQWidget
instance, sinceQWidget
/QObject
does not allow copying. -
@nicker-player
Yes,QWidget::setParent()
does indeed... change the parent of a widget! I don't know what event you are overriding or whether it is a good idea to do it there. -
Hi,
Sounds like you might be describing QDockWidget ?