
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQ3WidgetStack class provides a stack of widgets of which only the top widget is user-visible.More...
| Header: | #include <Q3WidgetStack> |
| Inherits: | Q3Frame |
| Q3WidgetStack(QWidget * parent, const char * name = 0, Qt::WindowFlags f = 0) | |
| ~Q3WidgetStack() | |
| int | addWidget(QWidget * w, int id = -1) |
| int | id(QWidget * widget) const |
| void | removeWidget(QWidget * w) |
| QWidget * | visibleWidget() const |
| QWidget * | widget(int id) const |
| virtual QSize | minimumSizeHint() const |
| virtual void | setVisible(bool visible) |
| virtual QSize | sizeHint() const |
| void | raiseWidget(int id) |
| void | raiseWidget(QWidget * w) |
| void | aboutToShow(int id) |
| void | aboutToShow(QWidget * widget) |
| virtual void | setChildGeometries() |
| virtual void | childEvent(QChildEvent * e) |
| virtual bool | event(QEvent * e) |
| virtual void | frameChanged() |
| virtual void | resizeEvent(QResizeEvent * e) |
TheQ3WidgetStack class provides a stack of widgets of which only the top widget is user-visible.
The application programmer can move any widget to the top of the stack at any time usingraiseWidget(), and add or remove widgets usingaddWidget() andremoveWidget(). It is not sufficient to pass the widget stack as parent to a widget which should be inserted into the widgetstack.
visibleWidget() is theget equivalent ofraiseWidget(); it returns a pointer to the widget that is currently at the top of the stack.
Q3WidgetStack also provides the ability to manipulate widgets through application-specified integer IDs. You can also translate from widget pointers to IDs usingid() and from IDs to widget pointers usingwidget(). These numeric IDs are unique (perQ3WidgetStack, not globally), butQ3WidgetStack does not attach any additional meaning to them.
The default widget stack is frameless, but you can use the usualQ3Frame functions (such assetFrameStyle()) to add a frame.
Q3WidgetStack provides a signal,aboutToShow(), which is emitted just before a managed widget is shown.
See alsoQ3TabDialog,QTabWidget,QTabBar, andQ3Frame.
Constructs an empty widget stack.
Theparent,name andf arguments are passed to theQ3Frame constructor.
Destroys the object and frees any allocated resources.
[signal]void Q3WidgetStack::aboutToShow(int id)This signal is emitted just before a managed widget is shown if that managed widget has an ID != -1. Theid parameter is the numeric ID of the widget.
If you callvisibleWidget() in a slot connected to aboutToShow(), the widget it returns is the one that is currently visible, not the one that is about to be shown.
Note:SignalaboutToShow is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:
connect(3WidgetStack,static_cast<void(Q3WidgetStack::*)(int)>(&Q3WidgetStack::aboutToShow),[=](int id){/* ... */ });
[signal]void Q3WidgetStack::aboutToShow(QWidget * widget)This is an overloaded function.
This signal is emitted just before a managed widget is shown. The argument is a pointer to thewidget.
If you callvisibleWidget() in a slot connected toaboutToShow(), the widget returned is the one that is currently visible, not the one that is about to be shown.
Note:SignalaboutToShow is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:
connect(3WidgetStack,static_cast<void(Q3WidgetStack::*)(QWidget*)>(&Q3WidgetStack::aboutToShow),[=](QWidget*widget){/* ... */ });
Adds widgetw to this stack of widgets, with IDid.
If you pass an id >= 0 this ID is used. If you pass anid of -1 (the default), the widgets will be numbered automatically. If you pass -2 a unique negative integer will be generated. No widget has an ID of -1. Returns the ID or -1 on failure (e.g.w is 0).
If you pass an id that is already used, then a unique negative integer will be generated to prevent two widgets having the same id.
Ifw already exists in the stack the widget will be removed first.
Ifw is not a child of thisQ3WidgetStack moves it usingreparent().
[virtual protected]void Q3WidgetStack::childEvent(QChildEvent * e)Reimplemented fromQObject::childEvent().
[virtual protected]bool Q3WidgetStack::event(QEvent * e)Reimplemented fromQObject::event().
[virtual protected]void Q3WidgetStack::frameChanged()Reimplemented fromQ3Frame::frameChanged().
Returns the ID of thewidget. Returns -1 ifwidget is 0 or is not being managed by this widget stack.
See alsowidget() andaddWidget().
[virtual]QSize Q3WidgetStack::minimumSizeHint() constReimplemented fromQWidget::minimumSizeHint().
[slot]void Q3WidgetStack::raiseWidget(int id)Raises the widget with IDid to the top of the widget stack.
See alsovisibleWidget().
[slot]void Q3WidgetStack::raiseWidget(QWidget * w)This is an overloaded function.
Raises widgetw to the top of the widget stack.
Removes widgetw from this stack of widgets. Does not deletew. Ifw is the currently visible widget, no other widget is substituted.
See alsovisibleWidget() andraiseWidget().
[virtual protected]void Q3WidgetStack::resizeEvent(QResizeEvent * e)Reimplemented fromQWidget::resizeEvent().
[virtual protected]void Q3WidgetStack::setChildGeometries()Fixes up the children's geometries.
[virtual]void Q3WidgetStack::setVisible(bool visible)Reimplemented fromQWidget::setVisible().
[virtual]QSize Q3WidgetStack::sizeHint() constReimplemented fromQWidget::sizeHint().
Returns the currently visible widget (the one at the top of the stack), or 0 if nothing is currently being shown.
See alsoaboutToShow(),id(), andraiseWidget().
Returns the widget with IDid. Returns 0 if this widget stack does not manage a widget with IDid.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.