MQWidget.WidgetBase class

A base class for all widgets.

Property

get set Type Name Description
x int id widget ID
x x string name widget's name (cannot be overwritten)
x x int tag an arbitrary value
x x bool enabled an enabling status
x x bool visible a visibility
x x string horzLayout a horizontal layout status
[auto] Automatically
[fixed] Set a width in pixels
[hintsize] Set a width by a hint size
[fill] Fill the whole width
[free] Specify a position and a size manually
x x string vertLayout a vertical layout status
[auto] Automatically
[fixed] Set a width in pixels
[hintsize] Set a width by a hint size
[fill] Fill the whole width
[free] Specify a position and a size manually
x x bool width a width
x x bool height a height
x x float fillRateX a filling rate in the width
x x float fillRateY a filling rate in the height
x x float fillBeforeRate a filling rate for a forward space
x x float fillAfterRate a filling rate for a backward space
x x float inSpace spaces between child widgets
x x float outSpace a space outside all children
x x float hintSizeRateX a hint size for a width
x x float hintSizeRateY a hint size for a height
x x int cellColumn a number of columns for a matrix frame
x x string hintText a hint text displayed on a tool tip

Method

Member Description
addChild Add a child widget.
insertChild Insert a child widget into the specified index.
removeChild Remove a child widget.
indexOfChild Get an index of a child widget.
getJustSize Get a size to contain all child widgets.
repaint Repaint a widget.
clientToScreen Convert a client coodinate to a screen coordinate.
screenToClient Convert a screen coodinate to a client coordinate.
clientToClient Convert a client coodinate to a screen coordinate.

addChild(child)

Add a child widget.

Parameters:
MQWidget.WidgetBase child - a child widget
Return value:
int - index of the child widget

insertChild(child, index)

Insert a child widget into the specified index.

Parameters:
MQWidget.WidgetBase child - a child widget
int index - an index to insert
Return value:
int - index of the child widget

removeChild(child)

Remove a child widget.

Parameters:
MQWidget.WidgetBase child - a child widget

indexOfChild(child)

Get an index of a child widget.

Parameters:
MQWidget.WidgetBase child - a child widget
Return value:
int - index of the child widget
[-1] Not a child widget

getJustSize([max_width, max_height])

Get a size to contain all child widgets.

Parameters:
int max_width - Maximum width of a widget
int max_height - Maximum height of a widget
Return value:
list{int,int} - A list contains a width and a height

repaint([immediate])

Repaint a widget.

Parameters:
bool immediate - Whether to repaint immediately or later

clientToScreen(x, y)

Convert a client coodinate to a screen coordinate.

Parameters:
int x - X coordinate on a client
int y - Y coordinate on a client
Return value:
list{int,int,bool} - A list contains X coordinate, Y coordinate and a result

screenToClient(x, y)

Convert a screen coodinate to a client coordinate.

Parameters:
int x - X coordinate on a client
int y - Y coordinate on a client
Return value:
list{int,int,bool} - A list contains X coordinate, Y coordinate and a result

clientToClient(x, y, target)

Convert a client coodinate to a screen coordinate.

Parameters:
int x - X coordinate on a client
int y - Y coordinate on a client
MQWidget.WidgetBase target - A target widget
Return value:
list{int,int,bool} - A list contains X coordinate on the target client, Y coordinate and a result