Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

  • Qt 4.8
  • Qt3SupportLight
  • Q3WidgetStack

Q3WidgetStack Class

TheQ3WidgetStack class provides a stack of widgets of which only the top widget is user-visible.More...

Header:#include <Q3WidgetStack>
Inherits:Q3Frame

Public Functions

Q3WidgetStack(QWidget * parent, const char * name = 0, Qt::WindowFlags f = 0)
~Q3WidgetStack()
intaddWidget(QWidget * w, int id = -1)
intid(QWidget * widget) const
voidremoveWidget(QWidget * w)
QWidget *visibleWidget() const
QWidget *widget(int id) const

Reimplemented Public Functions

virtual QSizeminimumSizeHint() const
virtual voidsetVisible(bool visible)
virtual QSizesizeHint() const
  • 4 public functions inherited fromQ3Frame
  • 14 public functions inherited fromQFrame
  • 220 public functions inherited fromQWidget
  • 29 public functions inherited fromQObject
  • 12 public functions inherited fromQPaintDevice

Public Slots

voidraiseWidget(int id)
voidraiseWidget(QWidget * w)
  • 19 public slots inherited fromQWidget
  • 1 public slot inherited fromQObject

Signals

voidaboutToShow(int id)
voidaboutToShow(QWidget * widget)

Protected Functions

virtual voidsetChildGeometries()

Reimplemented Protected Functions

virtual voidchildEvent(QChildEvent * e)
virtual boolevent(QEvent * e)
virtual voidframeChanged()
virtual voidresizeEvent(QResizeEvent * e)
  • 5 protected functions inherited fromQ3Frame
  • 3 protected functions inherited fromQFrame
  • 37 protected functions inherited fromQWidget
  • 8 protected functions inherited fromQObject
  • 1 protected function inherited fromQPaintDevice

Additional Inherited Members

  • 2 properties inherited fromQ3Frame
  • 6 properties inherited fromQFrame
  • 58 properties inherited fromQWidget
  • 1 property inherited fromQObject
  • 4 static public members inherited fromQWidget
  • 7 static public members inherited fromQObject
  • 1 protected slot inherited fromQWidget

Detailed Description

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.

Member Function Documentation

Q3WidgetStack::Q3WidgetStack(QWidget * parent, constchar * name = 0,Qt::WindowFlags f = 0)

Constructs an empty widget stack.

Theparent,name andf arguments are passed to theQ3Frame constructor.

Q3WidgetStack::~Q3WidgetStack()

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){/* ... */ });

int Q3WidgetStack::addWidget(QWidget * w,int id = -1)

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().

int Q3WidgetStack::id(QWidget * widget) const

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() const

Reimplemented 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.

void Q3WidgetStack::removeWidget(QWidget * w)

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() const

Reimplemented fromQWidget::sizeHint().

QWidget * Q3WidgetStack::visibleWidget() const

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().

QWidget * Q3WidgetStack::widget(int id) const

Returns the widget with IDid. Returns 0 if this widget stack does not manage a widget with IDid.

See alsoid() andaddWidget().

© 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.


[8]ページ先頭

©2009-2025 Movatter.jp