diff options
Diffstat (limited to 'kdevdesigner/uilib/qwidgetfactory.cpp')
-rw-r--r-- | kdevdesigner/uilib/qwidgetfactory.cpp | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/kdevdesigner/uilib/qwidgetfactory.cpp b/kdevdesigner/uilib/qwidgetfactory.cpp index 3dc55c01..c61584a7 100644 --- a/kdevdesigner/uilib/qwidgetfactory.cpp +++ b/kdevdesigner/uilib/qwidgetfactory.cpp @@ -33,7 +33,7 @@ #include "database2.h" #include <tqdom.h> #include <tqdir.h> -#include <layout.h> +#include <tqlayout.h> #include <tqmetaobject.h> #include <domtool.h> #include <uib.h> @@ -76,14 +76,14 @@ #include <tqwizard.h> #include <tqlcdnumber.h> #include <tqprogressbar.h> -#include <textview.h> -#include <textbrowser.h> +#include <tqtextview.h> +#include <tqtextbrowser.h> #include <tqdial.h> #include <tqslider.h> #include <tqframe.h> #include <tqwidgetstack.h> #include <tqtoolbox.h> -#include <textedit.h> +#include <tqtextedit.h> #include <tqscrollbar.h> #include <tqmainwindow.h> #include <tqsplitter.h> @@ -682,7 +682,7 @@ void TQWidgetFactory::inputSpacer( const UibStrTable& strings, TQDataStream& in, if ( name == "orientation" ) { vertical = ( value == "Vertical" ); - } else if ( name == "sizeHint" ) { + } else if ( name == "tqsizeHint" ) { w = value.toSize().width(); h = value.toSize().height(); } else if ( name == "sizeType" ) { @@ -907,7 +907,7 @@ TQObject *TQWidgetFactory::inputObject( TQObject **objects, int& numObjects, { TQObject *obj = 0; TQWidget *widget = 0; - TQLayout *layout = 0; + TQLayout *tqlayout = 0; TQWidget *parentWidget = 0; TQLayout *parentLayout = 0; @@ -942,11 +942,11 @@ TQObject *TQWidgetFactory::inputObject( TQObject **objects, int& numObjects, type = VBox; } if ( parentLayout != 0 && parentLayout->inherits(TQGRIDLAYOUT_OBJECT_NAME_STRING) ) { - layout = createLayout( 0, 0, type ); + tqlayout = createLayout( 0, 0, type ); } else { - layout = createLayout( parentWidget, parentLayout, type ); + tqlayout = createLayout( parentWidget, parentLayout, type ); } - obj = TQT_TQOBJECT(layout); + obj = TQT_TQOBJECT(tqlayout); } else if ( className == TQMENUBAR_OBJECT_NAME_STRING ) { unpackCString( strings, in, className ); widget = ((TQMainWindow *) parent)->menuBar(); @@ -1047,7 +1047,7 @@ TQObject *TQWidgetFactory::inputObject( TQObject **objects, int& numObjects, case Object_PaletteProperty: { TQPalette palette; - TQColorGroup colorGroup; + TQColorGroup tqcolorGroup; TQColor color; int role = -1; @@ -1057,26 +1057,26 @@ TQObject *TQWidgetFactory::inputObject( TQObject **objects, int& numObjects, while ( !in.atEnd() && paletteTag != Palette_End ) { switch ( paletteTag ) { case Palette_Active: - palette.setActive( colorGroup ); + palette.setActive( tqcolorGroup ); role = -1; break; case Palette_Inactive: - palette.setInactive( colorGroup ); + palette.setInactive( tqcolorGroup ); role = -1; break; case Palette_Disabled: - palette.setDisabled( colorGroup ); + palette.setDisabled( tqcolorGroup ); role = -1; break; case Palette_Color: role++; in >> color; - colorGroup.setColor( (TQColorGroup::ColorRole) role, + tqcolorGroup.setColor( (TQColorGroup::ColorRole) role, color ); break; case Palette_Pixmap: unpackVariant( strings, in, value ); - colorGroup.setBrush( (TQColorGroup::ColorRole) role, + tqcolorGroup.setBrush( (TQColorGroup::ColorRole) role, TQBrush(color, value.asPixmap()) ); break; default: @@ -1092,7 +1092,7 @@ TQObject *TQWidgetFactory::inputObject( TQObject **objects, int& numObjects, inputColumnOrRow( strings, in, obj, TRUE ); break; case Object_Spacer: - inputSpacer( strings, in, layout ); + inputSpacer( strings, in, tqlayout ); break; case Object_Separator: ((TQToolBar *) widget)->addSeparator(); @@ -1160,10 +1160,10 @@ TQObject *TQWidgetFactory::inputObject( TQObject **objects, int& numObjects, } else { ((TQBoxLayout *) parentLayout)->addWidget( widget ); } - } else if ( layout != 0 ) { + } else if ( tqlayout != 0 ) { if ( parentLayout->inherits(TQGRIDLAYOUT_OBJECT_NAME_STRING) ) { ((TQGridLayout *) parentLayout)->addMultiCellLayout( - layout, row, row + rowspan - 1, column, + tqlayout, row, row + rowspan - 1, column, column + colspan - 1 ); } } @@ -1175,7 +1175,7 @@ TQWidget *TQWidgetFactory::createFromUibFile( TQDataStream& in, TQObject * /* connector */ , TQWidget *parent, const char *name ) { #define END_OF_BLOCK() \ - ( in.atEnd() || in.device()->at() >= nextBlock ) + ( in.atEnd() || in.tqdevice()->at() >= nextBlock ) TQ_UINT8 lf; TQ_UINT8 cr; @@ -1204,7 +1204,7 @@ TQWidget *TQWidgetFactory::createFromUibFile( TQDataStream& in, in >> blockType; while ( !in.atEnd() && blockType != Block_End ) { unpackUInt32( in, blockSize ); - TQIODevice::Offset nextBlock = in.device()->at() + blockSize; + TQIODevice::Offset nextBlock = in.tqdevice()->at() + blockSize; switch ( blockType ) { case Block_Actions: @@ -1258,7 +1258,7 @@ TQWidget *TQWidgetFactory::createFromUibFile( TQDataStream& in, case Block_Functions: // ### qWarning( "Block_Functions not supported" ); - in.device()->at( nextBlock ); + in.tqdevice()->at( nextBlock ); break; case Block_Images: { @@ -1340,7 +1340,7 @@ TQWidget *TQWidgetFactory::createFromUibFile( TQDataStream& in, case Block_Variables: // ### qWarning( "Block_Variables not supported" ); - in.device()->at( nextBlock ); + in.tqdevice()->at( nextBlock ); break; case Block_Widget: toplevel = (TQWidget *) @@ -1568,7 +1568,7 @@ bool TQWidgetFactory::supportsWidget( const TQString &widget ) } TQWidget *TQWidgetFactory::createWidgetInternal( const TQDomElement &e, TQWidget *parent, - TQLayout* layout, const TQString &classNameArg ) + TQLayout* tqlayout, const TQString &classNameArg ) { d->lastItem = 0; TQDomElement n = e.firstChild().toElement(); @@ -1589,12 +1589,12 @@ TQWidget *TQWidgetFactory::createWidgetInternal( const TQDomElement &e, TQWidget bool isTQLayoutWidget = FALSE; if ( !className.isEmpty() ) { - if ( !layout && className == TQLAYOUTWIDGET_OBJECT_NAME_STRING ) { + if ( !tqlayout && className == TQLAYOUTWIDGET_OBJECT_NAME_STRING ) { className = TQWIDGET_OBJECT_NAME_STRING; isTQLayoutWidget = TRUE; } - if ( layout && className == TQLAYOUTWIDGET_OBJECT_NAME_STRING ) { - // hide layout widgets + if ( tqlayout && className == TQLAYOUTWIDGET_OBJECT_NAME_STRING ) { + // hide tqlayout widgets w = parent; } else { obj = TQT_TQOBJECT(TQWidgetFactory::createWidget( className, parent, 0 )); @@ -1605,16 +1605,16 @@ TQWidget *TQWidgetFactory::createWidgetInternal( const TQDomElement &e, TQWidget toplevel = w; if ( w->inherits( TQMAINWINDOW_OBJECT_NAME_STRING ) ) w = ( (TQMainWindow*)w )->centralWidget(); - if ( layout ) { - switch( layoutType( layout ) ) { + if ( tqlayout ) { + switch( layoutType( tqlayout ) ) { case HBox: - ( (TQHBoxLayout*)layout )->addWidget( w ); + ( (TQHBoxLayout*)tqlayout )->addWidget( w ); break; case VBox: - ( (TQVBoxLayout*)layout )->addWidget( w ); + ( (TQVBoxLayout*)tqlayout )->addWidget( w ); break; case Grid: - ( (TQGridLayout*)layout )->addMultiCellWidget( w, row, row + rowspan - 1, + ( (TQGridLayout*)tqlayout )->addMultiCellWidget( w, row, row + rowspan - 1, col, col + colspan - 1 ); break; default: @@ -1622,7 +1622,7 @@ TQWidget *TQWidgetFactory::createWidgetInternal( const TQDomElement &e, TQWidget } } - layout = 0; + tqlayout = 0; } } #ifdef TQT_CONTAINER_CUSTOM_WIDGETS @@ -1636,45 +1636,45 @@ TQWidget *TQWidgetFactory::createWidgetInternal( const TQDomElement &e, TQWidget int idx = 0; while ( !n.isNull() ) { if ( n.tagName() == "spacer" ) { - createSpacer( n, layout ); + createSpacer( n, tqlayout ); } else if ( n.tagName() == "widget" ) { TQMap< TQString, TQString> *oldDbControls = dbControls; - createWidgetInternal( n, w, layout, n.attribute( "class", TQWIDGET_OBJECT_NAME_STRING ) ); + createWidgetInternal( n, w, tqlayout, n.attribute( "class", TQWIDGET_OBJECT_NAME_STRING ) ); dbControls = oldDbControls; } else if ( n.tagName() == "hbox" ) { - TQLayout *parentLayout = layout; - if ( layout && layout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - layout = createLayout( 0, 0, TQWidgetFactory::HBox, isTQLayoutWidget ); + TQLayout *parentLayout = tqlayout; + if ( tqlayout && tqlayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + tqlayout = createLayout( 0, 0, TQWidgetFactory::HBox, isTQLayoutWidget ); else - layout = createLayout( w, layout, TQWidgetFactory::HBox, isTQLayoutWidget ); - obj = TQT_TQOBJECT(layout); + tqlayout = createLayout( w, tqlayout, TQWidgetFactory::HBox, isTQLayoutWidget ); + obj = TQT_TQOBJECT(tqlayout); n = n.firstChild().toElement(); if ( parentLayout && parentLayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - ( (TQGridLayout*)parentLayout )->addMultiCellLayout( layout, row, + ( (TQGridLayout*)parentLayout )->addMultiCellLayout( tqlayout, row, row + rowspan - 1, col, col + colspan - 1 ); continue; } else if ( n.tagName() == "grid" ) { - TQLayout *parentLayout = layout; - if ( layout && layout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - layout = createLayout( 0, 0, TQWidgetFactory::Grid, isTQLayoutWidget ); + TQLayout *parentLayout = tqlayout; + if ( tqlayout && tqlayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + tqlayout = createLayout( 0, 0, TQWidgetFactory::Grid, isTQLayoutWidget ); else - layout = createLayout( w, layout, TQWidgetFactory::Grid, isTQLayoutWidget ); - obj = TQT_TQOBJECT(layout); + tqlayout = createLayout( w, tqlayout, TQWidgetFactory::Grid, isTQLayoutWidget ); + obj = TQT_TQOBJECT(tqlayout); n = n.firstChild().toElement(); if ( parentLayout && parentLayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - ( (TQGridLayout*)parentLayout )->addMultiCellLayout( layout, row, + ( (TQGridLayout*)parentLayout )->addMultiCellLayout( tqlayout, row, row + rowspan - 1, col, col + colspan - 1 ); continue; } else if ( n.tagName() == "vbox" ) { - TQLayout *parentLayout = layout; - if ( layout && layout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - layout = createLayout( 0, 0, TQWidgetFactory::VBox, isTQLayoutWidget ); + TQLayout *parentLayout = tqlayout; + if ( tqlayout && tqlayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + tqlayout = createLayout( 0, 0, TQWidgetFactory::VBox, isTQLayoutWidget ); else - layout = createLayout( w, layout, TQWidgetFactory::VBox, isTQLayoutWidget ); - obj = TQT_TQOBJECT(layout); + tqlayout = createLayout( w, tqlayout, TQWidgetFactory::VBox, isTQLayoutWidget ); + obj = TQT_TQOBJECT(tqlayout); n = n.firstChild().toElement(); if ( parentLayout && parentLayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - ( (TQGridLayout*)parentLayout )->addMultiCellLayout( layout, row, + ( (TQGridLayout*)parentLayout )->addMultiCellLayout( tqlayout, row, row + rowspan - 1, col, col + colspan - 1 ); continue; } else if ( n.tagName() == "property" && obj ) { @@ -1728,47 +1728,47 @@ TQWidget *TQWidgetFactory::createWidgetInternal( const TQDomElement &e, TQWidget return w; } -TQLayout *TQWidgetFactory::createLayout( TQWidget *widget, TQLayout* layout, +TQLayout *TQWidgetFactory::createLayout( TQWidget *widget, TQLayout* tqlayout, LayoutType type, bool isTQLayoutWidget ) { int spacing = defSpacing; int margin = defMargin; - if ( layout || !widget || isTQLayoutWidget ) + if ( tqlayout || !widget || isTQLayoutWidget ) margin = 0; - if ( !layout && widget && widget->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) + if ( !tqlayout && widget && widget->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) widget = ((TQTabWidget*)widget)->currentPage(); - if ( !layout && widget && widget->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) + if ( !tqlayout && widget && widget->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) widget = ((TQWizard*)widget)->currentPage(); - if ( !layout && widget && widget->inherits( TQWIDGETSTACK_OBJECT_NAME_STRING ) ) + if ( !tqlayout && widget && widget->inherits( TQWIDGETSTACK_OBJECT_NAME_STRING ) ) widget = ((TQWidgetStack*)widget)->visibleWidget(); - if ( !layout && widget && widget->inherits( TQTOOLBOX_OBJECT_NAME_STRING ) ) + if ( !tqlayout && widget && widget->inherits( TQTOOLBOX_OBJECT_NAME_STRING ) ) widget = ((TQToolBox*)widget)->currentItem(); TQLayout *l = 0; int align = 0; - if ( !layout && widget && widget->inherits( TQGROUPBOX_OBJECT_NAME_STRING ) ) { + if ( !tqlayout && widget && widget->inherits( TQGROUPBOX_OBJECT_NAME_STRING ) ) { TQGroupBox *gb = (TQGroupBox*)widget; gb->setColumnLayout( 0, Qt::Vertical ); - layout = gb->layout(); - layout->setMargin( 0 ); - layout->setSpacing( 0 ); + tqlayout = gb->tqlayout(); + tqlayout->setMargin( 0 ); + tqlayout->setSpacing( 0 ); align = TQt::AlignTop; } - if ( layout ) { + if ( tqlayout ) { switch ( type ) { case HBox: - l = new TQHBoxLayout( layout ); + l = new TQHBoxLayout( tqlayout ); break; case VBox: - l = new TQVBoxLayout( layout ); + l = new TQVBoxLayout( tqlayout ); break; case Grid: - l = new TQGridLayout( layout ); + l = new TQGridLayout( tqlayout ); break; default: return 0; @@ -1788,19 +1788,19 @@ TQLayout *TQWidgetFactory::createLayout( TQWidget *widget, TQLayout* layout, return 0; } } - l->setAlignment( align ); + l->tqsetAlignment( align ); l->setMargin( margin ); l->setSpacing( spacing ); return l; } -TQWidgetFactory::LayoutType TQWidgetFactory::layoutType( TQLayout *layout ) const +TQWidgetFactory::LayoutType TQWidgetFactory::layoutType( TQLayout *tqlayout ) const { - if ( layout->inherits( TQHBOXLAYOUT_OBJECT_NAME_STRING ) ) + if ( tqlayout->inherits( TQHBOXLAYOUT_OBJECT_NAME_STRING ) ) return HBox; - else if ( layout->inherits( TQVBOXLAYOUT_OBJECT_NAME_STRING ) ) + else if ( tqlayout->inherits( TQVBOXLAYOUT_OBJECT_NAME_STRING ) ) return VBox; - else if ( layout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + else if ( tqlayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) return Grid; return NoLayout; } @@ -1808,7 +1808,7 @@ TQWidgetFactory::LayoutType TQWidgetFactory::layoutType( TQLayout *layout ) cons void TQWidgetFactory::setProperty( TQObject* obj, const TQString &prop, TQVariant value ) { - int offset = obj->metaObject()->findProperty( prop.ascii(), TRUE ); + int offset = obj->tqmetaObject()->findProperty( prop.ascii(), TRUE ); if ( offset != -1 ) { if ( prop == "geometry" && TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(toplevel) ) { @@ -1819,7 +1819,7 @@ void TQWidgetFactory::setProperty( TQObject* obj, const TQString &prop, if ( value.type() == TQVariant::String || value.type() == TQVariant::CString ) { const TQMetaProperty *metaProp = - obj->metaObject()->property( offset, TRUE ); + obj->tqmetaObject()->property( offset, TRUE ); if ( metaProp != 0 && metaProp->isEnumType() ) { if ( metaProp->isSetType() ) { TQStrList flagsCStr; @@ -1917,7 +1917,7 @@ void TQWidgetFactory::setProperty( TQObject* widget, const TQString &prop, const setProperty( widget, prop, value ); } -void TQWidgetFactory::createSpacer( const TQDomElement &e, TQLayout *layout ) +void TQWidgetFactory::createSpacer( const TQDomElement &e, TQLayout *tqlayout ) { TQDomElement n = e.firstChild().toElement(); int row = e.attribute( "row" ).toInt(); @@ -1938,7 +1938,7 @@ void TQWidgetFactory::createSpacer( const TQDomElement &e, TQLayout *layout ) orient = Qt::Vertical; } else if ( prop == "sizeType" ) { sizeType = stringToSizeType( n.firstChild().firstChild().toText().data() ); - } else if ( prop == "sizeHint" ) { + } else if ( prop == "tqsizeHint" ) { w = n.firstChild().firstChild().firstChild().toText().data().toInt(); h = n.firstChild().firstChild().nextSibling().firstChild().toText().data().toInt(); } @@ -1952,11 +1952,11 @@ void TQWidgetFactory::createSpacer( const TQDomElement &e, TQLayout *layout ) colspan = 1; TQSpacerItem *item = new TQSpacerItem( w, h, orient == Qt::Horizontal ? sizeType : TQSizePolicy::Minimum, orient == Qt::Vertical ? sizeType : TQSizePolicy::Minimum ); - if ( layout ) { - if ( layout->inherits( TQBOXLAYOUT_OBJECT_NAME_STRING ) ) - ( (TQBoxLayout*)layout )->addItem( item ); + if ( tqlayout ) { + if ( tqlayout->inherits( TQBOXLAYOUT_OBJECT_NAME_STRING ) ) + ( (TQBoxLayout*)tqlayout )->addItem( item ); else - ( (TQGridLayout*)layout )->addMultiCell( item, row, row + rowspan - 1, col, col + colspan - 1, + ( (TQGridLayout*)tqlayout )->addMultiCell( item, row, row + rowspan - 1, col, col + colspan - 1, orient == Qt::Horizontal ? TQt::AlignVCenter : TQt::AlignHCenter ); } } @@ -2140,16 +2140,16 @@ void TQWidgetFactory::loadConnections( const TQDomElement &e, TQObject *connecto } TQString s = "2""%1"; - s = s.arg( conn.signal.data() ); + s = s.tqarg( conn.signal.data() ); TQString s2 = "1""%1"; - s2 = s2.arg( conn.slot.data() ); + s2 = s2.tqarg( conn.slot.data() ); - TQStrList signalList = sender->metaObject()->signalNames( TRUE ); - TQStrList slotList = receiver->metaObject()->slotNames( TRUE ); + TQStrList signalList = sender->tqmetaObject()->signalNames( TRUE ); + TQStrList slotList = receiver->tqmetaObject()->slotNames( TRUE ); // if this is a connection to a custom slot and we have a connector, try this as receiver if ( slotList.find( conn.slot ) == -1 && (TQT_BASE_OBJECT(receiver) == TQT_BASE_OBJECT(toplevel)) && connector ) { - slotList = connector->metaObject()->slotNames( TRUE ); + slotList = connector->tqmetaObject()->slotNames( TRUE ); receiver = connector; } |