qresize - Set widget size

Name

qresize — Set widget size

Syntax

qresize [widget] width height

Description

The qresize command sets the widget size, or geometry, in pixels. It is limited to the widget's settings for minimum and maximum size.

See also qadjustsize and qsetfixedsize.

Arguments

widget

Target widget. If not given the current widget is used.

width

Width in pixels.

height

Height in pixels.

Examples

Ex.1: Resizable Window

set width 300
set height 300

# Callback procedure for "Hide" button - hides the label
proc resize_window {} {
qresize $::w $::width  $::height
}


# Create toplevel window
set w [qwidget ]
qsetattribute $w deleteonclose
qsetwindowtitle  $w "Resizable Window"

set layout [qgridlayout $w]



# Width
set label [qlabel "Widget:"]
qaddwidget $layout 0 0

set width_field [qlineedit ]
qtrace $width_field width
qaddwidget $layout $width_field 0 1

# Height
set label [qlabel "Height:"]
qaddwidget $layout 1 0

set height_field [qlineedit ]
qtrace $height_field height
qaddwidget $layout $height_field 1 1

# Resize button
set button [qpushbutton "Resize this window" resize_window]

# Add button to span multiple columns. The syntax for this is :
# qaddwidget <gridlayout> <widget> <row> <column> <rows> <columns>
qaddwidget $layout $button 2 0 1 2

qshow $w

Example Resizable Window shows a toplevel window that will resize itself based on input parameters.