diff options
Diffstat (limited to 'kdevdesigner/designer/widgetfactory.cpp')
-rw-r--r-- | kdevdesigner/designer/widgetfactory.cpp | 664 |
1 files changed, 324 insertions, 340 deletions
diff --git a/kdevdesigner/designer/widgetfactory.cpp b/kdevdesigner/designer/widgetfactory.cpp index 9423b6a6..595cae71 100644 --- a/kdevdesigner/designer/widgetfactory.cpp +++ b/kdevdesigner/designer/widgetfactory.cpp @@ -107,7 +107,7 @@ FormWindow *find_formwindow( TQWidget *w ) if ( !w ) return 0; for (;;) { - if ( ::tqqt_cast<FormWindow*>(w) ) + if ( ::tqt_cast<FormWindow*>(w) ) return (FormWindow*)w; if ( !w->parentWidget() ) return 0; @@ -124,9 +124,9 @@ void TQLayoutWidget::paintEvent( TQPaintEvent* ) QDesignerTabWidget::QDesignerTabWidget( TQWidget *parent, const char *name ) - : TQTabWidget( parent, name ), dropIndicator( 0 ), dragPage( 0 ), mousePressed( FALSE ) + : TQTabWidget( parent, name ), dropIndicator( 0 ), dragPage( 0 ), mousePressed( false ) { - tabBar()->setAcceptDrops( TRUE ); + tabBar()->setAcceptDrops( true ); tabBar()->installEventFilter( this ); } @@ -170,11 +170,11 @@ int QDesignerTabWidget::count() const bool QDesignerTabWidget::eventFilter( TQObject *o, TQEvent *e ) { - if ( TQT_BASE_OBJECT(o) != TQT_BASE_OBJECT(tabBar()) ) return FALSE; + if ( o != tabBar() ) return false; switch ( e->type() ) { case TQEvent::MouseButtonPress: { - mousePressed = TRUE; + mousePressed = true; TQMouseEvent *me = (TQMouseEvent*)e; pressPoint = me->pos(); } @@ -183,7 +183,7 @@ bool QDesignerTabWidget::eventFilter( TQObject *o, TQEvent *e ) TQMouseEvent *me = (TQMouseEvent*)e; if ( mousePressed && ( pressPoint - me->pos()).manhattanLength() > TQApplication::startDragDistance() ) { TQTextDrag *drg = new TQTextDrag( TQString::number( (long) this ) , this ); - mousePressed = FALSE; + mousePressed = false; dragPage = TQTabWidget::currentPage(); dragLabel = TQTabWidget::tabLabel( dragPage ); @@ -212,7 +212,7 @@ bool QDesignerTabWidget::eventFilter( TQObject *o, TQEvent *e ) if ( text == TQString::number( (long)this ) ) de->accept(); else - return FALSE; + return false; } int index = 0; @@ -286,7 +286,7 @@ bool QDesignerTabWidget::eventFilter( TQObject *o, TQEvent *e ) default: break; } - return FALSE; + return false; } @@ -294,15 +294,15 @@ QDesignerWidgetStack::QDesignerWidgetStack( TQWidget *parent, const char *name ) : TQWidgetStack( parent, name ) { prev = new TQToolButton( TQt::LeftArrow, this, "designer_wizardstack_button" ); - prev->setAutoRaise( TRUE ); - prev->setAutoRepeat( TRUE ); + prev->setAutoRaise( true ); + prev->setAutoRepeat( true ); prev->setSizePolicy( TQSizePolicy( TQSizePolicy::Ignored, TQSizePolicy::Ignored ) ); next = new TQToolButton( TQt::RightArrow, this, "designer_wizardstack_button" ); - next->setAutoRaise( TRUE ); - next->setAutoRepeat( TRUE ); + next->setAutoRaise( true ); + next->setAutoRepeat( true ); 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() ) ); + connect( prev, TQ_SIGNAL( clicked() ), this, TQ_SLOT( prevPage() ) ); + connect( next, TQ_SIGNAL( clicked() ), this, TQ_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->metaObject()->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 ) @@ -517,12 +517,12 @@ void WidgetFactory::saveChangedProperties( TQObject *w, int id ) } /*! Creates a widget of the type which is registered as \a id as - child of \a parent. The \a name is optional. If \a init is TRUE, the + child of \a parent. The \a name is optional. If \a init is true, the widget is initialized with some defaults, else the plain widget is created. */ -TQWidget *WidgetFactory::create( int id, TQWidget *parent, const char *name, bool init, const TQRect *r, Qt::Orientation orient ) +TQWidget *WidgetFactory::create( int id, TQWidget *parent, const char *name, bool init, const TQRect *r, TQt::Orientation orient ) { TQString n = WidgetDatabase::className( id ); if ( n.isEmpty() ) @@ -537,18 +537,18 @@ TQWidget *WidgetFactory::create( int id, TQWidget *parent, const char *name, boo TQString str = WidgetDatabase::createWidgetName( id ); const char *s = str.latin1(); w = createWidget( n, parent, name ? name : s, init, r, orient ); - if ( ::tqqt_cast<TQScrollView*>(w) ) + if ( ::tqt_cast<TQScrollView*>(w) ) ( (TQScrollView*)w )->disableSizeHintCaching(); if ( !w && WidgetDatabase::isCustomWidget( id ) ) w = createCustomWidget( parent, name ? name : s, MetaDataBase::customWidget( id ) ); if ( !w ) return 0; - MetaDataBase::addEntry( TQT_TQOBJECT(w) ); + MetaDataBase::addEntry( w ); if ( !defaultProperties->contains( id ) ) - saveDefaultProperties( TQT_TQOBJECT(w), id ); + saveDefaultProperties( w, id ); if ( !changedProperties->contains( id ) ) - saveChangedProperties( TQT_TQOBJECT(w), id ); + saveChangedProperties( w, id ); return w; } @@ -562,36 +562,36 @@ TQLayout *WidgetFactory::createLayout( TQWidget *widget, TQLayout *layout, Layou int spacing = MainWindow::self->currentLayoutDefaultSpacing(); int margin = 0; - int metaspacing = MetaDataBase::spacing( TQT_TQOBJECT(widget) ); - int metamargin = MetaDataBase::margin( TQT_TQOBJECT(widget) ); + int metaspacing = MetaDataBase::spacing( widget ); + int metamargin = MetaDataBase::margin( widget ); - if ( ::tqqt_cast<TQLayoutWidget*>(widget) && - ( WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( TQT_TQOBJECT(widget) ) ) ) || - widget && ::tqqt_cast<FormWindow*>(widget->parentWidget()) ) ) + if ( ::tqt_cast<TQLayoutWidget*>(widget) && + ( WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( widget ) ) ) || + widget && ::tqt_cast<FormWindow*>(widget->parentWidget()) ) ) margin = MainWindow::self->currentLayoutDefaultMargin(); - if ( !layout && ::tqqt_cast<TQTabWidget*>(widget) ) + if ( !layout && ::tqt_cast<TQTabWidget*>(widget) ) widget = ((TQTabWidget*)widget)->currentPage(); - if ( !layout && ::tqqt_cast<TQWizard*>(widget) ) + if ( !layout && ::tqt_cast<TQWizard*>(widget) ) widget = ((TQWizard*)widget)->currentPage(); - if ( !layout && ::tqqt_cast<TQMainWindow*>(widget) ) + if ( !layout && ::tqt_cast<TQMainWindow*>(widget) ) widget = ((TQMainWindow*)widget)->centralWidget(); - if ( !layout && ::tqqt_cast<TQWidgetStack*>(widget) ) + if ( !layout && ::tqt_cast<TQWidgetStack*>(widget) ) widget = ((TQWidgetStack*)widget)->visibleWidget(); - if ( !layout && ::tqqt_cast<TQToolBox*>(widget) ) + if ( !layout && ::tqt_cast<TQToolBox*>(widget) ) widget = ((TQToolBox*)widget)->currentItem(); - MetaDataBase::addEntry( TQT_TQOBJECT(widget) ); + MetaDataBase::addEntry( widget ); TQLayout *l = 0; int align = 0; - if ( !layout && ::tqqt_cast<TQGroupBox*>(widget) ) { + if ( !layout && ::tqt_cast<TQGroupBox*>(widget) ) { TQGroupBox *gb = (TQGroupBox*)widget; - gb->setColumnLayout( 0, Qt::Vertical ); + gb->setColumnLayout( 0, TQt::Vertical ); layout = gb->layout(); layout->setMargin( 0 ); layout->setSpacing( 0 ); @@ -609,8 +609,8 @@ TQLayout *WidgetFactory::createLayout( TQWidget *widget, TQLayout *layout, Layou return 0; } align = TQt::AlignTop; - MetaDataBase::setMargin( TQT_TQOBJECT(gb), metamargin ); - MetaDataBase::setSpacing( TQT_TQOBJECT(gb), metaspacing ); + MetaDataBase::setMargin( gb, metamargin ); + MetaDataBase::setSpacing( gb, metaspacing ); } else { if ( layout ) { switch ( type ) { @@ -626,7 +626,7 @@ TQLayout *WidgetFactory::createLayout( TQWidget *widget, TQLayout *layout, Layou default: return 0; } - MetaDataBase::addEntry( TQT_TQOBJECT(l) ); + MetaDataBase::addEntry( l ); l->setSpacing( spacing ); l->setMargin( margin ); } else { @@ -643,10 +643,10 @@ TQLayout *WidgetFactory::createLayout( TQWidget *widget, TQLayout *layout, Layou default: return 0; } - MetaDataBase::addEntry( TQT_TQOBJECT(l) ); + MetaDataBase::addEntry( l ); if ( widget ) { - MetaDataBase::setMargin( TQT_TQOBJECT(widget), metamargin ); - MetaDataBase::setSpacing( TQT_TQOBJECT(widget), metaspacing ); + MetaDataBase::setMargin( widget, metamargin ); + MetaDataBase::setSpacing( widget, metaspacing ); } else { l->setMargin( margin ); l->setSpacing( spacing ); @@ -654,7 +654,7 @@ TQLayout *WidgetFactory::createLayout( TQWidget *widget, TQLayout *layout, Layou } } l->setAlignment( align ); - MetaDataBase::addEntry( TQT_TQOBJECT(l) ); + MetaDataBase::addEntry( l ); return l; } @@ -663,15 +663,15 @@ void WidgetFactory::deleteLayout( TQWidget *widget ) if ( !widget ) return; - if ( ::tqqt_cast<TQTabWidget*>(widget) ) + if ( ::tqt_cast<TQTabWidget*>(widget) ) widget = ((TQTabWidget*)widget)->currentPage(); - if ( ::tqqt_cast<TQWizard*>(widget) ) + if ( ::tqt_cast<TQWizard*>(widget) ) widget = ((TQWizard*)widget)->currentPage(); - if ( ::tqqt_cast<TQMainWindow*>(widget) ) + if ( ::tqt_cast<TQMainWindow*>(widget) ) widget = ((TQMainWindow*)widget)->centralWidget(); - if ( ::tqqt_cast<TQWidgetStack*>(widget) ) + if ( ::tqt_cast<TQWidgetStack*>(widget) ) widget = ((TQWidgetStack*)widget)->visibleWidget(); - if ( ::tqqt_cast<TQToolBox*>(widget) ) + if ( ::tqt_cast<TQToolBox*>(widget) ) widget = ((TQToolBox*)widget)->currentItem(); delete widget->layout(); } @@ -679,14 +679,14 @@ void WidgetFactory::deleteLayout( TQWidget *widget ) /*! Factory functions for creating a widget of the type \a className as child of \a parent with the name \a name. - If \a init is TRUE, some initial default properties are set. This + If \a init is true, some initial default properties are set. This has to be in sync with the initChangedProperties() function! */ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *parent, const char *name, bool init, - const TQRect *r, Qt::Orientation orient ) + const TQRect *r, TQt::Orientation orient ) { - if ( className == TQPUSHBUTTON_OBJECT_NAME_STRING ) { + if ( className == "TQPushButton" ) { TQPushButton *b = 0; if ( init ) { b = new QDesignerPushButton( parent, name ); @@ -695,15 +695,15 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare b = new QDesignerPushButton( parent, name ); } TQWidget *w = find_formwindow( b ); - b->setAutoDefault( w && ::tqqt_cast<TQDialog*>(((FormWindow*)w)->mainContainer()) ); + b->setAutoDefault( w && ::tqt_cast<TQDialog*>(((FormWindow*)w)->mainContainer()) ); return b; - } else if ( className == TQTOOLBUTTON_OBJECT_NAME_STRING ) { + } else if ( className == "TQToolButton" ) { if ( init ) { QDesignerToolButton *tb = new QDesignerToolButton( parent, name ); - if ( ::tqqt_cast<TQToolBox*>(widgetOfContainer(parent))) { - tb->setUsesTextLabel(TRUE); + if ( ::tqt_cast<TQToolBox*>(widgetOfContainer(parent))) { + tb->setUsesTextLabel(true); tb->setTextLabel("..."); - tb->setAutoRaise(TRUE); + tb->setAutoRaise(true); tb->setTextPosition(TQToolButton::BesideIcon); } else { tb->setText( "..." ); @@ -711,29 +711,29 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare return tb; } return new QDesignerToolButton( parent, name ); - } else if ( className == TQCHECKBOX_OBJECT_NAME_STRING ) { + } else if ( className == "TQCheckBox" ) { if ( init ) { QDesignerCheckBox *cb = new QDesignerCheckBox( parent, name ); cb->setText( TQString::fromLatin1( name ) ); return cb; } return new QDesignerCheckBox( parent, name ); - } else if ( className == TQRADIOBUTTON_OBJECT_NAME_STRING ) { + } else if ( className == "TQRadioButton" ) { if ( init ) { QDesignerRadioButton *rb = new QDesignerRadioButton( parent, name ); rb->setText( TQString::fromLatin1( name ) ); return rb; } return new QDesignerRadioButton( parent, name ); - } else if ( className == TQGROUPBOX_OBJECT_NAME_STRING ) { + } else if ( className == "TQGroupBox" ) { if ( init ) return new TQGroupBox( TQString::fromLatin1( name ), parent, name ); return new TQGroupBox( parent, name ); - } else if ( className == TQBUTTONGROUP_OBJECT_NAME_STRING ) { + } else if ( className == "TQButtonGroup" ) { if ( init ) return new TQButtonGroup( TQString::fromLatin1( name ), parent, name ); return new TQButtonGroup( parent, name ); - } else if ( className == TQICONVIEW_OBJECT_NAME_STRING ) { + } else if ( className == "TQIconView" ) { #if !defined(TQT_NO_ICONVIEW) TQIconView* iv = new TQIconView( parent, name ); if ( init ) @@ -742,7 +742,7 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare #else return 0; #endif - } else if ( className == TQTABLE_OBJECT_NAME_STRING ) { + } else if ( className == "TQTable" ) { #if !defined(TQT_NO_TABLE) if ( init ) return new TQTable( 3, 3, parent, name ); @@ -751,24 +751,24 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare return 0; #endif #ifndef TQT_NO_SQL - } else if ( className == TQDATATABLE_OBJECT_NAME_STRING ) { + } else if ( className == "TQDataTable" ) { return new TQDataTable( parent, name ); #endif //TQT_NO_SQL - } else if ( className == TQDATEEDIT_OBJECT_NAME_STRING ) { + } else if ( className == "TQDateEdit" ) { return new TQDateEdit( parent, name ); - } else if ( className == TQTIMEEDIT_OBJECT_NAME_STRING ) { + } else if ( className == "TQTimeEdit" ) { return new TQTimeEdit( parent, name ); - } else if ( className == TQDATETIMEEDIT_OBJECT_NAME_STRING ) { + } else if ( className == "TQDateTimeEdit" ) { return new TQDateTimeEdit( parent, name ); } - else if ( className == TQLISTBOX_OBJECT_NAME_STRING ) { + else if ( className == "TQListBox" ) { TQListBox* lb = new TQListBox( parent, name ); if ( init ) { lb->insertItem( i18n( "New Item" ) ); lb->setCurrentItem( 0 ); } return lb; - } else if ( className == TQLISTVIEW_OBJECT_NAME_STRING ) { + } else if ( className == "TQListView" ) { TQListView *lv = new TQListView( parent, name ); lv->setSorting( -1 ); if ( init ) { @@ -776,152 +776,144 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare lv->setCurrentItem( new TQListViewItem( lv, i18n( "New Item" ) ) ); } return lv; - } else if ( className == TQLINEEDIT_OBJECT_NAME_STRING ) + } else if ( className == "TQLineEdit" ) return new TQLineEdit( parent, name ); - else if ( className == TQSPINBOX_OBJECT_NAME_STRING ) + else if ( className == "TQSpinBox" ) return new TQSpinBox( parent, name ); - else if ( className == TQSPLITTER_OBJECT_NAME_STRING ) + else if ( className == "TQSplitter" ) return new TQSplitter( parent, name ); - else if ( className == TQMULTILINEEDIT_OBJECT_NAME_STRING ) + else if ( className == "TQMultiLineEdit" ) return new TQMultiLineEdit( parent, name ); - else if ( className == TQTEXTEDIT_OBJECT_NAME_STRING ) + else if ( className == "TQTextEdit" ) return new TQTextEdit( parent, name ); - else if ( className == TQLABEL_OBJECT_NAME_STRING || className == "TextLabel" ) { + else if ( className == "TQLabel" || className == "TextLabel" ) { QDesignerLabel *l = new QDesignerLabel( parent, name ); if ( init ) { l->setText( TQString::fromLatin1( name ) ); - MetaDataBase::addEntry( TQT_TQOBJECT(l) ); - MetaDataBase::setPropertyChanged( TQT_TQOBJECT(l), "text", TRUE ); + MetaDataBase::addEntry( l ); + MetaDataBase::setPropertyChanged( l, "text", true ); } return l; } else if ( className == "PixmapLabel" ) { QDesignerLabel *l = new QDesignerLabel( parent, name ); if ( init ) { l->setPixmap( BarIcon( "designer_qtlogo.png", KDevDesignerPartFactory::instance() ) ); - l->setScaledContents( TRUE ); - MetaDataBase::addEntry( TQT_TQOBJECT(l) ); - MetaDataBase::setPropertyChanged( TQT_TQOBJECT(l), "pixmap", TRUE ); - MetaDataBase::setPropertyChanged( TQT_TQOBJECT(l), "scaledContents", TRUE ); + l->setScaledContents( true ); + MetaDataBase::addEntry( l ); + MetaDataBase::setPropertyChanged( l, "pixmap", true ); + MetaDataBase::setPropertyChanged( l, "scaledContents", true ); } return l; - } else if ( className == TQLAYOUTWIDGET_OBJECT_NAME_STRING ) + } else if ( className == "TQLayoutWidget" ) return new TQLayoutWidget( parent, name ); - else if ( className == TQTABWIDGET_OBJECT_NAME_STRING ) { + else if ( className == "TQTabWidget" ) { TQTabWidget *tw = new QDesignerTabWidget( parent, name ); if ( init ) { FormWindow *fw = find_formwindow( parent ); TQWidget *w = fw ? new QDesignerWidget( fw, tw, "tab" ) : new TQWidget( tw, "tab" ); tw->addTab( w, i18n("Tab 1") ); - MetaDataBase::addEntry( TQT_TQOBJECT(w) ); + MetaDataBase::addEntry( w ); w = fw ? new QDesignerWidget( fw, tw, "tab" ) : new TQWidget( tw, "tab" ); tw->addTab( w, i18n("Tab 2") ); - MetaDataBase::addEntry( TQT_TQOBJECT(tw) ); - MetaDataBase::addEntry( TQT_TQOBJECT(w) ); + MetaDataBase::addEntry( tw ); + MetaDataBase::addEntry( w ); } return tw; - } else if ( className == TQWIDGETSTACK_OBJECT_NAME_STRING ) { + } else if ( className == "TQWidgetStack" ) { QDesignerWidgetStack *ws = new QDesignerWidgetStack( parent, name ); if ( init ) { FormWindow *fw = find_formwindow( parent ); TQWidget *w = fw ? new QDesignerWidget( fw, ws, "WStackPage" ) : new TQWidget( ws, "WStackPage" ); ws->insertPage( w ); - MetaDataBase::addEntry( TQT_TQOBJECT(w) ); - MetaDataBase::addEntry( TQT_TQOBJECT(ws) ); + MetaDataBase::addEntry( w ); + MetaDataBase::addEntry( ws ); } return ws; - } else if ( className == TQCOMBOBOX_OBJECT_NAME_STRING ) { - return new TQComboBox( FALSE, parent, name ); - } else if ( className == TQWIDGET_OBJECT_NAME_STRING ) { + } else if ( className == "TQComboBox" ) { + return new TQComboBox( false, parent, name ); + } else if ( className == "TQWidget" ) { if ( parent && - ( ::tqqt_cast<FormWindow*>(parent) || - ::tqqt_cast<TQWizard*>(parent) || - ::tqqt_cast<TQTabWidget*>(parent) || - ::tqqt_cast<TQWidgetStack*>(parent) || - ::tqqt_cast<TQToolBox*>(parent) || - ::tqqt_cast<TQMainWindow*>(parent) ) ) { + ( ::tqt_cast<FormWindow*>(parent) || + ::tqt_cast<TQWizard*>(parent) || + ::tqt_cast<TQTabWidget*>(parent) || + ::tqt_cast<TQWidgetStack*>(parent) || + ::tqt_cast<TQToolBox*>(parent) || + ::tqt_cast<TQMainWindow*>(parent) ) ) { FormWindow *fw = find_formwindow( parent ); if ( fw ) { QDesignerWidget *dw = new QDesignerWidget( fw, parent, name ); - MetaDataBase::addEntry( TQT_TQOBJECT(dw) ); + MetaDataBase::addEntry( dw ); return dw; } } return new TQWidget( parent, name ); - } else if ( className == TQDIALOG_OBJECT_NAME_STRING ) { + } else if ( className == "TQDialog" ) { TQDialog *dia = 0; - if ( ::tqqt_cast<FormWindow*>(parent) ) + if ( ::tqt_cast<FormWindow*>(parent) ) dia = new QDesignerDialog( (FormWindow*)parent, parent, name ); else dia = new TQDialog( parent, name ); -#if defined(TQT_NON_COMMERCIAL) - if ( ::tqqt_cast<MainWindow*>(parent) ) -#else if ( parent ) -#endif - dia->reparent( parent, TQPoint( 0, 0 ), TRUE ); + dia->reparent( parent, TQPoint( 0, 0 ), true ); return dia; - } else if ( className == TQWIZARD_OBJECT_NAME_STRING ) { + } else if ( className == "TQWizard" ) { TQWizard *wiz = new QDesignerWizard( parent, name ); -#if defined(TQT_NON_COMMERCIAL) - if ( ::tqqt_cast<MainWindow*>(parent) ) -#else if ( parent ) -#endif - wiz->reparent( parent, TQPoint( 0, 0 ), TRUE ); - if ( init && ::tqqt_cast<FormWindow*>(parent) ) { + wiz->reparent( parent, TQPoint( 0, 0 ), true ); + if ( init && ::tqt_cast<FormWindow*>(parent) ) { QDesignerWidget *dw = new QDesignerWidget( (FormWindow*)parent, wiz, "WizardPage" ); - MetaDataBase::addEntry( TQT_TQOBJECT(dw) ); + MetaDataBase::addEntry( dw ); wiz->addPage( dw, i18n( "Page" ) ); - TQTimer::singleShot( 0, wiz, TQT_SLOT( next() ) ); + TQTimer::singleShot( 0, wiz, TQ_SLOT( next() ) ); } return wiz; } else if ( className == "Spacer" ) { Spacer *s = new Spacer( parent, name ); - MetaDataBase::addEntry( TQT_TQOBJECT(s) ); - MetaDataBase::setPropertyChanged( TQT_TQOBJECT(s), "orientation", TRUE ); - MetaDataBase::setPropertyChanged( TQT_TQOBJECT(s), "sizeType", TRUE ); + MetaDataBase::addEntry( s ); + MetaDataBase::setPropertyChanged( s, "orientation", true ); + MetaDataBase::setPropertyChanged( s, "sizeType", true ); if ( !r ) return s; if ( !r->isValid() || r->width() < 2 && r->height() < 2 ) s->setOrientation( orient ); else if ( r->width() < r->height() ) - s->setOrientation( Qt::Vertical ); + s->setOrientation( TQt::Vertical ); else - s->setOrientation( Qt::Horizontal ); + s->setOrientation( TQt::Horizontal ); return s; - } else if ( className == TQLCDNUMBER_OBJECT_NAME_STRING ) + } else if ( className == "TQLCDNumber" ) return new TQLCDNumber( parent, name ); - else if ( className == TQPROGRESSBAR_OBJECT_NAME_STRING ) + else if ( className == "TQProgressBar" ) return new TQProgressBar( parent, name ); - else if ( className == TQTEXTVIEW_OBJECT_NAME_STRING ) + else if ( className == "TQTextView" ) return new TQTextView( parent, name ); - else if ( className == TQTEXTBROWSER_OBJECT_NAME_STRING ) + else if ( className == "TQTextBrowser" ) return new TQTextBrowser( parent, name ); - else if ( className == TQDIAL_OBJECT_NAME_STRING ) + else if ( className == "TQDial" ) return new TQDial( parent, name ); - else if ( className == TQSLIDER_OBJECT_NAME_STRING ) { + else if ( className == "TQSlider" ) { TQSlider *s = new TQSlider( parent, name ); if ( !r ) return s; if ( !r->isValid() || r->width() < 2 && r->height() < 2 ) s->setOrientation( orient ); else if ( r->width() > r->height() ) - s->setOrientation( Qt::Horizontal ); - MetaDataBase::addEntry( TQT_TQOBJECT(s) ); - MetaDataBase::setPropertyChanged( TQT_TQOBJECT(s), "orientation", TRUE ); + s->setOrientation( TQt::Horizontal ); + MetaDataBase::addEntry( s ); + MetaDataBase::setPropertyChanged( s, "orientation", true ); return s; - } else if ( className == TQSCROLLBAR_OBJECT_NAME_STRING ) { + } else if ( className == "TQScrollBar" ) { TQScrollBar *s = new TQScrollBar( parent, name ); if ( !r ) return s; if ( !r->isValid() || r->width() < 2 && r->height() < 2 ) s->setOrientation( orient ); else if ( r->width() > r->height() ) - s->setOrientation( Qt::Horizontal ); - MetaDataBase::addEntry( TQT_TQOBJECT(s) ); - MetaDataBase::setPropertyChanged( TQT_TQOBJECT(s), "orientation", TRUE ); + s->setOrientation( TQt::Horizontal ); + MetaDataBase::addEntry( s ); + MetaDataBase::setPropertyChanged( s, "orientation", true ); return s; - } else if ( className == TQFRAME_OBJECT_NAME_STRING ) { + } else if ( className == "TQFrame" ) { if ( !init ) return new TQFrame( parent, name ); TQFrame *f = new TQFrame( parent, name ); @@ -929,28 +921,28 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare return f; } else if ( className == "Line" ) { Line *l = new Line( parent, name ); - MetaDataBase::addEntry( TQT_TQOBJECT(l) ); - MetaDataBase::setPropertyChanged( TQT_TQOBJECT(l), "orientation", TRUE ); - MetaDataBase::setPropertyChanged( TQT_TQOBJECT(l), "frameShadow", TRUE ); - MetaDataBase::setPropertyChanged( TQT_TQOBJECT(l), "frameShape", TRUE ); + MetaDataBase::addEntry( l ); + MetaDataBase::setPropertyChanged( l, "orientation", true ); + MetaDataBase::setPropertyChanged( l, "frameShadow", true ); + MetaDataBase::setPropertyChanged( l, "frameShape", true ); if ( !r ) return l; if ( !r->isValid() || r->width() < 2 && r->height() < 2 ) l->setOrientation( orient ); else if ( r->width() < r->height() ) - l->setOrientation( Qt::Vertical ); + l->setOrientation( TQt::Vertical ); return l; - } else if ( className == TQMAINWINDOW_OBJECT_NAME_STRING ) { + } else if ( className == "TQMainWindow" ) { TQMainWindow *mw = new TQMainWindow( parent, name, 0 ); - mw->setDockEnabled( TQt::DockMinimized, FALSE ); + mw->setDockEnabled( TQt::DockMinimized, false ); QDesignerWidget *dw = new QDesignerWidget( (FormWindow*)parent, mw, "central widget" ); - mw->setDockMenuEnabled( FALSE ); - MetaDataBase::addEntry( TQT_TQOBJECT(dw) ); + mw->setDockMenuEnabled( false ); + MetaDataBase::addEntry( dw ); mw->setCentralWidget( dw ); (void)mw->statusBar(); dw->show(); return mw; - } else if ( className == TQTOOLBOX_OBJECT_NAME_STRING ) { + } else if ( className == "TQToolBox" ) { if ( !init ) return new QDesignerToolBox( parent, name ); TQToolBox *tb = new QDesignerToolBox( parent, name ); @@ -958,23 +950,23 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare TQWidget *w = fw ? new QDesignerWidget( fw, tb, "page1" ) : new TQWidget( tb, "page1" ); tb->addItem( w, i18n("Page 1") ); - MetaDataBase::addEntry( TQT_TQOBJECT(w) ); + MetaDataBase::addEntry( w ); w = fw ? new QDesignerWidget( fw, tb, "page2" ) : new TQWidget( tb, "page2" ); tb->addItem( w, i18n("Page 2") ); - MetaDataBase::addEntry( TQT_TQOBJECT(tb) ); - MetaDataBase::addEntry( TQT_TQOBJECT(w) ); + MetaDataBase::addEntry( tb ); + MetaDataBase::addEntry( w ); return tb; } #ifndef TQT_NO_SQL - else if ( className == TQDATABROWSER_OBJECT_NAME_STRING ) { + else if ( className == "TQDataBrowser" ) { TQWidget *w = new QDesignerDataBrowser( parent, name ); if ( parent ) - w->reparent( parent, TQPoint( 0, 0 ), TRUE ); + w->reparent( parent, TQPoint( 0, 0 ), true ); return w; - } else if ( className == TQDATAVIEW_OBJECT_NAME_STRING ) { + } else if ( className == "TQDataView" ) { TQWidget *w = new QDesignerDataView( parent, name ); if ( parent ) - w->reparent( parent, TQPoint( 0, 0 ), TRUE ); + w->reparent( parent, TQPoint( 0, 0 ), true ); return w; } #endif @@ -1010,37 +1002,37 @@ WidgetFactory::LayoutType WidgetFactory::layoutType( TQWidget *w, TQLayout *&lay { layout = 0; - if ( ::tqqt_cast<TQTabWidget*>(w) ) + if ( ::tqt_cast<TQTabWidget*>(w) ) w = ((TQTabWidget*)w)->currentPage(); - if ( ::tqqt_cast<TQWizard*>(w) ) + if ( ::tqt_cast<TQWizard*>(w) ) w = ((TQWizard*)w)->currentPage(); - if ( ::tqqt_cast<TQMainWindow*>(w) ) + if ( ::tqt_cast<TQMainWindow*>(w) ) w = ((TQMainWindow*)w)->centralWidget(); - if ( ::tqqt_cast<TQWidgetStack*>(w) ) + if ( ::tqt_cast<TQWidgetStack*>(w) ) w = ((TQWidgetStack*)w)->visibleWidget(); - if ( ::tqqt_cast<TQToolBox*>(w) ) + if ( ::tqt_cast<TQToolBox*>(w) ) w = ((TQToolBox*)w)->currentItem(); - if ( ::tqqt_cast<TQSplitter*>(w) ) - return ( (TQSplitter*)w )->orientation() ==Qt::Horizontal ? HBox : VBox; + if ( ::tqt_cast<TQSplitter*>(w) ) + return ( (TQSplitter*)w )->orientation() ==TQt::Horizontal ? HBox : VBox; if ( !w || !w->layout() ) return NoLayout; TQLayout *lay = w->layout(); - if ( ::tqqt_cast<TQGroupBox*>(w) ) { - TQObjectList *l = TQT_TQOBJECT(lay)->queryList( TQLAYOUT_OBJECT_NAME_STRING ); + if ( ::tqt_cast<TQGroupBox*>(w) ) { + TQObjectList *l = lay->queryList( "TQLayout" ); if ( l && l->first() ) lay = (TQLayout*)l->first(); delete l; } layout = lay; - if ( ::tqqt_cast<TQHBoxLayout*>(lay) ) + if ( ::tqt_cast<TQHBoxLayout*>(lay) ) return HBox; - else if ( ::tqqt_cast<TQVBoxLayout*>(lay) ) + else if ( ::tqt_cast<TQVBoxLayout*>(lay) ) return VBox; - else if ( ::tqqt_cast<TQGridLayout*>(lay) ) + else if ( ::tqt_cast<TQGridLayout*>(lay) ) return Grid; return NoLayout; } @@ -1050,11 +1042,11 @@ WidgetFactory::LayoutType WidgetFactory::layoutType( TQWidget *w, TQLayout *&lay */ WidgetFactory::LayoutType WidgetFactory::layoutType( TQLayout *layout ) { - if ( ::tqqt_cast<TQHBoxLayout*>(layout) ) + if ( ::tqt_cast<TQHBoxLayout*>(layout) ) return HBox; - else if ( ::tqqt_cast<TQVBoxLayout*>(layout) ) + else if ( ::tqt_cast<TQVBoxLayout*>(layout) ) return VBox; - else if ( ::tqqt_cast<TQGridLayout*>(layout) ) + else if ( ::tqt_cast<TQGridLayout*>(layout) ) return Grid; return NoLayout; } @@ -1071,7 +1063,7 @@ WidgetFactory::LayoutType WidgetFactory::layoutType( TQWidget *w ) TQWidget *WidgetFactory::layoutParent( TQLayout *layout ) { - TQObject *o = TQT_TQOBJECT(layout); + TQObject *o = layout; while ( o ) { if ( o->isWidgetType() ) return (TQWidget*)o; @@ -1093,15 +1085,15 @@ TQWidget* WidgetFactory::containerOfWidget( TQWidget *w ) { if ( !w ) return w; - if ( ::tqqt_cast<TQTabWidget*>(w) ) + if ( ::tqt_cast<TQTabWidget*>(w) ) return ((TQTabWidget*)w)->currentPage(); - if ( ::tqqt_cast<TQWizard*>(w) ) + if ( ::tqt_cast<TQWizard*>(w) ) return ((TQWizard*)w)->currentPage(); - if ( ::tqqt_cast<TQWidgetStack*>(w) ) + if ( ::tqt_cast<TQWidgetStack*>(w) ) return ((TQWidgetStack*)w)->visibleWidget(); - if ( ::tqqt_cast<TQToolBox*>(w) ) + if ( ::tqt_cast<TQToolBox*>(w) ) return ((TQToolBox*)w)->currentItem(); - if ( ::tqqt_cast<TQMainWindow*>(w) ) + if ( ::tqt_cast<TQMainWindow*>(w) ) return ((TQMainWindow*)w)->centralWidget(); #ifdef TQT_CONTAINER_CUSTOM_WIDGETS if ( !WidgetDatabase::isCustomPluginWidget( WidgetDatabase::idFromClassName( classNameOf( w ) ) ) ) @@ -1133,16 +1125,16 @@ TQWidget* WidgetFactory::containerOfWidget( TQWidget *w ) TQWidget* WidgetFactory::widgetOfContainer( TQWidget *w ) { - if ( w && ::tqqt_cast<TQWidgetStack*>(w->parentWidget()) ) + if ( w && ::tqt_cast<TQWidgetStack*>(w->parentWidget()) ) w = w->parentWidget(); if ( w->parentWidget() && w->parentWidget()->parentWidget() && w->parentWidget()->parentWidget()->parentWidget() && - ::tqqt_cast<TQToolBox*>(w->parentWidget()->parentWidget()->parentWidget()) ) + ::tqt_cast<TQToolBox*>(w->parentWidget()->parentWidget()->parentWidget()) ) return w->parentWidget()->parentWidget()->parentWidget(); while ( w ) { - int id = WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( TQT_TQOBJECT(w) ) ); + int id = WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( w ) ); if ( WidgetDatabase::isContainer( id ) || - w && ::tqqt_cast<FormWindow*>(w->parentWidget()) ) + w && ::tqt_cast<FormWindow*>(w->parentWidget()) ) return w; w = w->parentWidget(); } @@ -1153,58 +1145,58 @@ TQWidget* WidgetFactory::widgetOfContainer( TQWidget *w ) Returns whether \a o is a passive interactor or not. */ -bool WidgetFactory::lastWasAPassiveInteractor = FALSE; +bool WidgetFactory::lastWasAPassiveInteractor = false; TQGuardedPtr<TQObject> *WidgetFactory::lastPassiveInteractor = new TQGuardedPtr<TQObject>(); bool WidgetFactory::isPassiveInteractor( TQObject* o ) { if ( lastPassiveInteractor && *lastPassiveInteractor && (TQObject*)(*lastPassiveInteractor) == o ) return lastWasAPassiveInteractor; - lastWasAPassiveInteractor = FALSE; + lastWasAPassiveInteractor = false; (*lastPassiveInteractor) = o; if ( TQApplication::activePopupWidget() ) // if a popup is open, we have to make sure that this one is closed, else X might do funny things - return ( lastWasAPassiveInteractor = TRUE ); - - if ( ::tqqt_cast<TQTabBar*>(o) ) - return ( lastWasAPassiveInteractor = TRUE ); - else if ( ::tqqt_cast<TQSizeGrip*>(o) ) - return ( lastWasAPassiveInteractor = TRUE ); - else if ( ::tqqt_cast<TQButton*>(o) && - ( ::tqqt_cast<TQTabBar*>(o->parent()) || ::tqqt_cast<TQToolBox*>(o->parent()) ) ) - return ( lastWasAPassiveInteractor = TRUE ); - else if ( ::tqqt_cast<TQPushButton*>(o) && ::tqqt_cast<TQWizard*>(o->parent()) ) - return ( lastWasAPassiveInteractor = TRUE ); - else if ( ::tqqt_cast<TQMenuBar*>(o) && ::tqqt_cast<TQMainWindow*>(o->parent()) ) - return ( lastWasAPassiveInteractor = TRUE ); -// else if ( ::tqqt_cast<TQDockWindowHandle*>(o) ) - else if ( o->inherits( TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING ) ) - return ( lastWasAPassiveInteractor = TRUE ); -// else if ( ::tqqt_cast<TQHideDock*>(o) ) - else if ( o->inherits( TQHIDEDOCK_OBJECT_NAME_STRING ) ) - return ( lastWasAPassiveInteractor = TRUE ); + return ( lastWasAPassiveInteractor = true ); + + if ( ::tqt_cast<TQTabBar*>(o) ) + return ( lastWasAPassiveInteractor = true ); + else if ( ::tqt_cast<TQSizeGrip*>(o) ) + return ( lastWasAPassiveInteractor = true ); + else if ( ::tqt_cast<TQButton*>(o) && + ( ::tqt_cast<TQTabBar*>(o->parent()) || ::tqt_cast<TQToolBox*>(o->parent()) ) ) + return ( lastWasAPassiveInteractor = true ); + else if ( ::tqt_cast<TQPushButton*>(o) && ::tqt_cast<TQWizard*>(o->parent()) ) + return ( lastWasAPassiveInteractor = true ); + else if ( ::tqt_cast<TQMenuBar*>(o) && ::tqt_cast<TQMainWindow*>(o->parent()) ) + return ( lastWasAPassiveInteractor = true ); +// else if ( ::tqt_cast<TQDockWindowHandle*>(o) ) + else if ( o->inherits( "TQDockWindowHandle" ) ) + return ( lastWasAPassiveInteractor = true ); +// else if ( ::tqt_cast<TQHideDock*>(o) ) + else if ( o->inherits( "TQHideDock" ) ) + return ( lastWasAPassiveInteractor = true ); else if ( qstrcmp( o->name(), "designer_wizardstack_button" ) == 0 ) - return ( lastWasAPassiveInteractor = TRUE ); + return ( lastWasAPassiveInteractor = true ); #ifdef TQT_CONTAINER_CUSTOM_WIDGETS if ( !o->isWidgetType() ) - return ( lastWasAPassiveInteractor = FALSE ); + return ( lastWasAPassiveInteractor = false ); WidgetInterface *iface = 0; TQWidget *w = (TQWidget*)o; - while ( !iface && w && !::tqqt_cast<FormWindow*>(w) ) { + while ( !iface && w && !::tqt_cast<FormWindow*>(w) ) { widgetManager()->queryInterface( classNameOf( w ), &iface ); w = w->parentWidget(); } if ( !iface ) - return ( lastWasAPassiveInteractor = FALSE ); + return ( lastWasAPassiveInteractor = false ); TQWidgetContainerInterfacePrivate *iface2 = 0; iface->queryInterface( IID_TQWidgetContainer, (TQUnknownInterface**)&iface2 ); if ( !iface2 ) - return ( lastWasAPassiveInteractor = FALSE ); + return ( lastWasAPassiveInteractor = false ); TQWidget *fw = MainWindow::self->isAFormWindowChild( (TQWidget*)o ); if ( !fw ) - return ( lastWasAPassiveInteractor = FALSE ); + return ( lastWasAPassiveInteractor = false ); TQWidget *dw = ( (FormWindow*)fw )->designerWidget( (TQWidget*)o ); if ( !dw ) - return ( lastWasAPassiveInteractor = FALSE ); + return ( lastWasAPassiveInteractor = false ); lastWasAPassiveInteractor = iface2->isPassiveInteractor( dw->className(), (TQWidget*)o ); iface2->release(); iface->release(); @@ -1222,76 +1214,76 @@ const char* WidgetFactory::classNameOf( TQObject* o ) return o->className(); if (WidgetDatabase::isCustomPluginWidget(WidgetDatabase::idFromClassName(o->className()))) return o->className(); - else if ( ::tqqt_cast<QDesignerTabWidget*>(o) ) - return TQTABWIDGET_OBJECT_NAME_STRING; - else if ( ::tqqt_cast<QDesignerWidgetStack*>(o) ) - return TQWIDGETSTACK_OBJECT_NAME_STRING; - else if ( ::tqqt_cast<TQWidgetStack*>(o) ) + else if ( ::tqt_cast<QDesignerTabWidget*>(o) ) + return "TQTabWidget"; + else if ( ::tqt_cast<QDesignerWidgetStack*>(o) ) + return "TQWidgetStack"; + else if ( ::tqt_cast<TQWidgetStack*>(o) ) return "TQWeDoNotWantToBreakTabWidget"; - else if ( ::tqqt_cast<QDesignerDialog*>(o) ) - return TQDIALOG_OBJECT_NAME_STRING; - else if ( ::tqqt_cast<QDesignerWidget*>(o) ) - return TQWIDGET_OBJECT_NAME_STRING; + else if ( ::tqt_cast<QDesignerDialog*>(o) ) + return "TQDialog"; + else if ( ::tqt_cast<QDesignerWidget*>(o) ) + return "TQWidget"; else if ( o->inherits( "CustomWidget" ) ) return ( (CustomWidget*)o )->realClassName().latin1(); - else if ( ::tqqt_cast<QDesignerLabel*>(o) ) - return TQLABEL_OBJECT_NAME_STRING; - else if ( ::tqqt_cast<QDesignerWizard*>(o) ) - return TQWIZARD_OBJECT_NAME_STRING; - else if ( ::tqqt_cast<QDesignerPushButton*>(o) ) - return TQPUSHBUTTON_OBJECT_NAME_STRING; - else if ( ::tqqt_cast<QDesignerToolButton*>(o) ) - return TQTOOLBUTTON_OBJECT_NAME_STRING; - else if ( ::tqqt_cast<QDesignerRadioButton*>(o) ) - return TQRADIOBUTTON_OBJECT_NAME_STRING; - else if ( ::tqqt_cast<QDesignerCheckBox*>(o) ) - return TQCHECKBOX_OBJECT_NAME_STRING; - else if ( ::tqqt_cast<MenuBarEditor*>(o) ) - return TQMENUBAR_OBJECT_NAME_STRING; - else if ( ::tqqt_cast<QDesignerToolBar*>(o) ) - return TQTOOLBAR_OBJECT_NAME_STRING; - else if ( ::tqqt_cast<QDesignerAction*>(o) ) - return TQACTION_OBJECT_NAME_STRING; - else if ( ::tqqt_cast<QDesignerActionGroup*>(o) ) - return TQACTIONGROUP_OBJECT_NAME_STRING; - else if ( ::tqqt_cast<PopupMenuEditor*>(o) ) - return TQPOPUPMENU_OBJECT_NAME_STRING; - else if ( ::tqqt_cast<QDesignerToolBox*>(o) ) - return TQTOOLBOX_OBJECT_NAME_STRING; + else if ( ::tqt_cast<QDesignerLabel*>(o) ) + return "TQLabel"; + else if ( ::tqt_cast<QDesignerWizard*>(o) ) + return "TQWizard"; + else if ( ::tqt_cast<QDesignerPushButton*>(o) ) + return "TQPushButton"; + else if ( ::tqt_cast<QDesignerToolButton*>(o) ) + return "TQToolButton"; + else if ( ::tqt_cast<QDesignerRadioButton*>(o) ) + return "TQRadioButton"; + else if ( ::tqt_cast<QDesignerCheckBox*>(o) ) + return "TQCheckBox"; + else if ( ::tqt_cast<MenuBarEditor*>(o) ) + return "TQMenuBar"; + else if ( ::tqt_cast<QDesignerToolBar*>(o) ) + return "TQToolBar"; + else if ( ::tqt_cast<QDesignerAction*>(o) ) + return "TQAction"; + else if ( ::tqt_cast<QDesignerActionGroup*>(o) ) + return "TQActionGroup"; + else if ( ::tqt_cast<PopupMenuEditor*>(o) ) + return "TQPopupMenu"; + else if ( ::tqt_cast<QDesignerToolBox*>(o) ) + return "TQToolBox"; #ifndef TQT_NO_SQL - else if ( ::tqqt_cast<QDesignerDataBrowser*>(o) ) - return TQDATABROWSER_OBJECT_NAME_STRING; - else if ( ::tqqt_cast<QDesignerDataView*>(o) ) - return TQDATAVIEW_OBJECT_NAME_STRING; + else if ( ::tqt_cast<QDesignerDataBrowser*>(o) ) + return "TQDataBrowser"; + else if ( ::tqt_cast<QDesignerDataView*>(o) ) + return "TQDataView"; #endif return o->className(); } TQString WidgetFactory::defaultSignal( TQObject *w ) { - if ( ::tqqt_cast<TQRadioButton*>(w) || ::tqqt_cast<TQCheckBox*>(w) ) + if ( ::tqt_cast<TQRadioButton*>(w) || ::tqt_cast<TQCheckBox*>(w) ) return "toggled"; - else if ( ::tqqt_cast<TQButton*>(w) || ::tqqt_cast<TQButtonGroup*>(w) ) + else if ( ::tqt_cast<TQButton*>(w) || ::tqt_cast<TQButtonGroup*>(w) ) return "clicked"; - else if ( ::tqqt_cast<TQTextBrowser*>(w) ) + else if ( ::tqt_cast<TQTextBrowser*>(w) ) return "linkClicked"; - else if ( ::tqqt_cast<TQLineEdit*>(w) || ::tqqt_cast<TQTextEdit*>(w) ) + else if ( ::tqt_cast<TQLineEdit*>(w) || ::tqt_cast<TQTextEdit*>(w) ) return "textChanged"; - else if ( ::tqqt_cast<TQListView*>(w) || ::tqqt_cast<TQIconView*>(w) || - ::tqqt_cast<TQListBox*>(w) || ::tqqt_cast<TQTable*>(w) ) + else if ( ::tqt_cast<TQListView*>(w) || ::tqt_cast<TQIconView*>(w) || + ::tqt_cast<TQListBox*>(w) || ::tqt_cast<TQTable*>(w) ) return "selectionChanged"; - else if ( ::tqqt_cast<TQTabWidget*>(w) ) + else if ( ::tqt_cast<TQTabWidget*>(w) ) return "selected"; - else if ( ::tqqt_cast<TQToolBox*>(w) ) + else if ( ::tqt_cast<TQToolBox*>(w) ) return "currentChanged"; - else if ( ::tqqt_cast<TQWidgetStack*>(w) ) + else if ( ::tqt_cast<TQWidgetStack*>(w) ) return "aboutToShow"; - else if ( ::tqqt_cast<TQSpinBox*>(w) || ::tqqt_cast<TQSlider*>(w) || - ::tqqt_cast<TQScrollBar*>(w) || ::tqqt_cast<TQDateEdit*>(w) || - ::tqqt_cast<TQTimeEdit*>(w) || ::tqqt_cast<TQDateTimeEdit*>(w) || - ::tqqt_cast<TQDial*>(w) ) + else if ( ::tqt_cast<TQSpinBox*>(w) || ::tqt_cast<TQSlider*>(w) || + ::tqt_cast<TQScrollBar*>(w) || ::tqt_cast<TQDateEdit*>(w) || + ::tqt_cast<TQTimeEdit*>(w) || ::tqt_cast<TQDateTimeEdit*>(w) || + ::tqt_cast<TQDial*>(w) ) return "valueChanged"; - else if ( ::tqqt_cast<TQComboBox*>(w) ) + else if ( ::tqt_cast<TQComboBox*>(w) ) return "activated"; return TQString(); } @@ -1306,50 +1298,50 @@ void WidgetFactory::initChangedProperties( TQObject *o ) if ( MainWindow::self && MainWindow::self->currProject() && MainWindow::self->currProject()->fakeFormFileFor( o ) ) return; - MetaDataBase::setPropertyChanged( o, "name", TRUE ); - if ( !::tqqt_cast<QDesignerToolBar*>(o) && !::tqqt_cast<MenuBarEditor*>(o) ) - MetaDataBase::setPropertyChanged( o, "geometry", TRUE ); - - if ( ::tqqt_cast<TQPushButton*>(o) || - ::tqqt_cast<TQRadioButton*>(o) || - ::tqqt_cast<TQCheckBox*>(o) || - ::tqqt_cast<TQToolButton*>(o) ) { - if (::tqqt_cast<TQToolButton*>(o) && ::tqqt_cast<TQToolBox*>(widgetOfContainer((TQWidget*)o->parent()))) { - MetaDataBase::setPropertyChanged( o, "usesTextLabel", TRUE ); - MetaDataBase::setPropertyChanged( o, "textLabel", TRUE ); - MetaDataBase::setPropertyChanged( o, "autoRaise", TRUE ); - MetaDataBase::setPropertyChanged( o, "textPosition", TRUE ); + MetaDataBase::setPropertyChanged( o, "name", true ); + if ( !::tqt_cast<QDesignerToolBar*>(o) && !::tqt_cast<MenuBarEditor*>(o) ) + MetaDataBase::setPropertyChanged( o, "geometry", true ); + + if ( ::tqt_cast<TQPushButton*>(o) || + ::tqt_cast<TQRadioButton*>(o) || + ::tqt_cast<TQCheckBox*>(o) || + ::tqt_cast<TQToolButton*>(o) ) { + if (::tqt_cast<TQToolButton*>(o) && ::tqt_cast<TQToolBox*>(widgetOfContainer((TQWidget*)o->parent()))) { + MetaDataBase::setPropertyChanged( o, "usesTextLabel", true ); + MetaDataBase::setPropertyChanged( o, "textLabel", true ); + MetaDataBase::setPropertyChanged( o, "autoRaise", true ); + MetaDataBase::setPropertyChanged( o, "textPosition", true ); } else { - MetaDataBase::setPropertyChanged( o, "text", TRUE ); + MetaDataBase::setPropertyChanged( o, "text", true ); } } - else if ( ::tqqt_cast<TQGroupBox*>(o) ) - MetaDataBase::setPropertyChanged( o, "title", TRUE ); - else if ( o->isA( TQFRAME_OBJECT_NAME_STRING ) ) { - MetaDataBase::setPropertyChanged( o, "frameShadow", TRUE ); - MetaDataBase::setPropertyChanged( o, "frameShape", TRUE ); - } else if ( ::tqqt_cast<TQTabWidget*>(o) || ::tqqt_cast<TQWizard*>(o) ) { - MetaDataBase::setPropertyChanged( o, "pageTitle", TRUE ); - MetaDataBase::setPropertyChanged( o, "pageName", TRUE ); - MetaDataBase::setPropertyChanged( o, "currentPage", TRUE ); - } else if ( ::tqqt_cast<TQWidgetStack*>(o) ) { - MetaDataBase::setPropertyChanged( o, "currentPage", TRUE ); - MetaDataBase::setPropertyChanged( o, "pageName", TRUE ); - } else if ( ::tqqt_cast<TQToolBox*>(o) ) { - MetaDataBase::setPropertyChanged( o, "currentIndex", TRUE ); - MetaDataBase::setPropertyChanged( o, "itemName", TRUE ); - MetaDataBase::setPropertyChanged( o, "itemLabel", TRUE ); - MetaDataBase::setPropertyChanged( o, "itemIconSet", TRUE ); - MetaDataBase::setPropertyChanged( o, "itemToolTip", TRUE ); - MetaDataBase::setPropertyChanged( o, "itemBackgroundMode", TRUE ); + else if ( ::tqt_cast<TQGroupBox*>(o) ) + MetaDataBase::setPropertyChanged( o, "title", true ); + else if ( o->isA( "TQFrame" ) ) { + MetaDataBase::setPropertyChanged( o, "frameShadow", true ); + MetaDataBase::setPropertyChanged( o, "frameShape", true ); + } else if ( ::tqt_cast<TQTabWidget*>(o) || ::tqt_cast<TQWizard*>(o) ) { + MetaDataBase::setPropertyChanged( o, "pageTitle", true ); + MetaDataBase::setPropertyChanged( o, "pageName", true ); + MetaDataBase::setPropertyChanged( o, "currentPage", true ); + } else if ( ::tqt_cast<TQWidgetStack*>(o) ) { + MetaDataBase::setPropertyChanged( o, "currentPage", true ); + MetaDataBase::setPropertyChanged( o, "pageName", true ); + } else if ( ::tqt_cast<TQToolBox*>(o) ) { + MetaDataBase::setPropertyChanged( o, "currentIndex", true ); + MetaDataBase::setPropertyChanged( o, "itemName", true ); + MetaDataBase::setPropertyChanged( o, "itemLabel", true ); + MetaDataBase::setPropertyChanged( o, "itemIconSet", true ); + MetaDataBase::setPropertyChanged( o, "itemToolTip", true ); + MetaDataBase::setPropertyChanged( o, "itemBackgroundMode", true ); #ifndef TQT_NO_TABLE - } else if ( ::tqqt_cast<TQTable*>(o) ) { + } else if ( ::tqt_cast<TQTable*>(o) ) { # ifndef TQT_NO_SQL - if (!::tqqt_cast<TQDataTable*>(o) ) + if (!::tqt_cast<TQDataTable*>(o) ) # endif { - MetaDataBase::setPropertyChanged( o, "numRows", TRUE ); - MetaDataBase::setPropertyChanged( o, "numCols", TRUE ); + MetaDataBase::setPropertyChanged( o, "numRows", true ); + MetaDataBase::setPropertyChanged( o, "numCols", true ); TQTable *t = (TQTable*)o; for ( int i = 0; i < 3; ++i ) { t->horizontalHeader()->setLabel( i, TQString::number( i + 1 ) ); @@ -1357,14 +1349,14 @@ void WidgetFactory::initChangedProperties( TQObject *o ) } } #endif - } else if ( ::tqqt_cast<TQSplitter*>(o) ) { - MetaDataBase::setPropertyChanged( o, "orientation", TRUE ); - } else if ( ::tqqt_cast<QDesignerToolBar*>(o) ) { - MetaDataBase::setPropertyChanged( o, "label", TRUE ); - } else if ( ::tqqt_cast<MenuBarEditor*>(o) ) { - MetaDataBase::setPropertyChanged( o, "itemName", TRUE ); - MetaDataBase::setPropertyChanged( o, "itemNumber", TRUE ); - MetaDataBase::setPropertyChanged( o, "itemText", TRUE ); + } else if ( ::tqt_cast<TQSplitter*>(o) ) { + MetaDataBase::setPropertyChanged( o, "orientation", true ); + } else if ( ::tqt_cast<QDesignerToolBar*>(o) ) { + MetaDataBase::setPropertyChanged( o, "label", true ); + } else if ( ::tqt_cast<MenuBarEditor*>(o) ) { + MetaDataBase::setPropertyChanged( o, "itemName", true ); + MetaDataBase::setPropertyChanged( o, "itemNumber", true ); + MetaDataBase::setPropertyChanged( o, "itemText", true ); } } @@ -1373,19 +1365,19 @@ bool WidgetFactory::hasSpecialEditor( int id, TQObject *editorWidget ) TQString className = WidgetDatabase::className( id ); if ( className.contains( "ListBox" ) ) - return TRUE; + return true; if ( className.contains( "ComboBox" ) ) - return TRUE; + return true; if ( className.contains( "ListView" ) ) - return TRUE; + return true; if ( className.contains( "IconView" ) ) - return TRUE; - if ( className == TQTEXTEDIT_OBJECT_NAME_STRING || className == TQMULTILINEEDIT_OBJECT_NAME_STRING ) - return TRUE; - if ( ::tqqt_cast<TQTable*>(editorWidget) != 0 ) - return TRUE; + return true; + if ( className == "TQTextEdit" || className == "TQMultiLineEdit" ) + return true; + if ( ::tqt_cast<TQTable*>(editorWidget) != 0 ) + return true; - return FALSE; + return false; } bool WidgetFactory::hasItems( int id, TQObject *editorWidget ) @@ -1394,10 +1386,10 @@ bool WidgetFactory::hasItems( int id, TQObject *editorWidget ) if ( className.contains( "ListBox" ) || className.contains( "ListView" ) || className.contains( "IconView" ) || className.contains( "ComboBox" ) || - ::tqqt_cast<TQTable*>(editorWidget) != 0 ) - return TRUE; + ::tqt_cast<TQTable*>(editorWidget) != 0 ) + return true; - return FALSE; + return false; } void WidgetFactory::editWidget( int id, TQWidget *parent, TQWidget *editWidget, FormWindow *fw ) @@ -1405,7 +1397,7 @@ void WidgetFactory::editWidget( int id, TQWidget *parent, TQWidget *editWidget, TQString className = WidgetDatabase::className( id ); if ( className.contains( "ListBox" ) ) { - if ( !::tqqt_cast<TQListBox*>(editWidget) ) + if ( !::tqt_cast<TQListBox*>(editWidget) ) return; ListBoxEditor *e = new ListBoxEditor( parent, editWidget, fw ); e->exec(); @@ -1414,7 +1406,7 @@ void WidgetFactory::editWidget( int id, TQWidget *parent, TQWidget *editWidget, } if ( className.contains( "ComboBox" ) ) { - if ( !::tqqt_cast<TQComboBox*>(editWidget) ) + if ( !::tqt_cast<TQComboBox*>(editWidget) ) return; TQComboBox *cb = (TQComboBox*)editWidget; ListBoxEditor *e = new ListBoxEditor( parent, cb->listBox(), fw ); @@ -1425,7 +1417,7 @@ void WidgetFactory::editWidget( int id, TQWidget *parent, TQWidget *editWidget, } if ( className.contains( "ListView" ) ) { - if ( !::tqqt_cast<TQListView*>(editWidget) ) + if ( !::tqt_cast<TQListView*>(editWidget) ) return; TQListView *lv = (TQListView*)editWidget; ListViewEditor *e = new ListViewEditor( parent, lv, fw ); @@ -1435,7 +1427,7 @@ void WidgetFactory::editWidget( int id, TQWidget *parent, TQWidget *editWidget, } if ( className.contains( "IconView" ) ) { - if ( !::tqqt_cast<TQIconView*>(editWidget) ) + if ( !::tqt_cast<TQIconView*>(editWidget) ) return; IconViewEditor *e = new IconViewEditor( parent, editWidget, fw ); e->exec(); @@ -1443,14 +1435,14 @@ void WidgetFactory::editWidget( int id, TQWidget *parent, TQWidget *editWidget, return; } - if ( className == TQMULTILINEEDIT_OBJECT_NAME_STRING || className == TQTEXTEDIT_OBJECT_NAME_STRING ) { - MultiLineEditor *e = new MultiLineEditor( FALSE, TRUE, parent, editWidget, fw ); + if ( className == "TQMultiLineEdit" || className == "TQTextEdit" ) { + MultiLineEditor *e = new MultiLineEditor( false, true, parent, editWidget, fw ); e->exec(); delete e; return; } #ifndef TQT_NO_TABLE - if (::tqqt_cast<TQTable*>(editWidget) != 0) { + if (::tqt_cast<TQTable*>(editWidget) != 0) { TableEditor *e = new TableEditor( parent, editWidget, fw ); e->exec(); delete e; @@ -1462,7 +1454,7 @@ void WidgetFactory::editWidget( int id, TQWidget *parent, TQWidget *editWidget, bool WidgetFactory::canResetProperty( TQObject *w, const TQString &propName ) { if ( propName == "name" || propName == "geometry" ) - return FALSE; + return false; TQStringList l = *changedProperties->find( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( w ) ) ); return l.findIndex( propName ) == -1; } @@ -1470,9 +1462,9 @@ bool WidgetFactory::canResetProperty( TQObject *w, const TQString &propName ) bool WidgetFactory::resetProperty( TQObject *w, const TQString &propName ) { const TQMetaProperty *p = w->metaObject()->property( w->metaObject()-> - findProperty( propName, TRUE ), TRUE ); + findProperty( propName, true ), true ); if (!p ) - return FALSE; + return false; return p->reset( w ); } @@ -1497,7 +1489,7 @@ TQVariant WidgetFactory::defaultValue( TQObject *w, const TQString &propName ) TQString WidgetFactory::defaultCurrentItem( TQObject *w, const TQString &propName ) { const TQMetaProperty *p = w->metaObject()-> - property( w->metaObject()->findProperty( propName, TRUE ), TRUE ); + property( w->metaObject()->findProperty( propName, true ), true ); if ( !p ) { int v = defaultValue( w, "alignment" ).toInt(); if ( propName == "hAlign" ) { @@ -1536,8 +1528,8 @@ TQWidget *WidgetFactory::createCustomWidget( TQWidget *parent, const char *name, TQVariant WidgetFactory::property( TQObject *w, const char *name ) { - int id = w->metaObject()->findProperty( name, TRUE ); - const TQMetaProperty* p = w->metaObject()->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 +1541,7 @@ void QDesignerLabel::updateBuddy() if ( myBuddy.isEmpty() ) return; - TQObjectList *l = topLevelWidget()->queryList( TQWIDGET_OBJECT_NAME_STRING, myBuddy, FALSE, TRUE ); + TQObjectList *l = topLevelWidget()->queryList( "TQWidget", myBuddy, false, true ); if ( !l || !l->first() ) { delete l; return; @@ -1633,15 +1625,15 @@ void TQLayoutWidget::updateSizePolicy() if ( parent() && parent()->isWidgetType() ) { parentLayout = ((TQWidget *)parent())->layout(); if ( parentLayout && - ::tqqt_cast<TQLayoutWidget*>(parentLayout->mainWidget()) ) + ::tqt_cast<TQLayoutWidget*>(parentLayout->mainWidget()) ) parentLayout = 0; } TQObjectListIt it( childrenListObject() ); TQObject *o; - if ( ::tqqt_cast<TQVBoxLayout*>(layout()) ) { - if ( ::tqqt_cast<TQHBoxLayout*>(parentLayout) ) + if ( ::tqt_cast<TQVBoxLayout*>(layout()) ) { + if ( ::tqt_cast<TQHBoxLayout*>(parentLayout) ) vt = TQSizePolicy::Minimum; else vt = TQSizePolicy::Fixed; @@ -1661,8 +1653,8 @@ void TQLayoutWidget::updateSizePolicy() if ( w->sizePolicy().mayShrinkVertically() ) vt |= TQSizePolicy::Maximum; } - } else if ( ::tqqt_cast<TQHBoxLayout*>(layout()) ) { - if ( ::tqqt_cast<TQVBoxLayout*>(parentLayout) ) + } else if ( ::tqt_cast<TQHBoxLayout*>(layout()) ) { + if ( ::tqt_cast<TQVBoxLayout*>(parentLayout) ) ht = TQSizePolicy::Minimum; else ht = TQSizePolicy::Fixed; @@ -1682,13 +1674,13 @@ void TQLayoutWidget::updateSizePolicy() if ( !w->sizePolicy().mayShrinkVertically() ) vt &= ~TQSizePolicy::Maximum; } - } else if ( ::tqqt_cast<TQGridLayout*>(layout()) ) { + } else if ( ::tqt_cast<TQGridLayout*>(layout()) ) { ht = TQSizePolicy::Fixed; vt = TQSizePolicy::Fixed; if ( parentLayout ) { - if ( ::tqqt_cast<TQVBoxLayout*>(parentLayout) ) + if ( ::tqt_cast<TQVBoxLayout*>(parentLayout) ) ht = TQSizePolicy::Minimum; - else if ( ::tqqt_cast<TQHBoxLayout*>(parentLayout) ) + else if ( ::tqt_cast<TQHBoxLayout*>(parentLayout) ) vt = TQSizePolicy::Minimum; } @@ -1708,17 +1700,9 @@ void TQLayoutWidget::updateSizePolicy() vt |= TQSizePolicy::Maximum; } } -#ifdef USE_QT4 - if ( layout()->expanding() & TQSizePolicy::Horizontally ) -#else // USE_QT4 if ( layout()->expanding() & TQSizePolicy::Horizontally ) -#endif // USE_QT4 ht = TQSizePolicy::Expanding; -#ifdef USE_QT4 - if ( layout()->expanding() & TQSizePolicy::Vertically ) -#else // USE_QT4 if ( layout()->expanding() & TQSizePolicy::Vertically ) -#endif // USE_QT4 vt = TQSizePolicy::Expanding; layout()->invalidate(); @@ -1730,7 +1714,7 @@ void TQLayoutWidget::updateSizePolicy() void CustomWidget::paintEvent( TQPaintEvent *e ) { - if ( ::tqqt_cast<FormWindow*>(parentWidget()) ) { + if ( ::tqt_cast<FormWindow*>(parentWidget()) ) { ( (FormWindow*)parentWidget() )->paintGrid( this, e ); } else { TQPainter p( this ); |