diff options
Diffstat (limited to 'kdevdesigner/designer/widgetfactory.cpp')
-rw-r--r-- | kdevdesigner/designer/widgetfactory.cpp | 170 |
1 files changed, 85 insertions, 85 deletions
diff --git a/kdevdesigner/designer/widgetfactory.cpp b/kdevdesigner/designer/widgetfactory.cpp index e31f5d82..1cf435e5 100644 --- a/kdevdesigner/designer/widgetfactory.cpp +++ b/kdevdesigner/designer/widgetfactory.cpp @@ -31,7 +31,7 @@ #include "mainwindow.h" #include "formwindow.h" #include "propertyeditor.h" -#include "tqlayout.h" +#include "layout.h" #include "listboxeditorimpl.h" #include "listvieweditorimpl.h" #include "iconvieweditorimpl.h" @@ -64,9 +64,9 @@ #include <tqlineedit.h> #include <tqspinbox.h> #include <tqmultilineedit.h> -#include <tqtextedit.h> +#include <textedit.h> #include <tqlabel.h> -#include <tqlayout.h> +#include <layout.h> #include <tqwidgetstack.h> #include <tqcombobox.h> #include <tqtabbar.h> @@ -77,8 +77,8 @@ #include <tqslider.h> #include <tqdial.h> #include <tqprogressbar.h> -#include <tqtextview.h> -#include <tqtextbrowser.h> +#include <textview.h> +#include <textbrowser.h> #include <tqframe.h> #include <tqmetaobject.h> #include <tqwidgetstack.h> @@ -296,11 +296,11 @@ QDesignerWidgetStack::QDesignerWidgetStack( TQWidget *parent, const char *name ) prev = new TQToolButton( TQt::LeftArrow, this, "designer_wizardstack_button" ); prev->setAutoRaise( TRUE ); prev->setAutoRepeat( TRUE ); - prev->tqsetSizePolicy( TQSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Ignored ) ); + prev->setSizePolicy( TQSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Ignored ) ); next = new TQToolButton( TQt::RightArrow, this, "designer_wizardstack_button" ); next->setAutoRaise( TRUE ); next->setAutoRepeat( TRUE ); - next->tqsetSizePolicy( TQSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Ignored ) ); + next->setSizePolicy( TQSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Ignored ) ); connect( prev, TQT_SIGNAL( clicked() ), this, TQT_SLOT( prevPage() ) ); connect( next, TQT_SIGNAL( clicked() ), this, TQT_SLOT( nextPage() ) ); updateButtons(); @@ -498,7 +498,7 @@ TQMap< int, TQStringList > *changedProperties = 0; void WidgetFactory::saveDefaultProperties( TQObject *w, int id ) { TQMap< TQString, TQVariant> propMap; - TQStrList lst = w->tqmetaObject()->propertyNames( TRUE ); + TQStrList lst = w->metaObject()->propertyNames( TRUE ); for ( uint i = 0; i < lst.count(); ++i ) { TQVariant var = w->property( lst.at( i ) ); if ( !var.isValid() && qstrcmp( "pixmap", lst.at( i ) ) == 0 ) @@ -553,11 +553,11 @@ TQWidget *WidgetFactory::create( int id, TQWidget *parent, const char *name, boo return w; } -/*! Creates a tqlayout on the widget \a widget of the type \a type +/*! Creates a layout on the widget \a widget of the type \a type which can be \c HBox, \c VBox or \c Grid. */ -TQLayout *WidgetFactory::createLayout( TQWidget *widget, TQLayout *tqlayout, LayoutType type ) +TQLayout *WidgetFactory::createLayout( TQWidget *widget, TQLayout *layout, LayoutType type ) { int spacing = MainWindow::self->currentLayoutDefaultSpacing(); int margin = 0; @@ -570,40 +570,40 @@ TQLayout *WidgetFactory::createLayout( TQWidget *widget, TQLayout *tqlayout, Lay widget && ::tqqt_cast<FormWindow*>(widget->parentWidget()) ) ) margin = MainWindow::self->currentLayoutDefaultMargin(); - if ( !tqlayout && ::tqqt_cast<TQTabWidget*>(widget) ) + if ( !layout && ::tqqt_cast<TQTabWidget*>(widget) ) widget = ((TQTabWidget*)widget)->currentPage(); - if ( !tqlayout && ::tqqt_cast<TQWizard*>(widget) ) + if ( !layout && ::tqqt_cast<TQWizard*>(widget) ) widget = ((TQWizard*)widget)->currentPage(); - if ( !tqlayout && ::tqqt_cast<TQMainWindow*>(widget) ) + if ( !layout && ::tqqt_cast<TQMainWindow*>(widget) ) widget = ((TQMainWindow*)widget)->centralWidget(); - if ( !tqlayout && ::tqqt_cast<TQWidgetStack*>(widget) ) + if ( !layout && ::tqqt_cast<TQWidgetStack*>(widget) ) widget = ((TQWidgetStack*)widget)->visibleWidget(); - if ( !tqlayout && ::tqqt_cast<TQToolBox*>(widget) ) + if ( !layout && ::tqqt_cast<TQToolBox*>(widget) ) widget = ((TQToolBox*)widget)->currentItem(); MetaDataBase::addEntry( TQT_TQOBJECT(widget) ); TQLayout *l = 0; int align = 0; - if ( !tqlayout && ::tqqt_cast<TQGroupBox*>(widget) ) { + if ( !layout && ::tqqt_cast<TQGroupBox*>(widget) ) { 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 ); 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 QDesignerGridLayout( tqlayout ); + l = new QDesignerGridLayout( layout ); break; default: return 0; @@ -612,16 +612,16 @@ TQLayout *WidgetFactory::createLayout( TQWidget *widget, TQLayout *tqlayout, Lay MetaDataBase::setMargin( TQT_TQOBJECT(gb), metamargin ); MetaDataBase::setSpacing( TQT_TQOBJECT(gb), metaspacing ); } else { - 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 QDesignerGridLayout( tqlayout ); + l = new QDesignerGridLayout( layout ); break; default: return 0; @@ -653,7 +653,7 @@ TQLayout *WidgetFactory::createLayout( TQWidget *widget, TQLayout *tqlayout, Lay } } } - l->tqsetAlignment( align ); + l->setAlignment( align ); MetaDataBase::addEntry( TQT_TQOBJECT(l) ); return l; } @@ -673,7 +673,7 @@ void WidgetFactory::deleteLayout( TQWidget *widget ) widget = ((TQWidgetStack*)widget)->visibleWidget(); if ( ::tqqt_cast<TQToolBox*>(widget) ) widget = ((TQToolBox*)widget)->currentItem(); - delete widget->tqlayout(); + delete widget->layout(); } /*! Factory functions for creating a widget of the type \a className @@ -690,7 +690,7 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare TQPushButton *b = 0; if ( init ) { b = new QDesignerPushButton( parent, name ); - b->setText( TQString::tqfromLatin1( name ) ); + b->setText( TQString::fromLatin1( name ) ); } else { b = new QDesignerPushButton( parent, name ); } @@ -714,24 +714,24 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare } else if ( className == TQCHECKBOX_OBJECT_NAME_STRING ) { if ( init ) { QDesignerCheckBox *cb = new QDesignerCheckBox( parent, name ); - cb->setText( TQString::tqfromLatin1( name ) ); + cb->setText( TQString::fromLatin1( name ) ); return cb; } return new QDesignerCheckBox( parent, name ); } else if ( className == TQRADIOBUTTON_OBJECT_NAME_STRING ) { if ( init ) { QDesignerRadioButton *rb = new QDesignerRadioButton( parent, name ); - rb->setText( TQString::tqfromLatin1( name ) ); + rb->setText( TQString::fromLatin1( name ) ); return rb; } return new QDesignerRadioButton( parent, name ); } else if ( className == TQGROUPBOX_OBJECT_NAME_STRING ) { if ( init ) - return new TQGroupBox( TQString::tqfromLatin1( name ), parent, name ); + return new TQGroupBox( TQString::fromLatin1( name ), parent, name ); return new TQGroupBox( parent, name ); } else if ( className == TQBUTTONGROUP_OBJECT_NAME_STRING ) { if ( init ) - return new TQButtonGroup( TQString::tqfromLatin1( name ), parent, name ); + return new TQButtonGroup( TQString::fromLatin1( name ), parent, name ); return new TQButtonGroup( parent, name ); } else if ( className == TQICONVIEW_OBJECT_NAME_STRING ) { #if !defined(TQT_NO_ICONVIEW) @@ -789,7 +789,7 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare else if ( className == TQLABEL_OBJECT_NAME_STRING || className == "TextLabel" ) { QDesignerLabel *l = new QDesignerLabel( parent, name ); if ( init ) { - l->setText( TQString::tqfromLatin1( name ) ); + l->setText( TQString::fromLatin1( name ) ); MetaDataBase::addEntry( TQT_TQOBJECT(l) ); MetaDataBase::setPropertyChanged( TQT_TQOBJECT(l), "text", TRUE ); } @@ -1001,14 +1001,14 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare -/*! Find out which type the tqlayout of the widget is. Returns \c HBox, - \c VBox, \c Grid or \c NoLayout. \a tqlayout points to this - TQWidget::tqlayout() of \a w or to 0 after the function call. +/*! Find out which type the layout of the widget is. Returns \c HBox, + \c VBox, \c Grid or \c NoLayout. \a layout points to this + TQWidget::layout() of \a w or to 0 after the function call. */ -WidgetFactory::LayoutType WidgetFactory::layoutType( TQWidget *w, TQLayout *&tqlayout ) +WidgetFactory::LayoutType WidgetFactory::layoutType( TQWidget *w, TQLayout *&layout ) { - tqlayout = 0; + layout = 0; if ( ::tqqt_cast<TQTabWidget*>(w) ) w = ((TQTabWidget*)w)->currentPage(); @@ -1024,9 +1024,9 @@ WidgetFactory::LayoutType WidgetFactory::layoutType( TQWidget *w, TQLayout *&tql if ( ::tqqt_cast<TQSplitter*>(w) ) return ( (TQSplitter*)w )->orientation() ==Qt::Horizontal ? HBox : VBox; - if ( !w || !w->tqlayout() ) + if ( !w || !w->layout() ) return NoLayout; - TQLayout *lay = w->tqlayout(); + TQLayout *lay = w->layout(); if ( ::tqqt_cast<TQGroupBox*>(w) ) { TQObjectList *l = TQT_TQOBJECT(lay)->queryList( TQLAYOUT_OBJECT_NAME_STRING ); @@ -1034,7 +1034,7 @@ WidgetFactory::LayoutType WidgetFactory::layoutType( TQWidget *w, TQLayout *&tql lay = (TQLayout*)l->first(); delete l; } - tqlayout = lay; + layout = lay; if ( ::tqqt_cast<TQHBoxLayout*>(lay) ) return HBox; @@ -1048,13 +1048,13 @@ WidgetFactory::LayoutType WidgetFactory::layoutType( TQWidget *w, TQLayout *&tql /*! \overload */ -WidgetFactory::LayoutType WidgetFactory::layoutType( TQLayout *tqlayout ) +WidgetFactory::LayoutType WidgetFactory::layoutType( TQLayout *layout ) { - if ( ::tqqt_cast<TQHBoxLayout*>(tqlayout) ) + if ( ::tqqt_cast<TQHBoxLayout*>(layout) ) return HBox; - else if ( ::tqqt_cast<TQVBoxLayout*>(tqlayout) ) + else if ( ::tqqt_cast<TQVBoxLayout*>(layout) ) return VBox; - else if ( ::tqqt_cast<TQGridLayout*>(tqlayout) ) + else if ( ::tqqt_cast<TQGridLayout*>(layout) ) return Grid; return NoLayout; } @@ -1069,9 +1069,9 @@ WidgetFactory::LayoutType WidgetFactory::layoutType( TQWidget *w ) } -TQWidget *WidgetFactory::layoutParent( TQLayout *tqlayout ) +TQWidget *WidgetFactory::layoutParent( TQLayout *layout ) { - TQObject *o = TQT_TQOBJECT(tqlayout); + TQObject *o = TQT_TQOBJECT(layout); while ( o ) { if ( o->isWidgetType() ) return (TQWidget*)o; @@ -1080,7 +1080,7 @@ TQWidget *WidgetFactory::layoutParent( TQLayout *tqlayout ) return 0; } -/*! Returns the widget into which tqchildren should be inserted when \a +/*! Returns the widget into which children should be inserted when \a w is a container known to the designer. Usually that is \a w itself, sometimes it is different (e.g. a @@ -1469,7 +1469,7 @@ bool WidgetFactory::canResetProperty( TQObject *w, const TQString &propName ) bool WidgetFactory::resetProperty( TQObject *w, const TQString &propName ) { - const TQMetaProperty *p = w->tqmetaObject()->property( w->tqmetaObject()-> + const TQMetaProperty *p = w->metaObject()->property( w->metaObject()-> findProperty( propName, TRUE ), TRUE ); if (!p ) return FALSE; @@ -1479,10 +1479,10 @@ bool WidgetFactory::resetProperty( TQObject *w, const TQString &propName ) TQVariant WidgetFactory::defaultValue( TQObject *w, const TQString &propName ) { if ( propName == "wordwrap" ) { - int v = defaultValue( w, "tqalignment" ).toInt(); + int v = defaultValue( w, "alignment" ).toInt(); return TQVariant( ( v & WordBreak ) == WordBreak, 0 ); } else if ( propName == "toolTip" || propName == "whatsThis" ) { - return TQVariant( TQString::tqfromLatin1( "" ) ); + return TQVariant( TQString::fromLatin1( "" ) ); } else if ( w->inherits( "CustomWidget" ) ) { return TQVariant(); } else if ( propName == "frameworkCode" ) { @@ -1496,10 +1496,10 @@ TQVariant WidgetFactory::defaultValue( TQObject *w, const TQString &propName ) TQString WidgetFactory::defaultCurrentItem( TQObject *w, const TQString &propName ) { - const TQMetaProperty *p = w->tqmetaObject()-> - property( w->tqmetaObject()->findProperty( propName, TRUE ), TRUE ); + const TQMetaProperty *p = w->metaObject()-> + property( w->metaObject()->findProperty( propName, TRUE ), TRUE ); if ( !p ) { - int v = defaultValue( w, "tqalignment" ).toInt(); + int v = defaultValue( w, "alignment" ).toInt(); if ( propName == "hAlign" ) { if ( ( v & AlignAuto ) == AlignAuto ) return "AlignAuto"; @@ -1536,8 +1536,8 @@ TQWidget *WidgetFactory::createCustomWidget( TQWidget *parent, const char *name, TQVariant WidgetFactory::property( TQObject *w, const char *name ) { - int id = w->tqmetaObject()->findProperty( name, TRUE ); - const TQMetaProperty* p = w->tqmetaObject()->property( id, TRUE ); + int id = w->metaObject()->findProperty( name, TRUE ); + const TQMetaProperty* p = w->metaObject()->property( id, TRUE ); if ( !p || !p->isValid() ) return MetaDataBase::fakeProperty( w, name ); return w->property( name ); @@ -1549,7 +1549,7 @@ void QDesignerLabel::updateBuddy() if ( myBuddy.isEmpty() ) return; - TQObjectList *l = tqtopLevelWidget()->queryList( TQWIDGET_OBJECT_NAME_STRING, myBuddy, FALSE, TRUE ); + TQObjectList *l = topLevelWidget()->queryList( TQWIDGET_OBJECT_NAME_STRING, myBuddy, FALSE, TRUE ); if ( !l || !l->first() ) { delete l; return; @@ -1601,13 +1601,13 @@ bool TQLayoutWidget::event( TQEvent *e ) /* This function must be called on TQLayoutWidget creation and whenever - the TQLayoutWidget's parent tqlayout changes (e.g., from a TQHBoxLayout + the TQLayoutWidget's parent layout changes (e.g., from a TQHBoxLayout to a TQVBoxLayout), because of the (illogical) way layouting works. */ void TQLayoutWidget::updateSizePolicy() { if ( childrenListObject().isEmpty() || childrenListObject().count() == 0 ) { - sp = TQWidget::tqsizePolicy(); + sp = TQWidget::sizePolicy(); return; } @@ -1624,14 +1624,14 @@ void TQLayoutWidget::updateSizePolicy() int ht = (int) TQSizePolicy::Preferred; int vt = (int) TQSizePolicy::Preferred; - if ( tqlayout() ) { + if ( layout() ) { /* - parentLayout is set to the parent tqlayout if there is one and if it is + parentLayout is set to the parent layout if there is one and if it is top level, in which case layouting is illogical. */ TQLayout *parentLayout = 0; if ( parent() && parent()->isWidgetType() ) { - parentLayout = ((TQWidget *)parent())->tqlayout(); + parentLayout = ((TQWidget *)parent())->layout(); if ( parentLayout && ::tqqt_cast<TQLayoutWidget*>(parentLayout->mainWidget()) ) parentLayout = 0; @@ -1640,7 +1640,7 @@ void TQLayoutWidget::updateSizePolicy() TQObjectListIt it( childrenListObject() ); TQObject *o; - if ( ::tqqt_cast<TQVBoxLayout*>(tqlayout()) ) { + if ( ::tqqt_cast<TQVBoxLayout*>(layout()) ) { if ( ::tqqt_cast<TQHBoxLayout*>(parentLayout) ) vt = TQSizePolicy::Minimum; else @@ -1652,16 +1652,16 @@ void TQLayoutWidget::updateSizePolicy() continue; TQWidget *w = (TQWidget*)o; - if ( !w->tqsizePolicy().mayGrowHorizontally() ) + if ( !w->sizePolicy().mayGrowHorizontally() ) ht &= ~TQSizePolicy::Minimum; - if ( !w->tqsizePolicy().mayShrinkHorizontally() ) + if ( !w->sizePolicy().mayShrinkHorizontally() ) ht &= ~TQSizePolicy::Maximum; - if ( w->tqsizePolicy().mayGrowVertically() ) + if ( w->sizePolicy().mayGrowVertically() ) vt |= TQSizePolicy::Minimum; - if ( w->tqsizePolicy().mayShrinkVertically() ) + if ( w->sizePolicy().mayShrinkVertically() ) vt |= TQSizePolicy::Maximum; } - } else if ( ::tqqt_cast<TQHBoxLayout*>(tqlayout()) ) { + } else if ( ::tqqt_cast<TQHBoxLayout*>(layout()) ) { if ( ::tqqt_cast<TQVBoxLayout*>(parentLayout) ) ht = TQSizePolicy::Minimum; else @@ -1673,16 +1673,16 @@ void TQLayoutWidget::updateSizePolicy() continue; TQWidget *w = (TQWidget*)o; - if ( w->tqsizePolicy().mayGrowHorizontally() ) + if ( w->sizePolicy().mayGrowHorizontally() ) ht |= TQSizePolicy::Minimum; - if ( w->tqsizePolicy().mayShrinkHorizontally() ) + if ( w->sizePolicy().mayShrinkHorizontally() ) ht |= TQSizePolicy::Maximum; - if ( !w->tqsizePolicy().mayGrowVertically() ) + if ( !w->sizePolicy().mayGrowVertically() ) vt &= ~TQSizePolicy::Minimum; - if ( !w->tqsizePolicy().mayShrinkVertically() ) + if ( !w->sizePolicy().mayShrinkVertically() ) vt &= ~TQSizePolicy::Maximum; } - } else if ( ::tqqt_cast<TQGridLayout*>(tqlayout()) ) { + } else if ( ::tqqt_cast<TQGridLayout*>(layout()) ) { ht = TQSizePolicy::Fixed; vt = TQSizePolicy::Fixed; if ( parentLayout ) { @@ -1698,30 +1698,30 @@ void TQLayoutWidget::updateSizePolicy() continue; TQWidget *w = (TQWidget*)o; - if ( w->tqsizePolicy().mayGrowHorizontally() ) + if ( w->sizePolicy().mayGrowHorizontally() ) ht |= TQSizePolicy::Minimum; - if ( w->tqsizePolicy().mayShrinkHorizontally() ) + if ( w->sizePolicy().mayShrinkHorizontally() ) ht |= TQSizePolicy::Maximum; - if ( w->tqsizePolicy().mayGrowVertically() ) + if ( w->sizePolicy().mayGrowVertically() ) vt |= TQSizePolicy::Minimum; - if ( w->tqsizePolicy().mayShrinkVertically() ) + if ( w->sizePolicy().mayShrinkVertically() ) vt |= TQSizePolicy::Maximum; } } #ifdef USE_QT4 - if ( tqlayout()->expandingDirections() & TQSizePolicy::Horizontally ) + if ( layout()->expanding() & TQSizePolicy::Horizontally ) #else // USE_QT4 - if ( tqlayout()->expanding() & TQSizePolicy::Horizontally ) + if ( layout()->expanding() & TQSizePolicy::Horizontally ) #endif // USE_QT4 ht = TQSizePolicy::Expanding; #ifdef USE_QT4 - if ( tqlayout()->expandingDirections() & TQSizePolicy::Vertically ) + if ( layout()->expanding() & TQSizePolicy::Vertically ) #else // USE_QT4 - if ( tqlayout()->expanding() & TQSizePolicy::Vertically ) + if ( layout()->expanding() & TQSizePolicy::Vertically ) #endif // USE_QT4 vt = TQSizePolicy::Expanding; - tqlayout()->tqinvalidate(); + layout()->invalidate(); } sp = TQSizePolicy( (TQSizePolicy::SizeType) ht, (TQSizePolicy::SizeType) vt ); @@ -1734,8 +1734,8 @@ void CustomWidget::paintEvent( TQPaintEvent *e ) ( (FormWindow*)parentWidget() )->paintGrid( this, e ); } else { TQPainter p( this ); - p.fillRect( rect(), tqcolorGroup().dark() ); - p.setPen( tqcolorGroup().light() ); + p.fillRect( rect(), colorGroup().dark() ); + p.setPen( colorGroup().light() ); p.drawText( 2, 2, width() - 4, height() - 4, TQt::AlignAuto | TQt::AlignTop, cusw->className ); p.drawPixmap( ( width() - cusw->pixmap->width() ) / 2, ( height() - cusw->pixmap->height() ) / 2, |