Wiki Markup |
---|
{alias:qstackedwidget} |
Name
qstackedwidget — container widget for vertically stacked widgets. Similar to qtabwidget
...
The qstackedwidget command creates a QStackedWidget object. This container widget has the ability to stack child widgets on top of each other like pages in a book. It is similar to a QTabWidget qtabwidget but without the tabs. The widgets to be stacked are created separately and added using the qaddwidget command.
...
Note |
---|
The widgets that are to be stacked should not be added to a layout. |
Arguments
parent
The parent widget. This argument is rarely needed since adding the QStackedWidget to a layout will set the parent correctly.
Examples
Ex.1: QStackedWidget
...
No Format | ||||
---|---|---|---|---|
| ||||
# Window
set w [qwidget ]
qsetwindowtitle QStackedWidget
# Create layout to contain stack and buttons
set layout [qvboxlayout $w]
# Create stacked widget and add to layout
set stackedwidget [qstackedwidget]
qaddwidget $layout $stackedwidget
# Create two editors and add to stack
set editor1 [qtextedit]
qsettext "Editor 1"
qaddwidget $stackedwidget $editor1
set editor2 [qtextedit]
qsettext "Editor 2"
qaddwidget $stackedwidget $editor2
# Create two buttons that sets current page
set b1 [qpushbutton "First page" "qsetcurrentwidget $stackedwidget $editor1"]
qaddwidget $layout $b1
set b2 [qpushbutton "Second page" "qsetcurrentwidget $stackedwidget $editor2"]
qaddwidget $layout $b2
qshow $w
|
...