Wiki Markup |
---|
{alias:qstackedwidget} h2. Name *qstackedwidget* — container widget for vertically stacked widgets. Similar to qtabwidget h2. Syntax {panel:|borderStyle=solid|borderWidth=1|bgColor=#FFFFAA} *qstackedwidget* \[ _parent_ ] {panel} h2. Description 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] but without the tabs. The widgets to be stacked are created separately and added using the [qaddwidget] command. Only one widget at a time is visible in the QWidgetStack. To select which one, invoke the [qraisewidgetqsetcurrentwidget] command with the widget id as argument. {note} The widgets that are to be stacked should not be added to a layout. {note} h2. Arguments _parent_ {indent}The parent widget. This argument is rarely needed since adding the QStackedWidget to a layout will set the parent correctly. {indent} h2. Examples h3. Ex.1: QStackedWidget {anchor:QStackedWidget} {noformat:|borderWidth=1|bgColor=#eeeeee} # 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 {noformat} !att:_img_cmd^qstackedwidget.png! Example +QStackedWidget+ shows a QStackedWidget with two pages. Each page contains a texteditor of type QTextEdit added with the [qaddwidget] command. To switch between the pages two buttons are created, one for each page. When pushed they call [qsetcurrentwidget], providing the desired visible widget as argument. |
Page Comparison
General
Content
Integrations