Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Wiki Markup
{alias:qhboxlayout}
h2. Name

*qhboxlayout* — layout manager that arranges widgets horizontally

h2. Syntax
{panel:|borderStyle=solid|borderWidth=1|bgColor=#FFFFAA}

*qhboxlayout* _cmds_ ... 

{panel}

h2. Description

The *qhboxlayout* command creates a QHBoxLayout object, making it the active layout manager. This layout manager will automatically arrange widgets horizontally (just call qhboxlayout followed by the creation of the widgets). 

Call [qsetmargin] to adjust the margin between the stacked widgets and the widget containing them, or use [qsetspacing] to adjust spacing between the stacked widgets. 

For non-trivial layouts consider nesting widgets inside QWidgets that contain their own layout. This way you can simulate having one layout manager inside another allowing for mixed vertical and horizontal layouts. This technique is shown in [#Nested Layout]. 

See also [qvboxlayout] and [qgridlayout]. 

h2. Arguments
_cmds_ 
{indent}A block containing arguments, typically the widgets to be contained inside the layout. 

{indent} 

h2. Examples

h3. Ex.1: QHBoxLayout
{anchor:QHBoxLayout}

{noformat:|borderWidth=1|bgColor=#eeeeee}

Name

qhboxlayout — layout manager that arranges widgets horizontally

Syntax

Panel
bgColor#FFFFAA
borderWidth1
borderStylesolid

qhboxlayout cmds ...

Description

The qhboxlayout command creates a QHBoxLayout object, making it the active layout manager. This layout manager will automatically arrange widgets horizontally (just call qhboxlayout followed by the creation of the widgets).

Call qsetmargin to adjust the margin between the stacked widgets and the widget containing them, or use qsetspacing to adjust spacing between the stacked widgets.

For non-trivial layouts consider nesting widgets inside QWidgets that contain their own layout. This way you can simulate having one layout manager inside another allowing for mixed vertical and horizontal layouts. This technique is shown in #Nested Layout.

See also qvboxlayout and qgridlayout.

Arguments

cmds

Examples

Ex.1: QHBoxLayout

Anchor
QHBoxLayout
QHBoxLayout

No Format
bgColor#eeeeee
borderWidth1
set w [qwidget]
qsetwindowtitle "QHBoxLayout"
qhboxlayout {
	qlabel "Label 1"
	qlabel "Label 2"
}
qshow $w

{noformat}

!att:_img_cmd^qhboxlayout.png!


h3. 

Image Added

Ex.2:

...

Nested

...

Layout

...

Anchor
Nested Layout
Nested Layout

No Format
bgColor#eeeeee
borderWidth1
set w [qwidget]
qsetwindowtitle "Nested QHBoxLayout"
qhboxlayout {
	qlabel "Label 1"
	# Add two vertically positioned labels between "Label 1" and "Label 2"
	qaddvboxlayout {
		qlabel "Inner label 1"
		qlabel "Inner label 2"
	}
	qlabel "Label 2"
}
qshow $w

{noformat}

!att:_img_cmd^nested_layouts.png!

Example [#Nested Layout] shows a QVBoxLayout nested inside a QHBoxLayout.

{pagebreak}

Image Added

Example #Nested Layout shows a QVBoxLayout nested inside a QHBoxLayout.