diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
commit | 0a80cfd57d271dd44221467efb426675fa470356 (patch) | |
tree | 6f503a31aa078eaf8fa015cf1749808529d49fc9 /src/modules/objects/class_layout.cpp | |
parent | 3329e5a804e28ef3f5eb51d1e7affdd5a508e8f2 (diff) | |
download | kvirc-0a80cfd57d271dd44221467efb426675fa470356.tar.gz kvirc-0a80cfd57d271dd44221467efb426675fa470356.zip |
TQt4 port kvirc
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1238719 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/modules/objects/class_layout.cpp')
-rw-r--r-- | src/modules/objects/class_layout.cpp | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/src/modules/objects/class_layout.cpp b/src/modules/objects/class_layout.cpp index 900b9856..cac963b1 100644 --- a/src/modules/objects/class_layout.cpp +++ b/src/modules/objects/class_layout.cpp @@ -27,50 +27,50 @@ #include "class_layout.h" #ifdef COMPILE_USE_QT4 -#define QLAYOUT_AUTO_CONSTRAINT QLayout::SetDefaultConstraint -#define QLAYOUT_FIXED QLayout::SetFixedSize -#define QLAYOUT_FREE_RESIZE QLayout::SetNoConstraint -#define QLAYOUT_MINIMUM QLayout::SetMinimumSize +#define TQLAYOUT_AUTO_CONSTRAINT TQLayout::SetDefaultConstraint +#define TQLAYOUT_FIXED TQLayout::SetFixedSize +#define TQLAYOUT_FREE_RESIZE TQLayout::SetNoConstraint +#define TQLAYOUT_MINIMUM TQLayout::SetMinimumSize #else -#define QLAYOUT_AUTO_CONSTRAINT QLayout::Auto -#define QLAYOUT_FIXED QLayout::Fixed -#define QLAYOUT_FREE_RESIZE QLayout::FreeResize -#define QLAYOUT_MINIMUM QLayout::Minimum +#define TQLAYOUT_AUTO_CONSTRAINT TQLayout::Auto +#define TQLAYOUT_FIXED TQLayout::Fixed +#define TQLAYOUT_FREE_RESIZE TQLayout::FreeResize +#define TQLAYOUT_MINIMUM TQLayout::Minimum #endif /* - @doc: layout + @doc: tqlayout @keyterms: - layout object class, child widgets + tqlayout object class, child widgets @title: - layout class + tqlayout class @type: class @short: - Manages child widget geometry + Manages child widget tqgeometry @inherits: [class]object[/class] @description: - The layout is a geometry management tool for child widgets. - You create a layout , give it some widgets to manage and it will layout them + The tqlayout is a tqgeometry management tool for child widgets. + You create a tqlayout , give it some widgets to manage and it will tqlayout them automatically.[br] - The parent of the layout must be the widget for which child widget geometries have to be managed. - A layout is a grid of NxM cells in which you insert child widgets with [classfnc:layout]$addWidget[/classfnc]().[br] - Widgets that must span multiple cells can be added to the layout with [classfnc:layout]$addMultiCellWidget[/classfnc]().[br] + The tqparent of the tqlayout must be the widget for which child widget geometries have to be managed. + A tqlayout is a grid of NxM cells in which you insert child widgets with [classfnc:tqlayout]$addWidget[/classfnc]().[br] + Widgets that must span multiple cells can be added to the tqlayout with [classfnc:tqlayout]$addMultiCellWidget[/classfnc]().[br] @functions: !fn: $addWidget(<widget:object widget>,<row:uint>,<column:uint>) - Adds a widget to this layout placing it at position <row>,<column> in the grid + Adds a widget to this tqlayout placing it at position <row>,<column> in the grid !fn: $addMultiCellWidget(<widget:object widget>,<start_row:uint>,<end_row:uint>,<start_col:uint>,<end_col:uint>) - Adds a widget to this layout spanning multiple grid cells + Adds a widget to this tqlayout spanning multiple grid cells !fn: $setRowStretch(<row:uint>,<stretch:uint>) - Sets the stretch value for a particular row of this layout. The <stretch_value> + Sets the stretch value for a particular row of this tqlayout. The <stretch_value> must be a positive integer. The rows with bigger stretch values will take more space - in the layout. + in the tqlayout. !fn: $setColStretch(<column:uint>,<stretch:uint>) - Sets the stretch value for a particular column in this layout. The <stretch_value> + Sets the stretch value for a particular column in this tqlayout. The <stretch_value> must be a positive integer. The rows with bigger stretch values will take more space - in the layout. + in the tqlayout. !fn: $addRowSpacing(<row:uint>,<spacing:uint>) Sets the minimum height of the specified <row> to <spacing> which must be a positive integer !fn: $addColSpacing(<column:uint>,<spacing:uint>) @@ -78,18 +78,18 @@ !fn: $setSpacing(<spacing:uint>) Sets the default spacing of the widgets in pixels !fn: $setMargin(<margin:uint>) - Sets the dimension of the layout margin : the distance from the border to the outermost child widget edges. + Sets the dimension of the tqlayout margin : the distance from the border to the outermost child widget edges. !fn: $setResizeMode(<resize_mode:string>) - Sets the resize mode of the parent widget in relation to this layout. + Sets the resize mode of the tqparent widget in relation to this tqlayout. <mode> can be one of:[br] -Auto: this is the default[br] - -Fixed: the parent widget of this layout is resized to the "sizeHint" value and it cannot be resized by the user.[br] - -Minimum: the minimum size of the parent widget of this layout is set to minimumSize() and it cannot be smaller[br] - -FreeResize: the parent widget of this layout is not constrained at all[br] + -Fixed: the tqparent widget of this tqlayout is resized to the "tqsizeHint" value and it cannot be resized by the user.[br] + -Minimum: the minimum size of the tqparent widget of this tqlayout is set to tqminimumSize() and it cannot be smaller[br] + -FreeResize: the tqparent widget of this tqlayout is not constrained at all[br] */ -KVSO_BEGIN_REGISTERCLASS(KviKvsObject_layout,"layout","object") +KVSO_BEGIN_REGISTERCLASS(KviKvsObject_layout,"tqlayout","object") KVSO_REGISTER_HANDLER(KviKvsObject_layout,"addWidget", functionAddWidget) KVSO_REGISTER_HANDLER(KviKvsObject_layout,"addMultiCellWidget", functionAddMultiCellWidget) KVSO_REGISTER_HANDLER(KviKvsObject_layout,"setRowStretch", functionSetRowStretch) @@ -112,14 +112,14 @@ KVSO_END_CONSTRUCTOR(KviKvsObject_layout) bool KviKvsObject_layout::init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams) { - QWidget * w = parentScriptWidget(); + TQWidget * w = tqparentScriptWidget(); if(!w) { - pContext->warning(__tr2qs("The parent of a layout must be a widget!")); + pContext->warning(__tr2qs("The tqparent of a tqlayout must be a widget!")); return false; } - setObject(new QGridLayout(w)); + setObject(TQT_TQOBJECT(new TQGridLayout(w))); return true; } @@ -150,7 +150,7 @@ bool KviKvsObject_layout::functionAddWidget(KviKvsObjectFunctionCall *c) c->warning(__tr2qs("Can't add a non-widget object")); return true; } - ((QGridLayout *)object())->addWidget(((QWidget *)(pObject->object())),uRow,uCol); + ((TQGridLayout *)object())->addWidget(((TQWidget *)(pObject->object())),uRow,uCol); return true; } bool KviKvsObject_layout::functionAddMultiCellWidget(KviKvsObjectFunctionCall *c) @@ -182,7 +182,7 @@ bool KviKvsObject_layout::functionAddMultiCellWidget(KviKvsObjectFunctionCall *c c->warning(__tr2qs("Can't add a non-widget object")); return true; } - ((QGridLayout *)object())->addMultiCellWidget(((QWidget *)(pObject->object())),uStartRow,uEndRow,uStartCol,uEndCol); + ((TQGridLayout *)object())->addMultiCellWidget(((TQWidget *)(pObject->object())),uStartRow,uEndRow,uStartCol,uEndCol); return true; } bool KviKvsObject_layout::functionSetRowStretch(KviKvsObjectFunctionCall *c) @@ -193,7 +193,7 @@ bool KviKvsObject_layout::functionSetRowStretch(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("stretch",KVS_PT_UNSIGNEDINTEGER,0,uStretch) KVSO_PARAMETERS_END(c) if(!widget())return true; - ((QGridLayout *)object())->setRowStretch(uRow,uStretch); + ((TQGridLayout *)object())->setRowStretch(uRow,uStretch); return true; } bool KviKvsObject_layout::functionSetColStretch(KviKvsObjectFunctionCall *c) @@ -204,7 +204,7 @@ bool KviKvsObject_layout::functionSetColStretch(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("stretch",KVS_PT_UNSIGNEDINTEGER,0,uStretch) KVSO_PARAMETERS_END(c) if(!widget())return true; - ((QGridLayout *)object())->setColStretch(uCol,uStretch); + ((TQGridLayout *)object())->setColStretch(uCol,uStretch); return true; } @@ -214,7 +214,7 @@ bool KviKvsObject_layout::functionSetMargin(KviKvsObjectFunctionCall *c) KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("margin",KVS_PT_UNSIGNEDINTEGER,0,uMargin) KVSO_PARAMETERS_END(c) - if (widget()) ((QGridLayout *)object())->setMargin(uMargin); + if (widget()) ((TQGridLayout *)object())->setMargin(uMargin); return true; } @@ -224,7 +224,7 @@ bool KviKvsObject_layout::functionSetSpacing(KviKvsObjectFunctionCall *c) KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("spacing",KVS_PT_UNSIGNEDINTEGER,0,uSpacing) KVSO_PARAMETERS_END(c) - if (widget()) ((QGridLayout *)object())->setSpacing(uSpacing); + if (widget()) ((TQGridLayout *)object())->setSpacing(uSpacing); return true; } @@ -236,7 +236,7 @@ bool KviKvsObject_layout::functionAddRowSpacing(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("row",KVS_PT_UNSIGNEDINTEGER,0,uRow) KVSO_PARAMETER("spacing",KVS_PT_UNSIGNEDINTEGER,0,uSpacing) KVSO_PARAMETERS_END(c) - if (widget()) ((QGridLayout *)object())->addRowSpacing(uRow,uSpacing); + if (widget()) ((TQGridLayout *)object())->addRowSpacing(uRow,uSpacing); return true; } @@ -247,27 +247,27 @@ bool KviKvsObject_layout::functionAddColSpacing(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("column",KVS_PT_UNSIGNEDINTEGER,0,uCol) KVSO_PARAMETER("spacing",KVS_PT_UNSIGNEDINTEGER,0,uSpacing) KVSO_PARAMETERS_END(c) - if (widget()) ((QGridLayout *)object())->addColSpacing(uCol,uSpacing); + if (widget()) ((TQGridLayout *)object())->addColSpacing(uCol,uSpacing); return true; } bool KviKvsObject_layout::functionSetResizeMode(KviKvsObjectFunctionCall *c) { - QString szMode; + TQString szMode; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("resize_mode",KVS_PT_STRING,0,szMode) KVSO_PARAMETERS_END(c) if(!widget())return true; #ifdef COMPILE_USE_QT4 - QLayout::SizeConstraint r = QLAYOUT_AUTO_CONSTRAINT; + TQLayout::SizeConstraint r = TQLAYOUT_AUTO_CONSTRAINT; #else - QLayout::ResizeMode r = QLAYOUT_AUTO_CONSTRAINT; + TQLayout::ResizeMode r = TQLAYOUT_AUTO_CONSTRAINT; #endif - if(KviQString::equalCI(szMode,"FreeResize")) r = QLAYOUT_FREE_RESIZE; - else if(KviQString::equalCI(szMode,"Minimum")) r = QLAYOUT_MINIMUM; - else if(KviQString::equalCI(szMode,"Fixed"))r = QLAYOUT_FIXED; + if(KviTQString::equalCI(szMode,"FreeResize")) r = TQLAYOUT_FREE_RESIZE; + else if(KviTQString::equalCI(szMode,"Minimum")) r = TQLAYOUT_MINIMUM; + else if(KviTQString::equalCI(szMode,"Fixed"))r = TQLAYOUT_FIXED; else c->warning(__tr2qs("Invalid resize mode defaulting to Auto")); - ((QGridLayout *)object())->setResizeMode(r); + ((TQGridLayout *)object())->setResizeMode(r); return true; } |