diff options
Diffstat (limited to 'kommander/editor/widgetfactory.cpp')
-rw-r--r-- | kommander/editor/widgetfactory.cpp | 824 |
1 files changed, 416 insertions, 408 deletions
diff --git a/kommander/editor/widgetfactory.cpp b/kommander/editor/widgetfactory.cpp index 2becbd33..920a3605 100644 --- a/kommander/editor/widgetfactory.cpp +++ b/kommander/editor/widgetfactory.cpp @@ -1,7 +1,7 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** -** This file is part of Qt Designer. +** This file is part of TQt Designer. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software @@ -29,7 +29,7 @@ #include "mainwindow.h" #include "formwindow.h" #include "pixmapchooser.h" -#include "layout.h" +#include "tqlayout.h" #include "listboxeditorimpl.h" #include "listvieweditorimpl.h" #include "iconvieweditorimpl.h" @@ -37,7 +37,7 @@ #ifndef KOMMANDER #include "widgetinterface.h" #endif -#ifndef QT_NO_TABLE +#ifndef TQT_NO_TABLE #include "tableeditorimpl.h" #endif @@ -46,10 +46,10 @@ #include <tqpixmap.h> #include <tqgroupbox.h> #include <tqiconview.h> -#ifndef QT_NO_TABLE +#ifndef TQT_NO_TABLE #include <tqtable.h> #endif -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL #include <tqdatatable.h> #endif #include <tqdatetimeedit.h> @@ -81,7 +81,7 @@ #include <tqmenubar.h> #include <tqapplication.h> #include <tqsplitter.h> -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL #include "database.h" #endif @@ -123,13 +123,13 @@ FormWindow *find_formwindow( TQWidget *w ) for (;;) { if ( w->inherits( "FormWindow" ) ) return (FormWindow*)w; - if ( !w->parentWidget() ) + if ( !w->tqparentWidget() ) return 0; - w = w->parentWidget(); + w = w->tqparentWidget(); } } -void QLayoutWidget::paintEvent( TQPaintEvent* ) +void TQLayoutWidget::paintEvent( TQPaintEvent* ) { TQPainter p ( this ); p.setPen( red ); @@ -137,54 +137,54 @@ void QLayoutWidget::paintEvent( TQPaintEvent* ) } -QDesignerTabWidget::QDesignerTabWidget( TQWidget *parent, const char *name ) - : TQTabWidget( parent, name ), dropIndicator( 0 ), dragPage( 0 ), mousePressed( false ) +TQDesignerTabWidget::TQDesignerTabWidget( TQWidget *tqparent, const char *name ) + : TQTabWidget( tqparent, name ), dropIndicator( 0 ), dragPage( 0 ), mousePressed( false ) { tabBar()->setAcceptDrops( true ); tabBar()->installEventFilter( this ); } -int QDesignerTabWidget::currentPage() const +int TQDesignerTabWidget::currentPage() const { return tabBar()->currentTab(); } -void QDesignerTabWidget::setCurrentPage( int i ) +void TQDesignerTabWidget::setCurrentPage( int i ) { tabBar()->setCurrentTab( i ); } -TQString QDesignerTabWidget::pageTitle() const +TQString TQDesignerTabWidget::pageTitle() const { return ((TQTabWidget*)this)->tabLabel( TQTabWidget::currentPage() ); } -void QDesignerTabWidget::setPageTitle( const TQString& title ) +void TQDesignerTabWidget::setPageTitle( const TQString& title ) { changeTab( TQTabWidget::currentPage(), title ); } -void QDesignerTabWidget::setPageName( const TQCString& name ) +void TQDesignerTabWidget::setPageName( const TQCString& name ) { if ( TQTabWidget::currentPage() ) TQTabWidget::currentPage()->setName( name ); } -TQCString QDesignerTabWidget::pageName() const +TQCString TQDesignerTabWidget::pageName() const { if ( !TQTabWidget::currentPage() ) return 0; return TQTabWidget::currentPage()->name(); } -int QDesignerTabWidget::count() const +int TQDesignerTabWidget::count() const { return tabBar()->count(); } -bool QDesignerTabWidget::eventFilter( TQObject *o, TQEvent *e ) +bool TQDesignerTabWidget::eventFilter( TQObject *o, TQEvent *e ) { - if ( o != tabBar() ) return false; + if ( TQT_BASE_OBJECT(o) != TQT_BASE_OBJECT(tabBar()) ) return false; switch ( e->type() ) { case TQEvent::MouseButtonPress: { @@ -232,7 +232,7 @@ bool QDesignerTabWidget::eventFilter( TQObject *o, TQEvent *e ) int index = 0; TQRect rect; for ( ; index < tabBar()->count(); index++ ) { - if ( tabBar()->tabAt( index )->rect().contains( de->pos() ) ) { + if ( tabBar()->tabAt( index )->rect().tqcontains( de->pos() ) ) { rect = tabBar()->tabAt( index )->rect(); break; } @@ -241,7 +241,7 @@ bool QDesignerTabWidget::eventFilter( TQObject *o, TQEvent *e ) if ( index == tabBar()->count() -1 ) { TQRect rect2 = rect; rect2.setLeft( rect2.left() + rect2.width() / 2 ); - if ( rect2.contains( de->pos() ) ) + if ( rect2.tqcontains( de->pos() ) ) index++; } @@ -269,20 +269,20 @@ bool QDesignerTabWidget::eventFilter( TQObject *o, TQEvent *e ) int newIndex = 0; for ( ; newIndex < tabBar()->count(); newIndex++ ) { - if ( tabBar()->tabAt( newIndex )->rect().contains( de->pos() ) ) + if ( tabBar()->tabAt( newIndex )->rect().tqcontains( de->pos() ) ) break; } if ( newIndex == tabBar()->count() -1 ) { TQRect rect2 = tabBar()->tabAt( newIndex )->rect(); rect2.setLeft( rect2.left() + rect2.width() / 2 ); - if ( rect2.contains( de->pos() ) ) + if ( rect2.tqcontains( de->pos() ) ) newIndex++; } int oldIndex = 0; for ( ; oldIndex < tabBar()->count(); oldIndex++ ) { - if ( tabBar()->tabAt( oldIndex )->rect().contains( pressPoint ) ) + if ( tabBar()->tabAt( oldIndex )->rect().tqcontains( pressPoint ) ) break; } @@ -303,7 +303,7 @@ bool QDesignerTabWidget::eventFilter( TQObject *o, TQEvent *e ) return false; } -int QDesignerWizard::currentPageNum() const +int TQDesignerWizard::currentPageNum() const { for ( int i = 0; i < pageCount(); ++i ) { if ( page( i ) == currentPage() ) @@ -312,7 +312,7 @@ int QDesignerWizard::currentPageNum() const return 0; } -void QDesignerWizard::setCurrentPage( int i ) +void TQDesignerWizard::setCurrentPage( int i ) { if ( i < currentPageNum() ) { while ( i < currentPageNum() ) { @@ -330,30 +330,30 @@ void QDesignerWizard::setCurrentPage( int i ) } } -TQString QDesignerWizard::pageTitle() const +TQString TQDesignerWizard::pageTitle() const { return title( currentPage() ); } -void QDesignerWizard::setPageTitle( const TQString& title ) +void TQDesignerWizard::setPageTitle( const TQString& title ) { setTitle( currentPage(), title ); } -void QDesignerWizard::setPageName( const TQCString& name ) +void TQDesignerWizard::setPageName( const TQCString& name ) { if ( TQWizard::currentPage() ) TQWizard::currentPage()->setName( name ); } -TQCString QDesignerWizard::pageName() const +TQCString TQDesignerWizard::pageName() const { if ( !TQWizard::currentPage() ) return 0; return TQWizard::currentPage()->name(); } -int QDesignerWizard::pageNum( TQWidget *p ) +int TQDesignerWizard::pageNum( TQWidget *p ) { for ( int i = 0; i < pageCount(); ++i ) { if ( page( i ) == p ) @@ -362,23 +362,23 @@ int QDesignerWizard::pageNum( TQWidget *p ) return -1; } -void QDesignerWizard::addPage( TQWidget *p, const TQString &t ) +void TQDesignerWizard::addPage( TQWidget *p, const TQString &t ) { TQWizard::addPage( p, t ); - if ( removedPages.find( p ) ) + if ( removedPages.tqfind( p ) ) removedPages.remove( p ); } -void QDesignerWizard::removePage( TQWidget *p ) +void TQDesignerWizard::removePage( TQWidget *p ) { TQWizard::removePage( p ); removedPages.insert( p, p ); } -void QDesignerWizard::insertPage( TQWidget *p, const TQString &t, int index ) +void TQDesignerWizard::insertPage( TQWidget *p, const TQString &t, int index ) { TQWizard::insertPage( p, t, index ); - if ( removedPages.find( p ) ) + if ( removedPages.tqfind( p ) ) removedPages.remove( p ); } @@ -387,10 +387,10 @@ TQMap< int, TQStringList > *changedProperties = 0; /*! \class WidgetFactory widgetfactory.h - \brief Set of static functions for creating widgets, layouts and do other stuff + \brief Set of static functions for creating widgets, tqlayouts and do other stuff The widget factory offers functions to create widgets, create and - delete layouts find out other details - all based on the + delete tqlayouts find out other details - all based on the WidgetDatabase's data. So the functions that use ids use the same ids as in the WidgetDatabase. */ @@ -399,26 +399,26 @@ TQMap< int, TQStringList > *changedProperties = 0; void WidgetFactory::saveDefaultProperties( TQWidget *w, int id ) { TQMap< TQString, TQVariant> propMap; - TQStrList lst = w->metaObject()->propertyNames( true ); + TQStrList lst = w->tqmetaObject()->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 ) var = TQVariant( TQPixmap() ); else if ( !var.isValid() && qstrcmp( "iconSet", lst.at( i ) ) == 0 ) var = TQVariant( TQIconSet() ); - propMap.replace( lst.at( i ), var ); + propMap.tqreplace( lst.at( i ), var ); } - defaultProperties->replace( id, propMap ); + defaultProperties->tqreplace( id, propMap ); } static void saveChangedProperties( TQWidget *w, int id ) { - TQStringList l = MetaDataBase::changedProperties( w ); + TQStringList l = MetaDataBase::changedProperties( TQT_TQOBJECT(w) ); changedProperties->insert( id, l ); } -EditorTabWidget::EditorTabWidget( TQWidget *parent, const char *name ) - : TabWidget( parent, name ), dropIndicator( 0 ), dragPage( 0 ), mousePressed( false ) +EditorTabWidget::EditorTabWidget( TQWidget *tqparent, const char *name ) + : TabWidget( tqparent, name ), dropIndicator( 0 ), dragPage( 0 ), mousePressed( false ) { tabBar()->setAcceptDrops( true ); tabBar()->installEventFilter( this ); @@ -464,7 +464,7 @@ int EditorTabWidget::count() const bool EditorTabWidget::eventFilter( TQObject *o, TQEvent *e ) { - if ( o != tabBar() ) return false; + if ( TQT_BASE_OBJECT(o) != TQT_BASE_OBJECT(tabBar()) ) return false; switch ( e->type() ) { case TQEvent::MouseButtonPress: { @@ -512,7 +512,7 @@ bool EditorTabWidget::eventFilter( TQObject *o, TQEvent *e ) int index = 0; TQRect rect; for ( ; index < tabBar()->count(); index++ ) { - if ( tabBar()->tabAt( index )->rect().contains( de->pos() ) ) { + if ( tabBar()->tabAt( index )->rect().tqcontains( de->pos() ) ) { rect = tabBar()->tabAt( index )->rect(); break; } @@ -521,7 +521,7 @@ bool EditorTabWidget::eventFilter( TQObject *o, TQEvent *e ) if ( index == tabBar()->count() -1 ) { TQRect rect2 = rect; rect2.setLeft( rect2.left() + rect2.width() / 2 ); - if ( rect2.contains( de->pos() ) ) + if ( rect2.tqcontains( de->pos() ) ) index++; } @@ -549,20 +549,20 @@ bool EditorTabWidget::eventFilter( TQObject *o, TQEvent *e ) int newIndex = 0; for ( ; newIndex < tabBar()->count(); newIndex++ ) { - if ( tabBar()->tabAt( newIndex )->rect().contains( de->pos() ) ) + if ( tabBar()->tabAt( newIndex )->rect().tqcontains( de->pos() ) ) break; } if ( newIndex == tabBar()->count() -1 ) { TQRect rect2 = tabBar()->tabAt( newIndex )->rect(); rect2.setLeft( rect2.left() + rect2.width() / 2 ); - if ( rect2.contains( de->pos() ) ) + if ( rect2.tqcontains( de->pos() ) ) newIndex++; } int oldIndex = 0; for ( ; oldIndex < tabBar()->count(); oldIndex++ ) { - if ( tabBar()->tabAt( oldIndex )->rect().contains( pressPoint ) ) + if ( tabBar()->tabAt( oldIndex )->rect().tqcontains( pressPoint ) ) break; } @@ -584,8 +584,8 @@ bool EditorTabWidget::eventFilter( TQObject *o, TQEvent *e ) } -EditorToolBox::EditorToolBox( TQWidget *parent, const char *name ) - : ToolBox( parent, name ) +EditorToolBox::EditorToolBox( TQWidget *tqparent, const char *name ) + : ToolBox( tqparent, name ) { setAcceptDrops( true ); } @@ -631,12 +631,12 @@ int EditorToolBox::count() const /*! 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 tqparent. 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 *tqparent, const char *name, bool init, const TQRect *r, Qt::Orientation orient ) { TQString n = WidgetDatabase::className(id); //qDebug("Trying to create '%s'", n.latin1()); @@ -652,108 +652,108 @@ TQWidget *WidgetFactory::create( int id, TQWidget *parent, const char *name, boo TQWidget *w = 0; TQString str = WidgetDatabase::createWidgetName(id); const char *s = str.latin1(); - w = createWidget(n, parent, name ? name : s, init, r, orient); + w = createWidget(n, tqparent, name ? name : s, init, r, orient); //qDebug("Trying to create '%s', widget (id=%d) - %s", s, id, w ? "successful" : "failure"); if (!w && WidgetDatabase::isCustomWidget(id)) - w = createCustomWidget(parent, name ? name : s, MetaDataBase::customWidget(id)); + w = createCustomWidget(tqparent, name ? name : s, MetaDataBase::customWidget(id)); if (!w) return 0; - MetaDataBase::addEntry(w); + MetaDataBase::addEntry(TQT_TQOBJECT(w)); - if (!defaultProperties->contains(id)) + if (!defaultProperties->tqcontains(id)) saveDefaultProperties(w, id); - if (!changedProperties->contains(id)) + if (!changedProperties->tqcontains(id)) saveChangedProperties(w, id); return w; } -/*! Creates a layout on the widget \a widget of the type \a type +/*! Creates a tqlayout 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 *layout, LayoutType type ) +TQLayout *WidgetFactory::createLayout( TQWidget *widget, TQLayout *tqlayout, LayoutType type ) { int spacing = MainWindow::self->currentLayoutDefaultSpacing(); int margin = 0; if ( widget && !widget->inherits( TQLAYOUTWIDGET_OBJECT_NAME_STRING ) && - ( WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( widget ) ) ) || - widget && widget->parentWidget() && widget->parentWidget()->inherits( "FormWindow" ) ) ) + ( WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( TQT_TQOBJECT(widget) ) ) ) || + widget && widget->tqparentWidget() && widget->tqparentWidget()->inherits( "FormWindow" ) ) ) margin = MainWindow::self->currentLayoutDefaultMargin(); - if ( !layout && widget && widget->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) + if ( !tqlayout && widget && widget->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) widget = ((TQTabWidget*)widget)->currentPage(); - if ( !layout && widget && widget->inherits( TQTOOLBOX_OBJECT_NAME_STRING ) ) + if ( !tqlayout && widget && widget->inherits( TQTOOLBOX_OBJECT_NAME_STRING ) ) widget = ((TQToolBox*)widget)->currentItem(); - if ( !layout && widget && widget->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) + if ( !tqlayout && widget && widget->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) widget = ((TQWizard*)widget)->currentPage(); - if ( !layout && widget && widget->inherits( TQMAINWINDOW_OBJECT_NAME_STRING ) ) + if ( !tqlayout && widget && widget->inherits( TQMAINWINDOW_OBJECT_NAME_STRING ) ) widget = ((TQMainWindow*)widget)->centralWidget(); - if ( !layout && widget && widget->inherits( TQWIDGETSTACK_OBJECT_NAME_STRING ) ) + if ( !tqlayout && widget && widget->inherits( TQWIDGETSTACK_OBJECT_NAME_STRING ) ) widget = ((TQWidgetStack*)widget)->visibleWidget(); - MetaDataBase::addEntry( widget ); + MetaDataBase::addEntry( TQT_TQOBJECT(widget) ); - if ( !layout && widget && widget->inherits( TQGROUPBOX_OBJECT_NAME_STRING ) ) { + if ( !tqlayout && widget && widget->inherits( TQGROUPBOX_OBJECT_NAME_STRING ) ) { TQGroupBox *gb = (TQGroupBox*)widget; gb->setColumnLayout( 0, Qt::Vertical ); - gb->layout()->setMargin( 0 ); - gb->layout()->setSpacing( 0 ); + gb->tqlayout()->setMargin( 0 ); + gb->tqlayout()->setSpacing( 0 ); TQLayout *l; switch ( type ) { case HBox: - l = new TQHBoxLayout( gb->layout() ); - MetaDataBase::setMargin( gb, margin ); - MetaDataBase::setSpacing( gb, spacing ); - l->setAlignment( AlignTop ); - MetaDataBase::addEntry( l ); + l = new TQHBoxLayout( gb->tqlayout() ); + MetaDataBase::setMargin( TQT_TQOBJECT(gb), margin ); + MetaDataBase::setSpacing( TQT_TQOBJECT(gb), spacing ); + l->tqsetAlignment( AlignTop ); + MetaDataBase::addEntry( TQT_TQOBJECT(l) ); return l; case VBox: - l = new TQVBoxLayout( gb->layout(), spacing ); - MetaDataBase::setMargin( gb, margin ); - MetaDataBase::setSpacing( gb, spacing ); - l->setAlignment( AlignTop ); - MetaDataBase::addEntry( l ); + l = new TQVBoxLayout( gb->tqlayout(), spacing ); + MetaDataBase::setMargin( TQT_TQOBJECT(gb), margin ); + MetaDataBase::setSpacing( TQT_TQOBJECT(gb), spacing ); + l->tqsetAlignment( AlignTop ); + MetaDataBase::addEntry( TQT_TQOBJECT(l) ); return l; case Grid: - l = new QDesignerGridLayout( gb->layout() ); - MetaDataBase::setMargin( gb, margin ); - MetaDataBase::setSpacing( gb, spacing ); - l->setAlignment( AlignTop ); - MetaDataBase::addEntry( l ); + l = new TQDesignerGridLayout( gb->tqlayout() ); + MetaDataBase::setMargin( TQT_TQOBJECT(gb), margin ); + MetaDataBase::setSpacing( TQT_TQOBJECT(gb), spacing ); + l->tqsetAlignment( AlignTop ); + MetaDataBase::addEntry( TQT_TQOBJECT(l) ); return l; default: return 0; } } else { - if ( layout ) { + if ( tqlayout ) { TQLayout *l; switch ( type ) { case HBox: - l = new TQHBoxLayout( layout ); - MetaDataBase::addEntry( l ); + l = new TQHBoxLayout( tqlayout ); + MetaDataBase::addEntry( TQT_TQOBJECT(l) ); l->setSpacing( spacing ); l->setMargin( margin ); - MetaDataBase::addEntry( l ); + MetaDataBase::addEntry( TQT_TQOBJECT(l) ); return l; case VBox: - l = new TQVBoxLayout( layout ); - MetaDataBase::addEntry( l ); + l = new TQVBoxLayout( tqlayout ); + MetaDataBase::addEntry( TQT_TQOBJECT(l) ); l->setSpacing( spacing ); l->setMargin( margin ); - MetaDataBase::addEntry( l ); + MetaDataBase::addEntry( TQT_TQOBJECT(l) ); return l; case Grid: { - l = new QDesignerGridLayout( layout ); - MetaDataBase::addEntry( l ); + l = new TQDesignerGridLayout( tqlayout ); + MetaDataBase::addEntry( TQT_TQOBJECT(l) ); l->setSpacing( spacing ); l->setMargin( margin ); - MetaDataBase::addEntry( l ); + MetaDataBase::addEntry( TQT_TQOBJECT(l) ); return l; } default: @@ -764,39 +764,39 @@ TQLayout *WidgetFactory::createLayout( TQWidget *widget, TQLayout *layout, Layou switch ( type ) { case HBox: l = new TQHBoxLayout( widget ); - MetaDataBase::addEntry( l ); + MetaDataBase::addEntry( TQT_TQOBJECT(l) ); if ( widget ) { - MetaDataBase::setMargin( widget, margin ); - MetaDataBase::setSpacing( widget, spacing ); + MetaDataBase::setMargin( TQT_TQOBJECT(widget), margin ); + MetaDataBase::setSpacing( TQT_TQOBJECT(widget), spacing ); } else { l->setMargin( margin ); l->setSpacing( margin ); } - MetaDataBase::addEntry( l ); + MetaDataBase::addEntry( TQT_TQOBJECT(l) ); return l; case VBox: l = new TQVBoxLayout( widget ); - MetaDataBase::addEntry( l ); + MetaDataBase::addEntry( TQT_TQOBJECT(l) ); if ( widget ) { - MetaDataBase::setMargin( widget, margin ); - MetaDataBase::setSpacing( widget, spacing ); + MetaDataBase::setMargin( TQT_TQOBJECT(widget), margin ); + MetaDataBase::setSpacing( TQT_TQOBJECT(widget), spacing ); } else { l->setMargin( margin ); l->setSpacing( margin ); } - MetaDataBase::addEntry( l ); + MetaDataBase::addEntry( TQT_TQOBJECT(l) ); return l; case Grid: { - l = new QDesignerGridLayout( widget ); - MetaDataBase::addEntry( l ); + l = new TQDesignerGridLayout( widget ); + MetaDataBase::addEntry( TQT_TQOBJECT(l) ); if ( widget ) { - MetaDataBase::setMargin( widget, margin ); - MetaDataBase::setSpacing( widget, spacing ); + MetaDataBase::setMargin( TQT_TQOBJECT(widget), margin ); + MetaDataBase::setSpacing( TQT_TQOBJECT(widget), spacing ); } else { l->setMargin( margin ); l->setSpacing( margin ); } - MetaDataBase::addEntry( l ); + MetaDataBase::addEntry( TQT_TQOBJECT(l) ); return l; } default: @@ -819,17 +819,17 @@ void WidgetFactory::deleteLayout( TQWidget *widget ) widget = ((TQMainWindow*)widget)->centralWidget(); if ( widget->inherits( TQWIDGETSTACK_OBJECT_NAME_STRING ) ) widget = ((TQWidgetStack*)widget)->visibleWidget(); - delete widget->layout(); + delete widget->tqlayout(); } /*! Factory functions for creating a widget of the type \a className - as child of \a parent with the name \a name. + as child of \a tqparent with the name \a name. 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, +TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *tqparent, const char *name, bool init, const TQRect *r, Qt::Orientation orient ) { if (className == TQPUSHBUTTON_OBJECT_NAME_STRING) @@ -837,11 +837,11 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare TQPushButton *b = 0; if (init) { - b = new QDesignerPushButton(parent, name); - b->setText(TQString::fromLatin1(name)); + b = new TQDesignerPushButton(tqparent, name); + b->setText(TQString::tqfromLatin1(name)); } else { - b = new QDesignerPushButton(parent, name); + b = new TQDesignerPushButton(tqparent, name); } TQWidget *w = find_formwindow(b); b->setAutoDefault(w && ((FormWindow *) w)->mainContainer()->inherits(TQDIALOG_OBJECT_NAME_STRING)); @@ -850,43 +850,43 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare { if (init) { - QDesignerToolButton *tb = new QDesignerToolButton(parent, name); + TQDesignerToolButton *tb = new TQDesignerToolButton(tqparent, name); tb->setText("..."); return tb; } - return new QDesignerToolButton(parent, name); + return new TQDesignerToolButton(tqparent, name); } else if (className == TQCHECKBOX_OBJECT_NAME_STRING) { if (init) { - QDesignerCheckBox *cb = new QDesignerCheckBox(parent, name); - cb->setText(TQString::fromLatin1(name)); + TQDesignerCheckBox *cb = new TQDesignerCheckBox(tqparent, name); + cb->setText(TQString::tqfromLatin1(name)); return cb; } - return new QDesignerCheckBox(parent, name); + return new TQDesignerCheckBox(tqparent, name); } else if (className == TQRADIOBUTTON_OBJECT_NAME_STRING) { if (init) { - QDesignerRadioButton *rb = new QDesignerRadioButton(parent, name); - rb->setText(TQString::fromLatin1(name)); + TQDesignerRadioButton *rb = new TQDesignerRadioButton(tqparent, name); + rb->setText(TQString::tqfromLatin1(name)); return rb; } - return new QDesignerRadioButton(parent, name); + return new TQDesignerRadioButton(tqparent, name); } else if (className == TQGROUPBOX_OBJECT_NAME_STRING) { if (init) - return new TQGroupBox(TQString::fromLatin1(name), parent, name); - return new TQGroupBox(parent, name); + return new TQGroupBox(TQString::tqfromLatin1(name), tqparent, name); + return new TQGroupBox(tqparent, name); } else if (className == TQBUTTONGROUP_OBJECT_NAME_STRING) { if (init) - return new TQButtonGroup(TQString::fromLatin1(name), parent, name); - return new TQButtonGroup(parent, name); + return new TQButtonGroup(TQString::tqfromLatin1(name), tqparent, name); + return new TQButtonGroup(tqparent, name); } else if (className == TQICONVIEW_OBJECT_NAME_STRING) { -#if !defined(QT_NO_ICONVIEW) - TQIconView *iv = new TQIconView(parent, name); +#if !defined(TQT_NO_ICONVIEW) + TQIconView *iv = new TQIconView(tqparent, name); if (init) (void) new TQIconViewItem(iv, i18n("New Item")); return iv; @@ -895,30 +895,30 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare #endif } else if (className == TQTABLE_OBJECT_NAME_STRING) { -#if !defined(QT_NO_TABLE) +#if !defined(TQT_NO_TABLE) if (init) - return new TQTable(3, 3, parent, name); - return new TQTable(parent, name); + return new TQTable(3, 3, tqparent, name); + return new TQTable(tqparent, name); #else return 0; #endif -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL } else if (className == TQDATATABLE_OBJECT_NAME_STRING) { - return new TQDataTable(parent, name); -#endif //QT_NO_SQL + return new TQDataTable(tqparent, name); +#endif //TQT_NO_SQL } else if (className == TQDATEEDIT_OBJECT_NAME_STRING) { - return new QDateEdit(parent, name); + return new TQDateEdit(tqparent, name); } else if (className == TQTIMEEDIT_OBJECT_NAME_STRING) { - return new QTimeEdit(parent, name); + return new TQTimeEdit(tqparent, name); } else if (className == TQDATETIMEEDIT_OBJECT_NAME_STRING) { - return new QDateTimeEdit(parent, name); + return new TQDateTimeEdit(tqparent, name); } else if (className == TQLISTBOX_OBJECT_NAME_STRING) { - TQListBox *lb = new TQListBox(parent, name); + TQListBox *lb = new TQListBox(tqparent, name); if (init) { lb->insertItem(i18n("New Item")); @@ -927,7 +927,7 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare return lb; } else if (className == TQLISTVIEW_OBJECT_NAME_STRING) { - TQListView *lv = new TQListView(parent, name); + TQListView *lv = new TQListView(tqparent, name); lv->setSorting(-1); if (init) { @@ -936,91 +936,91 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare } return lv; } else if (className == TQLINEEDIT_OBJECT_NAME_STRING) - return new TQLineEdit(parent, name); + return new TQLineEdit(tqparent, name); else if (className == TQSPINBOX_OBJECT_NAME_STRING) - return new TQSpinBox(parent, name); + return new TQSpinBox(tqparent, name); else if (className == TQSPLITTER_OBJECT_NAME_STRING) - return new TQSplitter(parent, name); + return new TQSplitter(tqparent, name); else if (className == TQMULTILINEEDIT_OBJECT_NAME_STRING) - return new TQMultiLineEdit(parent, name); + return new TQMultiLineEdit(tqparent, name); else if (className == TQTEXTEDIT_OBJECT_NAME_STRING) - return new TQTextEdit(parent, name); + return new TQTextEdit(tqparent, name); else if (className == TQLABEL_OBJECT_NAME_STRING) { - QDesignerLabel *l = new QDesignerLabel(parent, name); + TQDesignerLabel *l = new TQDesignerLabel(tqparent, name); if (init) { - l->setText(TQString::fromLatin1(name)); - MetaDataBase::addEntry(l); - MetaDataBase::setPropertyChanged(l, "text", true); + l->setText(TQString::tqfromLatin1(name)); + MetaDataBase::addEntry(TQT_TQOBJECT(l)); + MetaDataBase::setPropertyChanged(TQT_TQOBJECT(l), "text", true); } return l; } else if (className == TQLAYOUTWIDGET_OBJECT_NAME_STRING) - return new QLayoutWidget(parent, name); + return new TQLayoutWidget(tqparent, name); else if (className == TQTABWIDGET_OBJECT_NAME_STRING) { - TQTabWidget *tw = new QDesignerTabWidget(parent, name); + TQTabWidget *tw = new TQDesignerTabWidget(tqparent, name); if (init) { - FormWindow *fw = find_formwindow(parent); - TQWidget *w = fw ? new QDesignerWidget(fw, tw, "tab") : new TQWidget(tw, "tab"); + FormWindow *fw = find_formwindow(tqparent); + TQWidget *w = fw ? new TQDesignerWidget(fw, tw, "tab") : new TQWidget(tw, "tab"); tw->addTab(w, i18n("Tab 1")); - MetaDataBase::addEntry(w); - w = fw ? new QDesignerWidget(fw, tw, "tab") : new TQWidget(tw, "tab"); + MetaDataBase::addEntry(TQT_TQOBJECT(w)); + w = fw ? new TQDesignerWidget(fw, tw, "tab") : new TQWidget(tw, "tab"); tw->addTab(w, i18n("Tab 2")); - MetaDataBase::addEntry(tw); - MetaDataBase::addEntry(w); + MetaDataBase::addEntry(TQT_TQOBJECT(tw)); + MetaDataBase::addEntry(TQT_TQOBJECT(w)); } return tw; } else if (className == TQCOMBOBOX_OBJECT_NAME_STRING) { - return new TQComboBox(false, parent, name); + return new TQComboBox(false, tqparent, name); } else if (className == TQWIDGET_OBJECT_NAME_STRING) { - if (parent && - (parent->inherits("FormWindow") || parent->inherits(TQWIZARD_OBJECT_NAME_STRING) - || parent->inherits(TQTABWIDGET_OBJECT_NAME_STRING) || parent->inherits(TQTOOLBOX_OBJECT_NAME_STRING) || parent->inherits(TQMAINWINDOW_OBJECT_NAME_STRING))) + if (tqparent && + (tqparent->inherits("FormWindow") || tqparent->inherits(TQWIZARD_OBJECT_NAME_STRING) + || tqparent->inherits(TQTABWIDGET_OBJECT_NAME_STRING) || tqparent->inherits(TQTOOLBOX_OBJECT_NAME_STRING) || tqparent->inherits(TQMAINWINDOW_OBJECT_NAME_STRING))) { - FormWindow *fw = find_formwindow(parent); + FormWindow *fw = find_formwindow(tqparent); if (fw) { - QDesignerWidget *dw = new QDesignerWidget(fw, parent, name); - MetaDataBase::addEntry(dw); + TQDesignerWidget *dw = new TQDesignerWidget(fw, tqparent, name); + MetaDataBase::addEntry(TQT_TQOBJECT(dw)); return dw; } } - return new TQWidget(parent, name); + return new TQWidget(tqparent, name); } else if (className == TQDIALOG_OBJECT_NAME_STRING) { TQDialog *dia = 0; - if (parent && parent->inherits("FormWindow")) - dia = new QDesignerDialog((FormWindow *) parent, parent, name); + if (tqparent && tqparent->inherits("FormWindow")) + dia = new TQDesignerDialog((FormWindow *) tqparent, tqparent, name); else - dia = new TQDialog(parent, name); - if (parent && !parent->inherits("MainWindow")) - dia->reparent(parent, TQPoint(0, 0), true); + dia = new TQDialog(tqparent, name); + if (tqparent && !tqparent->inherits("MainWindow")) + dia->reparent(tqparent, TQPoint(0, 0), true); return dia; } else if (className == TQWIZARD_OBJECT_NAME_STRING) { - TQWizard *wiz = new QDesignerWizard(parent, name); - if (parent && !parent->inherits("MainWindow")) + TQWizard *wiz = new TQDesignerWizard(tqparent, name); + if (tqparent && !tqparent->inherits("MainWindow")) { - wiz->reparent(parent, TQPoint(0, 0), true); + wiz->reparent(tqparent, TQPoint(0, 0), true); } - if (init && parent && parent->inherits("FormWindow")) + if (init && tqparent && tqparent->inherits("FormWindow")) { - QDesignerWidget *dw = new QDesignerWidget((FormWindow *) parent, wiz, "page"); - MetaDataBase::addEntry(dw); + TQDesignerWidget *dw = new TQDesignerWidget((FormWindow *) tqparent, wiz, "page"); + MetaDataBase::addEntry(TQT_TQOBJECT(dw)); wiz->addPage(dw, i18n("Page")); TQTimer::singleShot(0, wiz, TQT_SLOT(next())); } return wiz; } else if (className == "Spacer") { - Spacer *s = new Spacer(parent, name); - MetaDataBase::addEntry(s); - MetaDataBase::setPropertyChanged(s, "orientation", true); - MetaDataBase::setPropertyChanged(s, "sizeType", true); + Spacer *s = new Spacer(tqparent, name); + MetaDataBase::addEntry(TQT_TQOBJECT(s)); + MetaDataBase::setPropertyChanged(TQT_TQOBJECT(s), "orientation", true); + MetaDataBase::setPropertyChanged(TQT_TQOBJECT(s), "sizeType", true); if (!r) return s; if (!r->isValid() || r->width() < 2 && r->height() < 2) @@ -1031,53 +1031,53 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare s->setOrientation(Qt::Horizontal); return s; } else if (className == TQLCDNUMBER_OBJECT_NAME_STRING) - return new TQLCDNumber(parent, name); + return new TQLCDNumber(tqparent, name); else if (className == TQPROGRESSBAR_OBJECT_NAME_STRING) - return new TQProgressBar(parent, name); + return new TQProgressBar(tqparent, name); else if (className == TQTEXTVIEW_OBJECT_NAME_STRING) - return new TQTextView(parent, name); + return new TQTextView(tqparent, name); else if (className == TQTEXTBROWSER_OBJECT_NAME_STRING) - return new TQTextBrowser(parent, name); + return new TQTextBrowser(tqparent, name); else if (className == TQDIAL_OBJECT_NAME_STRING) - return new TQDial(parent, name); + return new TQDial(tqparent, name); else if (className == TQSLIDER_OBJECT_NAME_STRING) { - TQSlider *s = new TQSlider(parent, name); + TQSlider *s = new TQSlider(tqparent, 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(s); - MetaDataBase::setPropertyChanged(s, "orientation", true); + MetaDataBase::addEntry(TQT_TQOBJECT(s)); + MetaDataBase::setPropertyChanged(TQT_TQOBJECT(s), "orientation", true); return s; } else if (className == TQSCROLLBAR_OBJECT_NAME_STRING) { - TQScrollBar *s = new TQScrollBar(parent, name); + TQScrollBar *s = new TQScrollBar(tqparent, 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(s); - MetaDataBase::setPropertyChanged(s, "orientation", true); + MetaDataBase::addEntry(TQT_TQOBJECT(s)); + MetaDataBase::setPropertyChanged(TQT_TQOBJECT(s), "orientation", true); return s; } else if (className == TQFRAME_OBJECT_NAME_STRING) { if (!init) - return new TQFrame(parent, name); - TQFrame *f = new TQFrame(parent, name); + return new TQFrame(tqparent, name); + TQFrame *f = new TQFrame(tqparent, name); f->setFrameStyle(TQFrame::StyledPanel | TQFrame::Raised); return f; } else if (className == "Line") { - Line *l = new Line(parent, name); - MetaDataBase::addEntry(l); - MetaDataBase::setPropertyChanged(l, "orientation", true); - MetaDataBase::setPropertyChanged(l, "frameShadow", true); - MetaDataBase::setPropertyChanged(l, "frameShape", true); + Line *l = new Line(tqparent, 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); if (!r) return l; if (!r->isValid() || r->width() < 2 && r->height() < 2) @@ -1087,38 +1087,38 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare return l; } else if (className == TQMAINWINDOW_OBJECT_NAME_STRING) { - TQMainWindow *mw = new KmdrMainWindow(parent, name, 0); - mw->setDockEnabled(Qt::DockMinimized, false); - QDesignerWidget *dw = new QDesignerWidget((FormWindow *) parent, mw, "central widget"); + TQMainWindow *mw = new KmdrMainWindow(tqparent, name, 0); + mw->setDockEnabled(TQt::DockMinimized, false); + TQDesignerWidget *dw = new TQDesignerWidget((FormWindow *) tqparent, mw, "central widget"); mw->setDockMenuEnabled(false); - MetaDataBase::addEntry(dw); + MetaDataBase::addEntry(TQT_TQOBJECT(dw)); mw->setCentralWidget(dw); (void) mw->statusBar(); dw->show(); return mw; } -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL else if (className == TQDATABROWSER_OBJECT_NAME_STRING) { - TQWidget *w = new QDesignerDataBrowser(parent, name); - if (parent) - w->reparent(parent, TQPoint(0, 0), true); + TQWidget *w = new TQDesignerDataBrowser(tqparent, name); + if (tqparent) + w->reparent(tqparent, TQPoint(0, 0), true); return w; } else if (className == TQDATAVIEW_OBJECT_NAME_STRING) { - TQWidget *w = new QDesignerDataView(parent, name); - if (parent) - w->reparent(parent, TQPoint(0, 0), true); + TQWidget *w = new TQDesignerDataView(tqparent, name); + if (tqparent) + w->reparent(tqparent, TQPoint(0, 0), true); return w; } #endif #ifdef KOMMANDER if (className == "LineEdit") - return new LineEdit(parent, name); + return new LineEdit(tqparent, name); else if (className == "ListView") { - TQListView *lv = new TQListView(parent, name); + TQListView *lv = new TQListView(tqparent, name); lv->setSorting(-1); if (init) { @@ -1130,29 +1130,29 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare else if (className == "Dialog") { TQDialog *dia = 0; - if (parent && parent->inherits("FormWindow")) - dia = new EditorDialog((FormWindow *) parent, parent, name); + if (tqparent && tqparent->inherits("FormWindow")) + dia = new EditorDialog((FormWindow *) tqparent, tqparent, name); else - dia = new Dialog(parent, name, false); + dia = new Dialog(tqparent, name, false); - if (parent) - dia->reparent(parent, TQPoint(0, 0), true); + if (tqparent) + dia->reparent(tqparent, TQPoint(0, 0), true); return dia; } else if (className == "Wizard") { //qDebug("Creating Wizard..."); TQWizard *wiz; - if (parent && parent->inherits("FormWindow")) - wiz = new QDesignerWizard(parent, name); + if (tqparent && tqparent->inherits("FormWindow")) + wiz = new TQDesignerWizard(tqparent, name); else - wiz = new Wizard(parent, name); - if (parent) - wiz->reparent(parent, TQPoint(0, 0), true); - if (init && parent && parent->inherits("FormWindow")) + wiz = new Wizard(tqparent, name); + if (tqparent) + wiz->reparent(tqparent, TQPoint(0, 0), true); + if (init && tqparent && tqparent->inherits("FormWindow")) { - QDesignerWidget *dw = new QDesignerWidget((FormWindow *) parent, wiz, "page"); - MetaDataBase::addEntry(dw); + TQDesignerWidget *dw = new TQDesignerWidget((FormWindow *) tqparent, wiz, "page"); + MetaDataBase::addEntry(TQT_TQOBJECT(dw)); wiz->addPage(dw, i18n("Page 1")); wiz->addPage(dw, i18n("Page 2")); TQTimer::singleShot(0, wiz, TQT_SLOT(next())); @@ -1161,74 +1161,74 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare } else if (className == "TabWidget") { - TQTabWidget *tw = new EditorTabWidget(parent, name); + TQTabWidget *tw = new EditorTabWidget(tqparent, name); if (init) { - FormWindow *fw = find_formwindow(parent); - TQWidget *w = fw ? new QDesignerWidget(fw, tw, "tab") : new TQWidget(tw, "tab"); + FormWindow *fw = find_formwindow(tqparent); + TQWidget *w = fw ? new TQDesignerWidget(fw, tw, "tab") : new TQWidget(tw, "tab"); tw->addTab(w, i18n("Tab 1")); - MetaDataBase::addEntry(w); - w = fw ? new QDesignerWidget(fw, tw, "tab") : new TQWidget(tw, "tab"); + MetaDataBase::addEntry(TQT_TQOBJECT(w)); + w = fw ? new TQDesignerWidget(fw, tw, "tab") : new TQWidget(tw, "tab"); tw->addTab(w, i18n("Tab 2")); - MetaDataBase::addEntry(tw); - MetaDataBase::addEntry(w); + MetaDataBase::addEntry(TQT_TQOBJECT(tw)); + MetaDataBase::addEntry(TQT_TQOBJECT(w)); } return tw; } else if (className == "ToolBox") { - TQToolBox *tw = new EditorToolBox(parent, name); + TQToolBox *tw = new EditorToolBox(tqparent, name); if (init) { - FormWindow *fw = find_formwindow(parent); - TQWidget *w = fw ? new QDesignerWidget(fw, tw, "toolbox") : new TQWidget(tw, "toolbox"); + FormWindow *fw = find_formwindow(tqparent); + TQWidget *w = fw ? new TQDesignerWidget(fw, tw, "toolbox") : new TQWidget(tw, "toolbox"); tw->addItem(w, i18n("Page 1")); - MetaDataBase::addEntry(w); - w = fw ? new QDesignerWidget(fw, tw, "toolbox") : new TQWidget(tw, "toolbox"); + MetaDataBase::addEntry(TQT_TQOBJECT(w)); + w = fw ? new TQDesignerWidget(fw, tw, "toolbox") : new TQWidget(tw, "toolbox"); tw->addItem(w, i18n("Page 2")); - MetaDataBase::addEntry(tw); - MetaDataBase::addEntry(w); + MetaDataBase::addEntry(TQT_TQOBJECT(tw)); + MetaDataBase::addEntry(TQT_TQOBJECT(w)); } return tw; } else if (className == "ExecButton") - return new ExecButton(parent, name); + return new ExecButton(tqparent, name); else if (className == "CloseButton") - return new CloseButton(parent, name); + return new CloseButton(tqparent, name); else if (className == "SubDialog") - return new SubDialog(parent, name); + return new SubDialog(tqparent, name); else if (className == "FileSelector") - return new FileSelector(parent, name); + return new FileSelector(tqparent, name); else if (className == "TextEdit") - return new TextEdit(parent, name); + return new TextEdit(tqparent, name); else if (className == "RadioButton") - return new RadioButton(parent, name); + return new RadioButton(tqparent, name); else if (className == "ButtonGroup") - return new ButtonGroup(parent, name); + return new ButtonGroup(tqparent, name); else if (className == "GroupBox") - return new GroupBox(parent, name); + return new GroupBox(tqparent, name); else if (className == "CheckBox") - return new CheckBox(parent, name); + return new CheckBox(tqparent, name); else if (className == "ComboBox") - return new ComboBox(parent, name); + return new ComboBox(tqparent, name); else if (className == "SpinBoxInt") - return new SpinBoxInt(parent, name); + return new SpinBoxInt(tqparent, name); else if (className == "ListBox") - return new ListBox(parent, name); + return new ListBox(tqparent, name); else if (className == "ScriptObject") - return new ScriptObject(parent, name); + return new ScriptObject(tqparent, name); else if (className == "RichTextEditor") - return new RichTextEditor(parent, name); + return new RichTextEditor(tqparent, name); else if (className == "DatePicker") - return new DatePicker(parent, name); + return new DatePicker(tqparent, name); else if (className == "PopupMenu") - return new PopupMenu(parent, name); + return new PopupMenu(tqparent, name); else if (className == "FontDialog") - return new FontDialog(parent, name); + return new FontDialog(tqparent, name); else if (className == "AboutDialog") - return new AboutDialog(parent, name); + return new AboutDialog(tqparent, name); else if (className == "TreeWidget") { - TQListView *lv = new TreeWidget(parent, name); + TQListView *lv = new TreeWidget(tqparent, name); lv->setSorting(-1); if (init) { @@ -1238,33 +1238,33 @@ TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *pare return lv; } else if (className == "Slider") { - Slider *s = new Slider(parent, name); + Slider *s = new Slider(tqparent, 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(s); - MetaDataBase::setPropertyChanged(s, "orientation", true); + MetaDataBase::addEntry(TQT_TQOBJECT(s)); + MetaDataBase::setPropertyChanged(TQT_TQOBJECT(s), "orientation", true); return s; } #endif - TQWidget *w = KommanderFactory::createWidget(className, parent, name); + TQWidget *w = KommanderFactory::createWidget(className, tqparent, name); return w; } -/*! 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. +/*! 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. */ -WidgetFactory::LayoutType WidgetFactory::layoutType( TQWidget *w, TQLayout *&layout ) +WidgetFactory::LayoutType WidgetFactory::tqlayoutType( TQWidget *w, TQLayout *&tqlayout ) { - layout = 0; + tqlayout = 0; if ( w && w->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) w = ((TQTabWidget*)w)->currentPage(); @@ -1278,19 +1278,19 @@ WidgetFactory::LayoutType WidgetFactory::layoutType( TQWidget *w, TQLayout *&lay w = ((TQWidgetStack*)w)->visibleWidget(); if ( w && w->inherits( TQSPLITTER_OBJECT_NAME_STRING ) ) - return ( (TQSplitter*)w )->orientation() == Horizontal ? HBox : VBox; + return ( (TQSplitter*)w )->orientation() ==Qt::Horizontal ? HBox : VBox; - if ( !w || !w->layout() ) + if ( !w || !w->tqlayout() ) return NoLayout; - TQLayout *lay = w->layout(); + TQLayout *lay = w->tqlayout(); if ( w->inherits( TQGROUPBOX_OBJECT_NAME_STRING ) ) { - TQObjectList *l = lay->queryList( TQLAYOUT_OBJECT_NAME_STRING ); + TQObjectList *l = TQT_TQOBJECT(lay)->queryList( TQLAYOUT_OBJECT_NAME_STRING ); if ( l && l->first() ) lay = (TQLayout*)l->first(); delete l; } - layout = lay; + tqlayout = lay; if ( lay->inherits( TQHBOXLAYOUT_OBJECT_NAME_STRING ) ) return HBox; @@ -1304,13 +1304,13 @@ WidgetFactory::LayoutType WidgetFactory::layoutType( TQWidget *w, TQLayout *&lay /*! \overload */ -WidgetFactory::LayoutType WidgetFactory::layoutType( TQLayout *layout ) +WidgetFactory::LayoutType WidgetFactory::tqlayoutType( TQLayout *tqlayout ) { - if ( layout->inherits( TQHBOXLAYOUT_OBJECT_NAME_STRING ) ) + if ( tqlayout->inherits( TQHBOXLAYOUT_OBJECT_NAME_STRING ) ) return HBox; - else if ( layout->inherits( TQVBOXLAYOUT_OBJECT_NAME_STRING ) ) + else if ( tqlayout->inherits( TQVBOXLAYOUT_OBJECT_NAME_STRING ) ) return VBox; - else if ( layout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) + else if ( tqlayout->inherits( TQGRIDLAYOUT_OBJECT_NAME_STRING ) ) return Grid; return NoLayout; } @@ -1318,25 +1318,25 @@ WidgetFactory::LayoutType WidgetFactory::layoutType( TQLayout *layout ) /*! \overload */ -WidgetFactory::LayoutType WidgetFactory::layoutType( TQWidget *w ) +WidgetFactory::LayoutType WidgetFactory::tqlayoutType( TQWidget *w ) { TQLayout *l = 0; - return layoutType( w, l ); + return tqlayoutType( w, l ); } -TQWidget *WidgetFactory::layoutParent( TQLayout *layout ) +TQWidget *WidgetFactory::tqlayoutParent( TQLayout *tqlayout ) { - TQObject *o = layout; + TQObject *o = TQT_TQOBJECT(tqlayout); while ( o ) { if ( o->isWidgetType() ) return (TQWidget*)o; - o = o->parent(); + o = o->tqparent(); } return 0; } -/*! Returns the widget into which children should be inserted when \a +/*! Returns the widget into which tqchildren 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 @@ -1363,22 +1363,22 @@ TQWidget* WidgetFactory::containerOfWidget( TQWidget *w ) } /*! Returns the actual designer widget of the container \a w. This is - normally \a w itself, but might be a parent or grand parent of \a w + normally \a w itself, but might be a tqparent or grand tqparent of \a w (e.g. when working with a tabwidget and \a w is the container which - contains and layouts childs, but the actual widget known to the - designer is the tabwidget which is the parent of \a w. So this + contains and tqlayouts childs, but the actual widget known to the + designer is the tabwidget which is the tqparent of \a w. So this function returns the tabwidget then.) */ TQWidget* WidgetFactory::widgetOfContainer( TQWidget *w ) { - if ( w->parentWidget() && w->parentWidget()->inherits( TQWIDGETSTACK_OBJECT_NAME_STRING ) ) - w = w->parentWidget(); + if ( w->tqparentWidget() && w->tqparentWidget()->inherits( TQWIDGETSTACK_OBJECT_NAME_STRING ) ) + w = w->tqparentWidget(); while ( w ) { - if ( WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( w ) ) ) || - w && w->parentWidget() && w->parentWidget()->inherits( "FormWindow" ) ) + if ( WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( TQT_TQOBJECT(w) ) ) ) || + w && w->tqparentWidget() && w->tqparentWidget()->inherits( "FormWindow" ) ) return w; - w = w->parentWidget(); + w = w->tqparentWidget(); } return w; } @@ -1391,15 +1391,15 @@ bool WidgetFactory::isPassiveInteractor( TQObject* 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 true; - if ( o->inherits( TQTABBAR_OBJECT_NAME_STRING ) || ::qt_cast<TQToolBox*>(o->parent()) ) + if ( o->inherits( TQTABBAR_OBJECT_NAME_STRING ) || ::tqqt_cast<TQToolBox*>(o->tqparent()) ) return true; else if ( o->inherits( TQSIZEGRIP_OBJECT_NAME_STRING ) ) return true; - else if ( o->inherits( TQTOOLBUTTON_OBJECT_NAME_STRING ) && o->parent() && o->parent()->inherits( TQTABBAR_OBJECT_NAME_STRING ) ) + else if ( o->inherits( TQTOOLBUTTON_OBJECT_NAME_STRING ) && o->tqparent() && o->tqparent()->inherits( TQTABBAR_OBJECT_NAME_STRING ) ) return true; - else if ( o->parent() && o->parent()->inherits( TQWIZARD_OBJECT_NAME_STRING ) && o->inherits( TQPUSHBUTTON_OBJECT_NAME_STRING ) ) + else if ( o->tqparent() && o->tqparent()->inherits( TQWIZARD_OBJECT_NAME_STRING ) && o->inherits( TQPUSHBUTTON_OBJECT_NAME_STRING ) ) return true; - else if ( o->parent() && o->parent()->inherits( TQMAINWINDOW_OBJECT_NAME_STRING ) && o->inherits( TQMENUBAR_OBJECT_NAME_STRING ) ) + else if ( o->tqparent() && o->tqparent()->inherits( TQMAINWINDOW_OBJECT_NAME_STRING ) && o->inherits( TQMENUBAR_OBJECT_NAME_STRING ) ) return true; else if ( o->inherits( TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING ) ) return true; @@ -1415,43 +1415,43 @@ bool WidgetFactory::isPassiveInteractor( TQObject* o ) */ const char* WidgetFactory::classNameOf( TQObject* o ) { - if (o->inherits("QDesignerTabWidget")) - return "TQTabWidget"; + if (o->inherits("TQDesignerTabWidget")) + return TQTABWIDGET_OBJECT_NAME_STRING; #ifdef KOMMANDER else if (o->inherits("EditorTabWidget")) return "TabWidget"; else if (o->inherits("EditorToolBox")) return "ToolBox"; #endif - else if (o->inherits("QDesignerDialog")) - return "TQDialog"; - else if (o->inherits("QDesignerWidget")) - return "TQWidget"; + else if (o->inherits("TQDesignerDialog")) + return TQDIALOG_OBJECT_NAME_STRING; + else if (o->inherits("TQDesignerWidget")) + return TQWIDGET_OBJECT_NAME_STRING; else if (o->inherits("CustomWidget")) return ((CustomWidget *) o)->realClassName().latin1(); - else if (o->inherits("QDesignerLabel")) - return "TQLabel"; - else if (o->inherits("QDesignerWizard")) - return "TQWizard"; + else if (o->inherits("TQDesignerLabel")) + return TQLABEL_OBJECT_NAME_STRING; + else if (o->inherits("TQDesignerWizard")) + return TQWIZARD_OBJECT_NAME_STRING; else if (o->inherits("EditorWizard")) return "Wizard"; - else if (o->inherits("QDesignerPushButton")) - return "TQPushButton"; - else if (o->inherits("QDesignerToolButton")) - return "TQToolButton"; - else if (o->inherits("QDesignerRadioButton")) - return "TQRadioButton"; - else if (o->inherits("QDesignerCheckBox")) - return "TQCheckBox"; - else if (o->inherits("QDesignerMenuBar")) - return "TQMenuBar"; - else if (o->inherits("QDesignerToolBar")) - return "TQToolBar"; -#ifndef QT_NO_SQL - else if (o->inherits("QDesignerDataBrowser")) - return "TQDataBrowser"; - else if (o->inherits("QDesignerDataView")) - return "TQDataView"; + else if (o->inherits("TQDesignerPushButton")) + return TQPUSHBUTTON_OBJECT_NAME_STRING; + else if (o->inherits("TQDesignerToolButton")) + return TQTOOLBUTTON_OBJECT_NAME_STRING; + else if (o->inherits("TQDesignerRadioButton")) + return TQRADIOBUTTON_OBJECT_NAME_STRING; + else if (o->inherits("TQDesignerCheckBox")) + return TQCHECKBOX_OBJECT_NAME_STRING; + else if (o->inherits("TQDesignerMenuBar")) + return TQMENUBAR_OBJECT_NAME_STRING; + else if (o->inherits("TQDesignerToolBar")) + return TQTOOLBAR_OBJECT_NAME_STRING; +#ifndef TQT_NO_SQL + else if (o->inherits("TQDesignerDataBrowser")) + return TQDATABROWSER_OBJECT_NAME_STRING; + else if (o->inherits("TQDesignerDataView")) + return TQDATAVIEW_OBJECT_NAME_STRING; #endif else if (o->inherits("EditorDialog")) return "Dialog"; @@ -1466,12 +1466,12 @@ const char* WidgetFactory::classNameOf( TQObject* o ) void WidgetFactory::initChangedProperties( TQObject *o ) { MetaDataBase::setPropertyChanged( o, "name", true ); - if ( !o->inherits( "QDesignerToolBar" ) && !o->inherits( "QDesignerMenuBar" ) ) + if ( !o->inherits( "TQDesignerToolBar" ) && !o->inherits( "TQDesignerMenuBar" ) ) MetaDataBase::setPropertyChanged( o, "geometry", true ); if ( o->inherits( TQPUSHBUTTON_OBJECT_NAME_STRING ) || o->inherits(TQRADIOBUTTON_OBJECT_NAME_STRING) || o->inherits( TQCHECKBOX_OBJECT_NAME_STRING ) || o->inherits( TQTOOLBUTTON_OBJECT_NAME_STRING ) ) MetaDataBase::setPropertyChanged( o, "text", true ); - else if (::qt_cast<TQToolButton*>(o) && ::qt_cast<TQToolBox*>(widgetOfContainer((TQWidget*)o->parent()))) { + else if (::tqqt_cast<TQToolButton*>(o) && ::tqqt_cast<TQToolBox*>(widgetOfContainer((TQWidget*)o->tqparent()))) { MetaDataBase::setPropertyChanged( o, "usesTextLabel", TRUE ); MetaDataBase::setPropertyChanged( o, "textLabel", TRUE ); MetaDataBase::setPropertyChanged( o, "autoRaise", TRUE ); @@ -1484,7 +1484,7 @@ void WidgetFactory::initChangedProperties( TQObject *o ) } else if ( o->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) || o->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) { MetaDataBase::setPropertyChanged( o, "pageTitle", true ); MetaDataBase::setPropertyChanged( o, "pageName", true ); -#ifndef QT_NO_TABLE +#ifndef TQT_NO_TABLE } else if ( o->inherits( TQTABLE_OBJECT_NAME_STRING ) && !o->inherits( TQDATATABLE_OBJECT_NAME_STRING ) ) { MetaDataBase::setPropertyChanged( o, "numRows", true ); MetaDataBase::setPropertyChanged( o, "numCols", true ); @@ -1494,7 +1494,7 @@ void WidgetFactory::initChangedProperties( TQObject *o ) t->verticalHeader()->setLabel( i, TQString::number( i + 1 ) ); } #endif - } else if ( ::qt_cast<TQToolBox*>(o) ) { + } else if ( ::tqqt_cast<TQToolBox*>(o) ) { MetaDataBase::setPropertyChanged( o, "currentIndex", true ); MetaDataBase::setPropertyChanged( o, "itemName", true ); MetaDataBase::setPropertyChanged( o, "itemLabel", true ); @@ -1503,9 +1503,9 @@ void WidgetFactory::initChangedProperties( TQObject *o ) MetaDataBase::setPropertyChanged( o, "itemBackgroundMode", true ); } else if ( o->inherits( TQSPLITTER_OBJECT_NAME_STRING ) ) { MetaDataBase::setPropertyChanged( o, "orientation", true ); - } else if ( o->inherits( "QDesignerToolBar" ) ) { + } else if ( o->inherits( "TQDesignerToolBar" ) ) { MetaDataBase::setPropertyChanged( o, "label", true ); - } else if ( o->inherits( "QDesignerMenuBar" ) ) { + } else if ( o->inherits( "TQDesignerMenuBar" ) ) { MetaDataBase::setPropertyChanged( o, "itemName", true ); MetaDataBase::setPropertyChanged( o, "itemNumber", true ); MetaDataBase::setPropertyChanged( o, "itemText", true ); @@ -1530,7 +1530,7 @@ bool WidgetFactory::hasSpecialEditor( int id ) return true; if (className == TQTEXTEDIT_OBJECT_NAME_STRING || className == TQMULTILINEEDIT_OBJECT_NAME_STRING) return true; - if (className.contains("Table")) + if (className.tqcontains("Table")) return true; return false; @@ -1544,13 +1544,13 @@ bool WidgetFactory::hasItems( int id ) return true; if (className.mid(1) == "ListBox" || className.mid(1) == "ListView" || className.mid(1) == "IconView" || className.mid(1) == "ComboBox" || - className.contains("Table")) + className.tqcontains("Table")) return true; return false; } -void WidgetFactory::editWidget( int id, TQWidget *parent, TQWidget *editWidget, FormWindow *fw ) +void WidgetFactory::editWidget( int id, TQWidget *tqparent, TQWidget *editWidget, FormWindow *fw ) { TQString className = WidgetDatabase::className(id); @@ -1562,7 +1562,7 @@ void WidgetFactory::editWidget( int id, TQWidget *parent, TQWidget *editWidget, TQComboBox *cb = (TQComboBox *) editWidget; - ListBoxEditor *e = new ListBoxEditor(parent, cb->listBox(), fw); + ListBoxEditor *e = new ListBoxEditor(tqparent, cb->listBox(), fw); e->exec(); delete e; @@ -1572,7 +1572,7 @@ void WidgetFactory::editWidget( int id, TQWidget *parent, TQWidget *editWidget, } if (className == "TextEdit" || className == "TextBrowser") { - MultiLineEditor *e = new MultiLineEditor(parent, editWidget, fw); + MultiLineEditor *e = new MultiLineEditor(tqparent, editWidget, fw); e->exec(); delete e; return; @@ -1582,7 +1582,7 @@ void WidgetFactory::editWidget( int id, TQWidget *parent, TQWidget *editWidget, if (!editWidget->inherits(TQLISTVIEW_OBJECT_NAME_STRING)) return; TQListView *lv = (TQListView *) editWidget; - ListViewEditor *e = new ListViewEditor(parent, lv, fw); + ListViewEditor *e = new ListViewEditor(tqparent, lv, fw); e->exec(); delete e; return; @@ -1591,7 +1591,7 @@ void WidgetFactory::editWidget( int id, TQWidget *parent, TQWidget *editWidget, { if (!editWidget->inherits(TQLISTBOX_OBJECT_NAME_STRING)) return; - ListBoxEditor *e = new ListBoxEditor(parent, editWidget, fw); + ListBoxEditor *e = new ListBoxEditor(tqparent, editWidget, fw); e->exec(); delete e; return; @@ -1601,7 +1601,7 @@ void WidgetFactory::editWidget( int id, TQWidget *parent, TQWidget *editWidget, { if (!editWidget->inherits(TQLISTBOX_OBJECT_NAME_STRING)) return; - ListBoxEditor *e = new ListBoxEditor(parent, editWidget, fw); + ListBoxEditor *e = new ListBoxEditor(tqparent, editWidget, fw); e->exec(); delete e; return; @@ -1612,7 +1612,7 @@ void WidgetFactory::editWidget( int id, TQWidget *parent, TQWidget *editWidget, if (!editWidget->inherits(TQCOMBOBOX_OBJECT_NAME_STRING)) return; TQComboBox *cb = (TQComboBox *) editWidget; - ListBoxEditor *e = new ListBoxEditor(parent, cb->listBox(), fw); + ListBoxEditor *e = new ListBoxEditor(tqparent, cb->listBox(), fw); e->exec(); delete e; cb->update(); @@ -1624,7 +1624,7 @@ void WidgetFactory::editWidget( int id, TQWidget *parent, TQWidget *editWidget, if (!editWidget->inherits(TQLISTVIEW_OBJECT_NAME_STRING)) return; TQListView *lv = (TQListView *) editWidget; - ListViewEditor *e = new ListViewEditor(parent, lv, fw); + ListViewEditor *e = new ListViewEditor(tqparent, lv, fw); e->exec(); delete e; return; @@ -1634,7 +1634,7 @@ void WidgetFactory::editWidget( int id, TQWidget *parent, TQWidget *editWidget, { if (!editWidget->inherits(TQICONVIEW_OBJECT_NAME_STRING)) return; - IconViewEditor *e = new IconViewEditor(parent, editWidget, fw); + IconViewEditor *e = new IconViewEditor(tqparent, editWidget, fw); e->exec(); delete e; return; @@ -1642,15 +1642,15 @@ void WidgetFactory::editWidget( int id, TQWidget *parent, TQWidget *editWidget, if (className == TQMULTILINEEDIT_OBJECT_NAME_STRING || className == TQTEXTEDIT_OBJECT_NAME_STRING) { - MultiLineEditor *e = new MultiLineEditor(parent, editWidget, fw); + MultiLineEditor *e = new MultiLineEditor(tqparent, editWidget, fw); e->exec(); delete e; return; } -#ifndef QT_NO_TABLE - if (className.contains("Table")) +#ifndef TQT_NO_TABLE + if (className.tqcontains("Table")) { - TableEditor *e = new TableEditor(parent, editWidget, fw); + TableEditor *e = new TableEditor(tqparent, editWidget, fw); e->exec(); delete e; return; @@ -1662,14 +1662,14 @@ bool WidgetFactory::canResetProperty( TQObject *w, const TQString &propName ) { if ( propName == "name" || propName == "geometry" ) return false; - TQStringList l = *changedProperties->find( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( w ) ) ); - return l.findIndex( propName ) == -1; + TQStringList l = *changedProperties->tqfind( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( w ) ) ); + return l.tqfindIndex( propName ) == -1; } bool WidgetFactory::resetProperty( TQObject *w, const TQString &propName ) { - const TQMetaProperty *p = w->metaObject()->property( w->metaObject()-> - findProperty( propName, true ), true ); + const TQMetaProperty *p = w->tqmetaObject()->property( w->tqmetaObject()-> + tqfindProperty( propName, true ), true ); if (!p ) return false; return p->reset( w ); @@ -1678,33 +1678,33 @@ bool WidgetFactory::resetProperty( TQObject *w, const TQString &propName ) TQVariant WidgetFactory::defaultValue( TQObject *w, const TQString &propName ) { if ( propName == "wordwrap" ) { - int v = defaultValue( w, "alignment" ).toInt(); + int v = defaultValue( w, "tqalignment" ).toInt(); return TQVariant( ( v & WordBreak ) == WordBreak, 0 ); } else if ( propName == "toolTip" || propName == "whatsThis" ) { - return TQVariant( TQString::fromLatin1( "" ) ); + return TQVariant( TQString::tqfromLatin1( "" ) ); } else if ( w->inherits( "CustomWidget" ) ) { return TQVariant(); } else if ( propName == "frameworkCode" ) { return TQVariant( true, 0 ); - } else if ( propName == "layoutMargin" ) { - if ( w->inherits( "QLayoutWidget" ) ) + } else if ( propName == "tqlayoutMargin" ) { + if ( w->inherits( TQLAYOUTWIDGET_OBJECT_NAME_STRING ) ) return TQVariant( 0 ); else if ( MainWindow::self->formWindow() ) - return TQVariant( MainWindow::self->formWindow()->layoutDefaultMargin() ); - } else if ( propName == "layoutSpacing" ) { + return TQVariant( MainWindow::self->formWindow()->tqlayoutDefaultMargin() ); + } else if ( propName == "tqlayoutSpacing" ) { if ( MainWindow::self->formWindow() ) - return TQVariant( MainWindow::self->formWindow()->layoutDefaultSpacing() ); + return TQVariant( MainWindow::self->formWindow()->tqlayoutDefaultSpacing() ); } - return *( *defaultProperties->find( WidgetDatabase::idFromClassName( classNameOf( w ) ) ) ).find( propName ); + return *( *defaultProperties->tqfind( WidgetDatabase::idFromClassName( classNameOf( w ) ) ) ).tqfind( propName ); } TQString WidgetFactory::defaultCurrentItem( TQObject *w, const TQString &propName ) { - const TQMetaProperty *p = w->metaObject()-> - property( w->metaObject()->findProperty( propName, true ), true ); + const TQMetaProperty *p = w->tqmetaObject()-> + property( w->tqmetaObject()->tqfindProperty( propName, true ), true ); if ( !p ) { - int v = defaultValue( w, "alignment" ).toInt(); + int v = defaultValue( w, "tqalignment" ).toInt(); if ( propName == "hAlign" ) { if ( ( v & AlignAuto ) == AlignAuto ) return "AlignAuto"; @@ -1724,17 +1724,17 @@ TQString WidgetFactory::defaultCurrentItem( TQObject *w, const TQString &propNam if ( ( v & AlignBottom ) == AlignBottom ) return "AlignBottom"; } - return TQString::null; + return TQString(); } return p->valueToKey( defaultValue( w, propName ).toInt() ); } -TQWidget *WidgetFactory::createCustomWidget( TQWidget *parent, const char *name, MetaDataBase::CustomWidget *w ) +TQWidget *WidgetFactory::createCustomWidget( TQWidget *tqparent, const char *name, MetaDataBase::CustomWidget *w ) { if ( !w ) return 0; - return new CustomWidget( parent, name, w ); + return new CustomWidget( tqparent, name, w ); } TQVariant WidgetFactory::property( TQObject *w, const char *name ) @@ -1745,13 +1745,13 @@ TQVariant WidgetFactory::property( TQObject *w, const char *name ) return MetaDataBase::fakeProperty( w, name ); } -void QDesignerLabel::updateBuddy() +void TQDesignerLabel::updateBuddy() { if ( myBuddy.isEmpty() ) return; - TQObjectList *l = topLevelWidget()->queryList( TQWIDGET_OBJECT_NAME_STRING, myBuddy, false, true ); + TQObjectList *l = tqtopLevelWidget()->queryList( TQWIDGET_OBJECT_NAME_STRING, myBuddy, false, true ); if ( !l || !l->first() ) { delete l; return; @@ -1761,12 +1761,12 @@ void QDesignerLabel::updateBuddy() delete l; } -void QDesignerWidget::paintEvent( TQPaintEvent *e ) +void TQDesignerWidget::paintEvent( TQPaintEvent *e ) { formwindow->paintGrid( this, e ); } -void QDesignerDialog::paintEvent( TQPaintEvent *e ) +void TQDesignerDialog::paintEvent( TQPaintEvent *e ) { formwindow->paintGrid( this, e ); } @@ -1776,12 +1776,12 @@ void EditorDialog::paintEvent( TQPaintEvent *e ) formwindow->paintGrid( this, e ); } -TQSizePolicy QLayoutWidget::sizePolicy() const +TQSizePolicy TQLayoutWidget::sizePolicy() const { return sp; } -bool QLayoutWidget::event( TQEvent *e ) +bool TQLayoutWidget::event( TQEvent *e ) { if ( e && ( e->type() == TQEvent::ChildInserted || e->type() == TQEvent::ChildRemoved || @@ -1792,14 +1792,15 @@ bool QLayoutWidget::event( TQEvent *e ) } /* - This function must be called on QLayoutWidget creation and whenever - the QLayoutWidget's parent layout changes (e.g., from a QHBoxLayout - to a TQVBoxLayout), because of the (illogical) way layouting works. + This function must be called on TQLayoutWidget creation and whenever + the TQLayoutWidget's tqparent tqlayout changes (e.g., from a TQHBoxLayout + to a TQVBoxLayout), because of the (illogical) way tqlayouting works. */ -void QLayoutWidget::updateSizePolicy() +void TQLayoutWidget::updateSizePolicy() { - if ( !children() || children()->count() == 0 ) { - sp = TQWidget::sizePolicy(); + TQObjectList clo = childrenListObject(); + if ( clo.isEmpty() || clo.count() == 0 ) { + sp = TQWidget::tqsizePolicy(); return; } @@ -1816,23 +1817,23 @@ void QLayoutWidget::updateSizePolicy() int ht = (int) TQSizePolicy::Preferred; int vt = (int) TQSizePolicy::Preferred; - if ( layout() ) { + if ( tqlayout() ) { /* - parentLayout is set to the parent layout if there is one and if it is - top level, in which case layouting is illogical. + tqparentLayout is set to the tqparent tqlayout if there is one and if it is + top level, in which case tqlayouting is illogical. */ - TQLayout *parentLayout = 0; - if ( parent() && parent()->isWidgetType() ) { - parentLayout = ((TQWidget *)parent())->layout(); - if ( parentLayout && parentLayout->mainWidget()->inherits("QLayoutWidget") ) - parentLayout = 0; + TQLayout *tqparentLayout = 0; + if ( tqparent() && tqparent()->isWidgetType() ) { + tqparentLayout = ((TQWidget *)tqparent())->tqlayout(); + if ( tqparentLayout && tqparentLayout->mainWidget()->inherits(TQLAYOUTWIDGET_OBJECT_NAME_STRING) ) + tqparentLayout = 0; } - TQObjectListIt it( *children() ); + TQObjectListIt it( childrenListObject() ); TQObject *o; - if ( layout()->inherits(TQVBOXLAYOUT_OBJECT_NAME_STRING) ) { - if ( parentLayout && parentLayout->inherits(TQHBOXLAYOUT_OBJECT_NAME_STRING) ) + if ( tqlayout()->inherits(TQVBOXLAYOUT_OBJECT_NAME_STRING) ) { + if ( tqparentLayout && tqparentLayout->inherits(TQHBOXLAYOUT_OBJECT_NAME_STRING) ) vt = TQSizePolicy::Minimum; else vt = TQSizePolicy::Fixed; @@ -1843,17 +1844,17 @@ void QLayoutWidget::updateSizePolicy() continue; TQWidget *w = (TQWidget*)o; - if ( !w->sizePolicy().mayGrowHorizontally() ) + if ( !w->tqsizePolicy().mayGrowHorizontally() ) ht &= ~TQSizePolicy::Minimum; - if ( !w->sizePolicy().mayShrinkHorizontally() ) + if ( !w->tqsizePolicy().mayShrinkHorizontally() ) ht &= ~TQSizePolicy::Maximum; - if ( w->sizePolicy().mayGrowVertically() ) + if ( w->tqsizePolicy().mayGrowVertically() ) vt |= TQSizePolicy::Minimum; - if ( w->sizePolicy().mayShrinkVertically() ) + if ( w->tqsizePolicy().mayShrinkVertically() ) vt |= TQSizePolicy::Maximum; } - } else if ( layout()->inherits(TQHBOXLAYOUT_OBJECT_NAME_STRING) ) { - if ( parentLayout && parentLayout->inherits(TQVBOXLAYOUT_OBJECT_NAME_STRING) ) + } else if ( tqlayout()->inherits(TQHBOXLAYOUT_OBJECT_NAME_STRING) ) { + if ( tqparentLayout && tqparentLayout->inherits(TQVBOXLAYOUT_OBJECT_NAME_STRING) ) ht = TQSizePolicy::Minimum; else ht = TQSizePolicy::Fixed; @@ -1864,22 +1865,22 @@ void QLayoutWidget::updateSizePolicy() continue; TQWidget *w = (TQWidget*)o; - if ( w->sizePolicy().mayGrowHorizontally() ) + if ( w->tqsizePolicy().mayGrowHorizontally() ) ht |= TQSizePolicy::Minimum; - if ( w->sizePolicy().mayShrinkHorizontally() ) + if ( w->tqsizePolicy().mayShrinkHorizontally() ) ht |= TQSizePolicy::Maximum; - if ( !w->sizePolicy().mayGrowVertically() ) + if ( !w->tqsizePolicy().mayGrowVertically() ) vt &= ~TQSizePolicy::Minimum; - if ( !w->sizePolicy().mayShrinkVertically() ) + if ( !w->tqsizePolicy().mayShrinkVertically() ) vt &= ~TQSizePolicy::Maximum; } - } else if ( layout()->inherits(TQGRIDLAYOUT_OBJECT_NAME_STRING) ) { + } else if ( tqlayout()->inherits(TQGRIDLAYOUT_OBJECT_NAME_STRING) ) { ht = TQSizePolicy::Fixed; vt = TQSizePolicy::Fixed; - if ( parentLayout ) { - if ( parentLayout->inherits(TQVBOXLAYOUT_OBJECT_NAME_STRING) ) + if ( tqparentLayout ) { + if ( tqparentLayout->inherits(TQVBOXLAYOUT_OBJECT_NAME_STRING) ) ht = TQSizePolicy::Minimum; - else if ( parentLayout->inherits(TQHBOXLAYOUT_OBJECT_NAME_STRING) ) + else if ( tqparentLayout->inherits(TQHBOXLAYOUT_OBJECT_NAME_STRING) ) vt = TQSizePolicy::Minimum; } @@ -1889,22 +1890,29 @@ void QLayoutWidget::updateSizePolicy() continue; TQWidget *w = (TQWidget*)o; - if ( w->sizePolicy().mayGrowHorizontally() ) + if ( w->tqsizePolicy().mayGrowHorizontally() ) ht |= TQSizePolicy::Minimum; - if ( w->sizePolicy().mayShrinkHorizontally() ) + if ( w->tqsizePolicy().mayShrinkHorizontally() ) ht |= TQSizePolicy::Maximum; - if ( w->sizePolicy().mayGrowVertically() ) + if ( w->tqsizePolicy().mayGrowVertically() ) vt |= TQSizePolicy::Minimum; - if ( w->sizePolicy().mayShrinkVertically() ) + if ( w->tqsizePolicy().mayShrinkVertically() ) vt |= TQSizePolicy::Maximum; } } - if ( layout()->expanding() & TQSizePolicy::Horizontally ) +#ifdef USE_QT4 + if ( tqlayout()->expandingDirections() & TQSizePolicy::Horizontally ) ht = TQSizePolicy::Expanding; - if ( layout()->expanding() & TQSizePolicy::Vertically ) + if ( tqlayout()->expandingDirections() & TQSizePolicy::Vertically ) vt = TQSizePolicy::Expanding; +#else // USE_QT4 + if ( tqlayout()->expanding() & TQSizePolicy::Horizontally ) + ht = TQSizePolicy::Expanding; + if ( tqlayout()->expanding() & TQSizePolicy::Vertically ) + vt = TQSizePolicy::Expanding; +#endif // USE_QT4 - layout()->invalidate(); + tqlayout()->tqinvalidate(); } sp = TQSizePolicy( (TQSizePolicy::SizeType) ht, (TQSizePolicy::SizeType) vt ); @@ -1913,11 +1921,11 @@ void QLayoutWidget::updateSizePolicy() void CustomWidget::paintEvent( TQPaintEvent *e ) { - if ( parentWidget() && parentWidget()->inherits( "FormWindow" ) ) { - ( (FormWindow*)parentWidget() )->paintGrid( this, e ); + if ( tqparentWidget() && tqparentWidget()->inherits( "FormWindow" ) ) { + ( (FormWindow*)tqparentWidget() )->paintGrid( this, e ); } else { TQPainter p( this ); - p.fillRect( rect(), colorGroup().dark() ); + p.fillRect( rect(), tqcolorGroup().dark() ); p.drawPixmap( ( width() - cusw->pixmap->width() ) / 2, ( height() - cusw->pixmap->height() ) / 2, *cusw->pixmap ); |