diff options
Diffstat (limited to 'kommander/factory')
-rw-r--r-- | kommander/factory/kommanderfactory.cpp | 108 | ||||
-rw-r--r-- | kommander/factory/kommanderfactory.h | 6 |
2 files changed, 57 insertions, 57 deletions
diff --git a/kommander/factory/kommanderfactory.cpp b/kommander/factory/kommanderfactory.cpp index 03b82473..a1e45f06 100644 --- a/kommander/factory/kommanderfactory.cpp +++ b/kommander/factory/kommanderfactory.cpp @@ -497,7 +497,7 @@ FeatureList KommanderFactory::featureList() //iterate through widgetPlugins, appending KommanderPlugin::widgets() to features } -TQWidget *KommanderFactory::createWidgetInternal( const TQDomElement &e, TQWidget *parent, TQLayout* tqlayout, const TQString &classNameArg ) +TQWidget *KommanderFactory::createWidgetInternal( const TQDomElement &e, TQWidget *parent, TQLayout* layout, const TQString &classNameArg ) { lastItem = 0; TQDomElement n = e.firstChild().toElement(); @@ -515,10 +515,10 @@ TQWidget *KommanderFactory::createWidgetInternal( const TQDomElement &e, TQWidge if ( colspan < 1 ) colspan = 1; if ( !className.isEmpty() ) { - if ( !tqlayout && className == TQLAYOUTWIDGET_OBJECT_NAME_STRING ) + if ( !layout && className == TQLAYOUTWIDGET_OBJECT_NAME_STRING ) className = TQWIDGET_OBJECT_NAME_STRING; - 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(KommanderFactory::createWidget( className, parent, 0 )); @@ -531,16 +531,16 @@ TQWidget *KommanderFactory::createWidgetInternal( const TQDomElement &e, TQWidge 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: @@ -548,7 +548,7 @@ TQWidget *KommanderFactory::createWidgetInternal( const TQDomElement &e, TQWidge } } - tqlayout = 0; + layout = 0; } } if (className == "Dialog") @@ -556,43 +556,43 @@ TQWidget *KommanderFactory::createWidgetInternal( const TQDomElement &e, TQWidge 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, KommanderFactory::HBox ); + TQLayout *parentLayout = layout; + if ( layout && layout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + layout = createLayout( 0, 0, KommanderFactory::HBox ); else - tqlayout = createLayout( w, tqlayout, KommanderFactory::HBox ); - obj = TQT_TQOBJECT(tqlayout); + layout = createLayout( w, layout, KommanderFactory::HBox ); + obj = TQT_TQOBJECT(layout); n = n.firstChild().toElement(); if ( parentLayout && parentLayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - ( (TQGridLayout*)parentLayout )->addMultiCellLayout( tqlayout, row, row + rowspan - 1, col, col + colspan - 1 ); + ( (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, KommanderFactory::Grid ); + TQLayout *parentLayout = layout; + if ( layout && layout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + layout = createLayout( 0, 0, KommanderFactory::Grid ); else - tqlayout = createLayout( w, tqlayout, KommanderFactory::Grid ); - obj = TQT_TQOBJECT(tqlayout); + layout = createLayout( w, layout, KommanderFactory::Grid ); + obj = TQT_TQOBJECT(layout); n = n.firstChild().toElement(); if ( parentLayout && parentLayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - ( (TQGridLayout*)parentLayout )->addMultiCellLayout( tqlayout, row, row + rowspan - 1, col, col + colspan - 1 ); + ( (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, KommanderFactory::VBox ); + TQLayout *parentLayout = layout; + if ( layout && layout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + layout = createLayout( 0, 0, KommanderFactory::VBox ); else - tqlayout = createLayout( w, tqlayout, KommanderFactory::VBox ); - obj = TQT_TQOBJECT(tqlayout); + layout = createLayout( w, layout, KommanderFactory::VBox ); + obj = TQT_TQOBJECT(layout); n = n.firstChild().toElement(); if ( parentLayout && parentLayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) - ( (TQGridLayout*)parentLayout )->addMultiCellLayout( tqlayout, row, row + rowspan - 1, col, col + colspan - 1 ); + ( (TQGridLayout*)parentLayout )->addMultiCellLayout( layout, row, row + rowspan - 1, col, col + colspan - 1 ); continue; } else if ( n.tagName() == "property" && obj ) { setProperty( obj, n.attribute( "name" ), n.firstChild().toElement() ); @@ -622,60 +622,60 @@ TQWidget *KommanderFactory::createWidgetInternal( const TQDomElement &e, TQWidge return w; } -TQLayout *KommanderFactory::createLayout( TQWidget *widget, TQLayout* tqlayout, LayoutType type ) +TQLayout *KommanderFactory::createLayout( TQWidget *widget, TQLayout* layout, LayoutType type ) { int spacing = defSpacing; int margin = defMargin; - 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( TQTOOLBOX_OBJECT_NAME_STRING ) ) + if ( !layout && widget && widget->inherits( TQTOOLBOX_OBJECT_NAME_STRING ) ) widget = ((TQToolBox*)widget)->currentItem(); - 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( TQGROUPBOX_OBJECT_NAME_STRING ) ) { + if ( !layout && widget && widget->inherits( TQGROUPBOX_OBJECT_NAME_STRING ) ) { TQGroupBox *gb = (TQGroupBox*)widget; gb->setColumnLayout( 0, Qt::Vertical ); - gb->tqlayout()->setMargin( 0 ); - gb->tqlayout()->setSpacing( 0 ); + gb->layout()->setMargin( 0 ); + gb->layout()->setSpacing( 0 ); TQLayout *l; switch ( type ) { case HBox: - l = new TQHBoxLayout( gb->tqlayout() ); + l = new TQHBoxLayout( gb->layout() ); l->setAlignment( TQt::AlignTop ); return l; case VBox: - l = new TQVBoxLayout( gb->tqlayout(), spacing ); + l = new TQVBoxLayout( gb->layout(), spacing ); l->setAlignment( TQt::AlignTop ); return l; case Grid: - l = new TQGridLayout( gb->tqlayout() ); + l = new TQGridLayout( gb->layout() ); l->setAlignment( TQt::AlignTop ); return l; default: return 0; } } else { - if ( tqlayout ) { + if ( layout ) { TQLayout *l; switch ( type ) { case HBox: - l = new TQHBoxLayout( tqlayout ); + l = new TQHBoxLayout( layout ); l->setSpacing( spacing ); l->setMargin( margin ); return l; case VBox: - l = new TQVBoxLayout( tqlayout ); + l = new TQVBoxLayout( layout ); l->setSpacing( spacing ); l->setMargin( margin ); return l; case Grid: { - l = new TQGridLayout( tqlayout ); + l = new TQGridLayout( layout ); l->setSpacing( spacing ); l->setMargin( margin ); return l; @@ -715,13 +715,13 @@ TQLayout *KommanderFactory::createLayout( TQWidget *widget, TQLayout* tqlayout, } } -KommanderFactory::LayoutType KommanderFactory::layoutType( TQLayout *tqlayout ) const +KommanderFactory::LayoutType KommanderFactory::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; } @@ -840,7 +840,7 @@ void KommanderFactory::setProperty( TQObject* obj, const TQString &prop, const T obj->setProperty( prop, v ); } -void KommanderFactory::createSpacer( const TQDomElement &e, TQLayout *tqlayout ) +void KommanderFactory::createSpacer( const TQDomElement &e, TQLayout *layout ) { TQDomElement n = e.firstChild().toElement(); int row = e.attribute( "row" ).toInt(); @@ -886,11 +886,11 @@ void KommanderFactory::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 ); } } diff --git a/kommander/factory/kommanderfactory.h b/kommander/factory/kommanderfactory.h index 9b38ae9e..609d0a73 100644 --- a/kommander/factory/kommanderfactory.h +++ b/kommander/factory/kommanderfactory.h @@ -74,11 +74,11 @@ 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 ); + TQWidget *createWidgetInternal( const TQDomElement &e, TQWidget *parent, TQLayout* layout, const TQString &classNameArg ); + TQLayout *createLayout( TQWidget *widget, TQLayout* layout, LayoutType type ); LayoutType layoutType( TQLayout *l ) const; 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 TQDomElement &e ); TQColorGroup loadColorGroup( const TQDomElement &e ); |