diff options
Diffstat (limited to 'kdevdesigner/uilib')
-rw-r--r-- | kdevdesigner/uilib/qwidgetfactory.cpp | 168 | ||||
-rw-r--r-- | kdevdesigner/uilib/qwidgetfactory.h | 6 |
2 files changed, 87 insertions, 87 deletions
diff --git a/kdevdesigner/uilib/qwidgetfactory.cpp b/kdevdesigner/uilib/qwidgetfactory.cpp index c61584a7..3dc55c01 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 <tqlayout.h> +#include <layout.h> #include <tqmetaobject.h> #include <domtool.h> #include <uib.h> @@ -76,14 +76,14 @@ #include <tqwizard.h> #include <tqlcdnumber.h> #include <tqprogressbar.h> -#include <tqtextview.h> -#include <tqtextbrowser.h> +#include <textview.h> +#include <textbrowser.h> #include <tqdial.h> #include <tqslider.h> #include <tqframe.h> #include <tqwidgetstack.h> #include <tqtoolbox.h> -#include <tqtextedit.h> +#include <textedit.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 == "tqsizeHint" ) { + } else if ( name == "sizeHint" ) { 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 *tqlayout = 0; + TQLayout *layout = 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) ) { - tqlayout = createLayout( 0, 0, type ); + layout = createLayout( 0, 0, type ); } else { - tqlayout = createLayout( parentWidget, parentLayout, type ); + layout = createLayout( parentWidget, parentLayout, type ); } - obj = TQT_TQOBJECT(tqlayout); + obj = TQT_TQOBJECT(layout); } 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 tqcolorGroup; + TQColorGroup colorGroup; 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( tqcolorGroup ); + palette.setActive( colorGroup ); role = -1; break; case Palette_Inactive: - palette.setInactive( tqcolorGroup ); + palette.setInactive( colorGroup ); role = -1; break; case Palette_Disabled: - palette.setDisabled( tqcolorGroup ); + palette.setDisabled( colorGroup ); role = -1; break; case Palette_Color: role++; in >> color; - tqcolorGroup.setColor( (TQColorGroup::ColorRole) role, + colorGroup.setColor( (TQColorGroup::ColorRole) role, color ); break; case Palette_Pixmap: unpackVariant( strings, in, value ); - tqcolorGroup.setBrush( (TQColorGroup::ColorRole) role, + colorGroup.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, tqlayout ); + inputSpacer( strings, in, layout ); 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 ( tqlayout != 0 ) { + } else if ( layout != 0 ) { if ( parentLayout->inherits(TQGRIDLAYOUT_OBJECT_NAME_STRING) ) { ((TQGridLayout *) parentLayout)->addMultiCellLayout( - tqlayout, row, row + rowspan - 1, column, + layout, 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.tqdevice()->at() >= nextBlock ) + ( in.atEnd() || in.device()->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.tqdevice()->at() + blockSize; + TQIODevice::Offset nextBlock = in.device()->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.tqdevice()->at( nextBlock ); + in.device()->at( nextBlock ); break; case Block_Images: { @@ -1340,7 +1340,7 @@ TQWidget *TQWidgetFactory::createFromUibFile( TQDataStream& in, case Block_Variables: // ### qWarning( "Block_Variables not supported" ); - in.tqdevice()->at( nextBlock ); + in.device()->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* tqlayout, const TQString &classNameArg ) + TQLayout* layout, 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 ( !tqlayout && className == TQLAYOUTWIDGET_OBJECT_NAME_STRING ) { + if ( !layout && className == TQLAYOUTWIDGET_OBJECT_NAME_STRING ) { className = TQWIDGET_OBJECT_NAME_STRING; isTQLayoutWidget = TRUE; } - if ( tqlayout && className == TQLAYOUTWIDGET_OBJECT_NAME_STRING ) { - // hide tqlayout widgets + if ( layout && className == TQLAYOUTWIDGET_OBJECT_NAME_STRING ) { + // hide layout 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 ( tqlayout ) { - switch( layoutType( tqlayout ) ) { + if ( layout ) { + switch( layoutType( layout ) ) { case HBox: - ( (TQHBoxLayout*)tqlayout )->addWidget( w ); + ( (TQHBoxLayout*)layout )->addWidget( w ); break; case VBox: - ( (TQVBoxLayout*)tqlayout )->addWidget( w ); + ( (TQVBoxLayout*)layout )->addWidget( w ); break; case Grid: - ( (TQGridLayout*)tqlayout )->addMultiCellWidget( w, row, row + rowspan - 1, + ( (TQGridLayout*)layout )->addMultiCellWidget( w, row, row + rowspan - 1, col, col + colspan - 1 ); break; default: @@ -1622,7 +1622,7 @@ TQWidget *TQWidgetFactory::createWidgetInternal( const TQDomElement &e, TQWidget } } - tqlayout = 0; + layout = 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, tqlayout ); + createSpacer( n, layout ); } else if ( n.tagName() == "widget" ) { TQMap< TQString, TQString> *oldDbControls = dbControls; - createWidgetInternal( n, w, tqlayout, n.attribute( "class", TQWIDGET_OBJECT_NAME_STRING ) ); + createWidgetInternal( n, w, layout, n.attribute( "class", TQWIDGET_OBJECT_NAME_STRING ) ); dbControls = oldDbControls; } else if ( n.tagName() == "hbox" ) { - TQLayout *parentLayout = tqlayout; - if ( tqlayout && tqlayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - tqlayout = createLayout( 0, 0, TQWidgetFactory::HBox, isTQLayoutWidget ); + TQLayout *parentLayout = layout; + if ( layout && layout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + layout = createLayout( 0, 0, TQWidgetFactory::HBox, isTQLayoutWidget ); else - tqlayout = createLayout( w, tqlayout, TQWidgetFactory::HBox, isTQLayoutWidget ); - obj = TQT_TQOBJECT(tqlayout); + layout = createLayout( w, layout, TQWidgetFactory::HBox, isTQLayoutWidget ); + obj = TQT_TQOBJECT(layout); n = n.firstChild().toElement(); if ( parentLayout && parentLayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - ( (TQGridLayout*)parentLayout )->addMultiCellLayout( tqlayout, row, + ( (TQGridLayout*)parentLayout )->addMultiCellLayout( layout, row, row + rowspan - 1, col, col + colspan - 1 ); continue; } else if ( n.tagName() == "grid" ) { - TQLayout *parentLayout = tqlayout; - if ( tqlayout && tqlayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - tqlayout = createLayout( 0, 0, TQWidgetFactory::Grid, isTQLayoutWidget ); + TQLayout *parentLayout = layout; + if ( layout && layout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + layout = createLayout( 0, 0, TQWidgetFactory::Grid, isTQLayoutWidget ); else - tqlayout = createLayout( w, tqlayout, TQWidgetFactory::Grid, isTQLayoutWidget ); - obj = TQT_TQOBJECT(tqlayout); + layout = createLayout( w, layout, TQWidgetFactory::Grid, isTQLayoutWidget ); + obj = TQT_TQOBJECT(layout); n = n.firstChild().toElement(); if ( parentLayout && parentLayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - ( (TQGridLayout*)parentLayout )->addMultiCellLayout( tqlayout, row, + ( (TQGridLayout*)parentLayout )->addMultiCellLayout( layout, row, row + rowspan - 1, col, col + colspan - 1 ); continue; } else if ( n.tagName() == "vbox" ) { - TQLayout *parentLayout = tqlayout; - if ( tqlayout && tqlayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - tqlayout = createLayout( 0, 0, TQWidgetFactory::VBox, isTQLayoutWidget ); + TQLayout *parentLayout = layout; + if ( layout && layout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + layout = createLayout( 0, 0, TQWidgetFactory::VBox, isTQLayoutWidget ); else - tqlayout = createLayout( w, tqlayout, TQWidgetFactory::VBox, isTQLayoutWidget ); - obj = TQT_TQOBJECT(tqlayout); + layout = createLayout( w, layout, TQWidgetFactory::VBox, isTQLayoutWidget ); + obj = TQT_TQOBJECT(layout); n = n.firstChild().toElement(); if ( parentLayout && parentLayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - ( (TQGridLayout*)parentLayout )->addMultiCellLayout( tqlayout, row, + ( (TQGridLayout*)parentLayout )->addMultiCellLayout( layout, 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* tqlayout, +TQLayout *TQWidgetFactory::createLayout( TQWidget *widget, TQLayout* layout, LayoutType type, bool isTQLayoutWidget ) { int spacing = defSpacing; int margin = defMargin; - if ( tqlayout || !widget || isTQLayoutWidget ) + if ( layout || !widget || isTQLayoutWidget ) margin = 0; - if ( !tqlayout && widget && widget->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) + if ( !layout && widget && widget->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) widget = ((TQTabWidget*)widget)->currentPage(); - if ( !tqlayout && widget && widget->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) + if ( !layout && widget && widget->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) widget = ((TQWizard*)widget)->currentPage(); - if ( !tqlayout && widget && widget->inherits( TQWIDGETSTACK_OBJECT_NAME_STRING ) ) + if ( !layout && widget && widget->inherits( TQWIDGETSTACK_OBJECT_NAME_STRING ) ) widget = ((TQWidgetStack*)widget)->visibleWidget(); - if ( !tqlayout && widget && widget->inherits( TQTOOLBOX_OBJECT_NAME_STRING ) ) + if ( !layout && widget && widget->inherits( TQTOOLBOX_OBJECT_NAME_STRING ) ) widget = ((TQToolBox*)widget)->currentItem(); TQLayout *l = 0; int align = 0; - if ( !tqlayout && widget && widget->inherits( TQGROUPBOX_OBJECT_NAME_STRING ) ) { + if ( !layout && widget && widget->inherits( TQGROUPBOX_OBJECT_NAME_STRING ) ) { TQGroupBox *gb = (TQGroupBox*)widget; gb->setColumnLayout( 0, Qt::Vertical ); - tqlayout = gb->tqlayout(); - tqlayout->setMargin( 0 ); - tqlayout->setSpacing( 0 ); + layout = gb->layout(); + layout->setMargin( 0 ); + layout->setSpacing( 0 ); align = TQt::AlignTop; } - if ( tqlayout ) { + if ( layout ) { switch ( type ) { case HBox: - l = new TQHBoxLayout( tqlayout ); + l = new TQHBoxLayout( layout ); break; case VBox: - l = new TQVBoxLayout( tqlayout ); + l = new TQVBoxLayout( layout ); break; case Grid: - l = new TQGridLayout( tqlayout ); + l = new TQGridLayout( layout ); break; default: return 0; @@ -1788,19 +1788,19 @@ TQLayout *TQWidgetFactory::createLayout( TQWidget *widget, TQLayout* tqlayout, return 0; } } - l->tqsetAlignment( align ); + l->setAlignment( align ); l->setMargin( margin ); l->setSpacing( spacing ); return l; } -TQWidgetFactory::LayoutType TQWidgetFactory::layoutType( TQLayout *tqlayout ) const +TQWidgetFactory::LayoutType TQWidgetFactory::layoutType( TQLayout *layout ) const { - if ( tqlayout->inherits( TQHBOXLAYOUT_OBJECT_NAME_STRING ) ) + if ( layout->inherits( TQHBOXLAYOUT_OBJECT_NAME_STRING ) ) return HBox; - else if ( tqlayout->inherits( TQVBOXLAYOUT_OBJECT_NAME_STRING ) ) + else if ( layout->inherits( TQVBOXLAYOUT_OBJECT_NAME_STRING ) ) return VBox; - else if ( tqlayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + else if ( layout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) return Grid; return NoLayout; } @@ -1808,7 +1808,7 @@ TQWidgetFactory::LayoutType TQWidgetFactory::layoutType( TQLayout *tqlayout ) co void TQWidgetFactory::setProperty( TQObject* obj, const TQString &prop, TQVariant value ) { - int offset = obj->tqmetaObject()->findProperty( prop.ascii(), TRUE ); + int offset = obj->metaObject()->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->tqmetaObject()->property( offset, TRUE ); + obj->metaObject()->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 *tqlayout ) +void TQWidgetFactory::createSpacer( const TQDomElement &e, TQLayout *layout ) { TQDomElement n = e.firstChild().toElement(); int row = e.attribute( "row" ).toInt(); @@ -1938,7 +1938,7 @@ void TQWidgetFactory::createSpacer( const TQDomElement &e, TQLayout *tqlayout ) orient = Qt::Vertical; } else if ( prop == "sizeType" ) { sizeType = stringToSizeType( n.firstChild().firstChild().toText().data() ); - } else if ( prop == "tqsizeHint" ) { + } else if ( prop == "sizeHint" ) { 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 *tqlayout ) colspan = 1; TQSpacerItem *item = new TQSpacerItem( w, h, orient == Qt::Horizontal ? sizeType : TQSizePolicy::Minimum, orient == Qt::Vertical ? sizeType : TQSizePolicy::Minimum ); - if ( tqlayout ) { - if ( tqlayout->inherits( TQBOXLAYOUT_OBJECT_NAME_STRING ) ) - ( (TQBoxLayout*)tqlayout )->addItem( item ); + if ( layout ) { + if ( layout->inherits( TQBOXLAYOUT_OBJECT_NAME_STRING ) ) + ( (TQBoxLayout*)layout )->addItem( item ); else - ( (TQGridLayout*)tqlayout )->addMultiCell( item, row, row + rowspan - 1, col, col + colspan - 1, + ( (TQGridLayout*)layout )->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.tqarg( conn.signal.data() ); + s = s.arg( conn.signal.data() ); TQString s2 = "1""%1"; - s2 = s2.tqarg( conn.slot.data() ); + s2 = s2.arg( conn.slot.data() ); - TQStrList signalList = sender->tqmetaObject()->signalNames( TRUE ); - TQStrList slotList = receiver->tqmetaObject()->slotNames( TRUE ); + TQStrList signalList = sender->metaObject()->signalNames( TRUE ); + TQStrList slotList = receiver->metaObject()->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->tqmetaObject()->slotNames( TRUE ); + slotList = connector->metaObject()->slotNames( TRUE ); receiver = connector; } diff --git a/kdevdesigner/uilib/qwidgetfactory.h b/kdevdesigner/uilib/qwidgetfactory.h index c6770341..8f2b1427 100644 --- a/kdevdesigner/uilib/qwidgetfactory.h +++ b/kdevdesigner/uilib/qwidgetfactory.h @@ -66,12 +66,12 @@ private: void loadImageCollection( const TQDomElement &e ); void loadConnections( const TQDomElement &e, TQObject *connector ); void loadTabOrder( const TQDomElement &e ); - TQWidget *createWidgetInternal( const TQDomElement &e, TQWidget *parent, TQLayout* tqlayout, const TQString &classNameArg ); - TQLayout *createLayout( TQWidget *widget, TQLayout* tqlayout, LayoutType type, bool isTQLayoutWidget = FALSE ); + TQWidget *createWidgetInternal( const TQDomElement &e, TQWidget *parent, TQLayout* layout, const TQString &classNameArg ); + TQLayout *createLayout( TQWidget *widget, TQLayout* layout, LayoutType type, bool isTQLayoutWidget = FALSE ); LayoutType layoutType( TQLayout *l ) const; void setProperty( TQObject* widget, const TQString &prop, TQVariant value ); void setProperty( TQObject* widget, const TQString &prop, const TQDomElement &e ); - void createSpacer( const TQDomElement &e, TQLayout *tqlayout ); + void createSpacer( const TQDomElement &e, TQLayout *layout ); TQImage loadFromCollection( const TQString &name ); TQPixmap loadPixmap( const TQString &name ); TQPixmap loadPixmap( const TQDomElement &e ); |