Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Name

qaddlayout — add layout to another layout

Syntax

Panel
bgColor#FFFFAA
borderWidth1
borderStylesolid

qaddlayout parentboxlayout childlayout [stretch]

qaddlayout parentgridlayout childlayout row column

qaddlayout parentgridlayout childlayout row column rowspan columnspan

Description

The qaddlayout command adds a layout to another layout according the layout policy of the receiving layout. This command is used when nesting layouts.

Arguments

parentboxlayout

An instance of qhboxlayout or qvboxlayout. This is the layout that will contain the child layout to be added.

childlayout

The layout to be added to the parent layout. This can be any type of layout.

parentgridlayout

An instance of qgridlayout, acting as the receiving layout.

row

The row in the receiving qgridlayout where the child layout will be positioned.

column

The column in the receiving qgridlayout where the child layout will be positioned.

stretch

Stretch factor. An integer, this argument determines the layout's ability to stretch during resize. Use this to set preference to which layout(s) in a group should stretch. A value of 100 usually ensures that the given layout will be stretched rather than the other child layouts in the same containing layout.

Examples

Nested Layouts

No Format
bgColor#eeeeee
borderWidth1
set w [qwidget]
qsetwindowtitle "Nested Layouts"

# Main vertical layout for the toplevel window
set mainlayout [qvboxlayout $w]

set label [qlabel "<html>This label is added <em>directly</em> to the vertical layout</html>"]
qaddwidget $mainlayout $label

# Add OK and Cancel buttons in a separate horizontal layout
# Add this layout to main layout
set buttonlayout [qhboxlayout ]
qaddlayout $mainlayout $buttonlayout

set ok_button [qpushbutton OK]
qaddwidget $buttonlayout $ok_button

set cancel_button [qpushbutton Cancel]
qaddwidget $buttonlayout $cancel_button

qshow $w

{noformat}

!att:_img_cmd^nested_layouts.png!

The above example shows two buttons arranged in their own horizontal layout, which is added to the main vertical layout using the [qaddlayout] command.

Image Added

The above example shows two buttons arranged in their own horizontal layout, which is added to the main vertical layout using the qaddlayout command.