diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-14 16:45:05 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-14 16:45:05 +0000 |
commit | 48d4a26399959121f33d2bc3bfe51c7827b654fc (patch) | |
tree | 5ae5e6e00d3ba330b7b8be9bc097154b6bc739e8 /kdevdesigner/designer/widgetfactory.h | |
parent | 7e701ace6592d09e1f2c0cf28c7d6d872d78f4f5 (diff) | |
download | tdevelop-48d4a26399959121f33d2bc3bfe51c7827b654fc.tar.gz tdevelop-48d4a26399959121f33d2bc3bfe51c7827b654fc.zip |
TQt4 port kdevelop
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1236710 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdevdesigner/designer/widgetfactory.h')
-rw-r--r-- | kdevdesigner/designer/widgetfactory.h | 232 |
1 files changed, 123 insertions, 109 deletions
diff --git a/kdevdesigner/designer/widgetfactory.h b/kdevdesigner/designer/widgetfactory.h index d3d315fc..17f5133b 100644 --- a/kdevdesigner/designer/widgetfactory.h +++ b/kdevdesigner/designer/widgetfactory.h @@ -1,15 +1,15 @@ /********************************************************************** ** 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 ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** -** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition -** licenses may use this file in accordance with the Qt Commercial License +** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition +** licenses may use this file in accordance with the TQt Commercial License ** Agreement provided with the Software. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE @@ -17,7 +17,7 @@ ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for -** information about Qt Commercial License Agreements. +** information about TQt Commercial License Agreements. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. @@ -56,15 +56,15 @@ class TQWidget; class TQLayout; class FormWindow; -class CustomWidgetFactory : public QWidgetFactory +class CustomWidgetFactory : public TQWidgetFactory { public: CustomWidgetFactory(); - TQWidget *createWidget( const TQString &className, TQWidget *parent, const char *name ) const; + TQWidget *createWidget( const TQString &className, TQWidget *tqparent, const char *name ) const; }; -class WidgetFactory : public Qt +class WidgetFactory : public TQt { friend class CustomWidgetFactory; @@ -76,15 +76,15 @@ public: NoLayout }; - static TQWidget *create( int id, TQWidget *parent, const char *name = 0, bool init = TRUE, + static TQWidget *create( int id, TQWidget *tqparent, const char *name = 0, bool init = TRUE, const TQRect *rect = 0, Qt::Orientation orient = Qt::Horizontal ); - static TQLayout *createLayout( TQWidget *widget, TQLayout* layout, LayoutType type ); + static TQLayout *createLayout( TQWidget *widget, TQLayout* tqlayout, LayoutType type ); static void deleteLayout( TQWidget *widget ); - static LayoutType layoutType( TQWidget *w ); - static LayoutType layoutType( TQWidget *w, TQLayout *&layout ); - static LayoutType layoutType( TQLayout *layout ); - static TQWidget *layoutParent( TQLayout *layout ); + static LayoutType tqlayoutType( TQWidget *w ); + static LayoutType tqlayoutType( TQWidget *w, TQLayout *&tqlayout ); + static LayoutType tqlayoutType( TQLayout *tqlayout ); + static TQWidget *tqlayoutParent( TQLayout *tqlayout ); static TQWidget* containerOfWidget( TQWidget *w ); static TQWidget* widgetOfContainer( TQWidget *w ); @@ -96,7 +96,7 @@ public: static bool hasSpecialEditor( int id, TQObject *editorWidget ); static bool hasItems( int id, TQObject *editorWidget ); - static void editWidget( int id, TQWidget *parent, TQWidget *editWidget, FormWindow *fw ); + static void editWidget( int id, TQWidget *tqparent, TQWidget *editWidget, FormWindow *fw ); static bool canResetProperty( TQObject *w, const TQString &propName ); static bool resetProperty( TQObject *w, const TQString &propName ); @@ -110,23 +110,24 @@ public: static TQString defaultSignal( TQObject *w ); private: - static TQWidget *createWidget( const TQString &className, TQWidget *parent, const char *name, bool init, + static TQWidget *createWidget( const TQString &className, TQWidget *tqparent, const char *name, bool init, const TQRect *r = 0, Qt::Orientation orient = Qt::Horizontal ); - static TQWidget *createCustomWidget( TQWidget *parent, const char *name, MetaDataBase::CustomWidget *w ); + static TQWidget *createCustomWidget( TQWidget *tqparent, const char *name, MetaDataBase::CustomWidget *w ); static TQGuardedPtr<TQObject> *lastPassiveInteractor; static bool lastWasAPassiveInteractor; }; -class QDesignerTabWidget : public QTabWidget +class TQDesignerTabWidget : public TQTabWidget { Q_OBJECT - Q_PROPERTY( int currentPage READ currentPage WRITE setCurrentPage STORED false DESIGNABLE true ) - Q_PROPERTY( TQString pageTitle READ pageTitle WRITE setPageTitle STORED false DESIGNABLE true ) - Q_PROPERTY( TQCString pageName READ pageName WRITE setPageName STORED false DESIGNABLE true ) + TQ_OBJECT + TQ_PROPERTY( int currentPage READ currentPage WRITE setCurrentPage STORED false DESIGNABLE true ) + TQ_PROPERTY( TQString pageTitle READ pageTitle WRITE setPageTitle STORED false DESIGNABLE true ) + TQ_PROPERTY( TQCString pageName READ pageName WRITE setPageName STORED false DESIGNABLE true ) public: - QDesignerTabWidget( TQWidget *parent, const char *name ); + TQDesignerTabWidget( TQWidget *tqparent, const char *name ); int currentPage() const; void setCurrentPage( int i ); @@ -148,13 +149,14 @@ private: bool mousePressed; }; -class QDesignerWidgetStack : public QWidgetStack +class TQDesignerWidgetStack : public TQWidgetStack { Q_OBJECT - Q_PROPERTY( int currentPage READ currentPage WRITE setCurrentPage STORED false DESIGNABLE true ) - Q_PROPERTY( TQCString pageName READ pageName WRITE setPageName STORED false DESIGNABLE true ) + TQ_OBJECT + TQ_PROPERTY( int currentPage READ currentPage WRITE setCurrentPage STORED false DESIGNABLE true ) + TQ_PROPERTY( TQCString pageName READ pageName WRITE setPageName STORED false DESIGNABLE true ) public: - QDesignerWidgetStack( TQWidget *parent, const char *name ); + TQDesignerWidgetStack( TQWidget *tqparent, const char *name ); int currentPage() const; void setCurrentPage( int i ); @@ -191,17 +193,18 @@ private: }; -class QDesignerWizard : public QWizard +class TQDesignerWizard : public TQWizard { Q_OBJECT - Q_PROPERTY( int currentPage READ currentPageNum WRITE setCurrentPage STORED false DESIGNABLE true ) - Q_PROPERTY( TQString pageTitle READ pageTitle WRITE setPageTitle STORED false DESIGNABLE true ) - Q_PROPERTY( TQCString pageName READ pageName WRITE setPageName STORED false DESIGNABLE true ) - Q_OVERRIDE( bool modal READ isModal WRITE setModal ) + TQ_OBJECT + TQ_PROPERTY( int currentPage READ currentPageNum WRITE setCurrentPage STORED false DESIGNABLE true ) + TQ_PROPERTY( TQString pageTitle READ pageTitle WRITE setPageTitle STORED false DESIGNABLE true ) + TQ_PROPERTY( TQCString pageName READ pageName WRITE setPageName STORED false DESIGNABLE true ) + TQ_OVERRIDE( bool modal READ isModal WRITE setModal ) public: - QDesignerWizard( TQWidget *parent, const char *name ) - : TQWizard( parent, name ), modal(FALSE) {} + TQDesignerWizard( TQWidget *tqparent, const char *name ) + : TQWizard( tqparent, name ), modal(FALSE) {} int currentPageNum() const; void setCurrentPage( int i ); @@ -213,7 +216,7 @@ public: void addPage( TQWidget *p, const TQString & ); void removePage( TQWidget *p ); void insertPage( TQWidget *p, const TQString &t, int index ); - bool isPageRemoved( TQWidget *p ) { return (removedPages.find( p ) != 0); } + bool isPageRemoved( TQWidget *p ) { return (removedPages.tqfind( p ) != 0); } bool isModal() const { return modal; } void setModal(bool b) { modal = b; } @@ -224,7 +227,7 @@ private: struct Page { Page( TQWidget *a, const TQString &b ) : p( a ), t( b ) {} - Page() : p( 0 ), t( TQString::null ) {} + Page() : p( 0 ), t( TQString() ) {} TQWidget *p; TQString t; }; @@ -233,12 +236,13 @@ private: }; -class QLayoutWidget : public QWidget +class TQLayoutWidget : public TQWidget { Q_OBJECT + TQ_OBJECT public: - QLayoutWidget( TQWidget *parent, const char *name ) : TQWidget( parent, name ), sp( TQWidget::sizePolicy() ) {} + TQLayoutWidget( TQWidget *tqparent, const char *name ) : TQWidget( tqparent, name ), sp( sizePolicy() ) {} TQSizePolicy sizePolicy() const; void updateSizePolicy(); @@ -251,24 +255,25 @@ protected: }; -class CustomWidget : public QWidget +class CustomWidget : public TQWidget { Q_OBJECT + TQ_OBJECT public: - CustomWidget( TQWidget *parent, const char *name, MetaDataBase::CustomWidget *cw ) - : TQWidget( parent, name ), cusw( cw ) { - alwaysExpand = parentWidget() && parentWidget()->inherits( "FormWindow" ); - setSizePolicy( cw->sizePolicy ); + CustomWidget( TQWidget *tqparent, const char *name, MetaDataBase::CustomWidget *cw ) + : TQWidget( tqparent, name ), cusw( cw ) { + alwaysExpand = tqparentWidget() && tqparentWidget()->inherits( "FormWindow" ); + tqsetSizePolicy( cw->sizePolicy ); if ( !alwaysExpand ) setBackgroundMode( PaletteDark ); } - TQSize sizeHint() const { - TQSize sh = cusw->sizeHint; + TQSize tqsizeHint() const { + TQSize sh = cusw->tqsizeHint; if ( sh.isValid() ) return sh; - return TQWidget::sizeHint(); + return TQWidget::tqsizeHint(); } TQString realClassName() { return cusw->className; } @@ -283,41 +288,43 @@ protected: }; -class Line : public QFrame +class Line : public TQFrame { Q_OBJECT + TQ_OBJECT - Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation ) - Q_OVERRIDE( int frameWidth DESIGNABLE false ) - Q_OVERRIDE( Shape frameShape DESIGNABLE false ) - Q_OVERRIDE( TQRect frameRect DESIGNABLE false ) - Q_OVERRIDE( TQRect contentsRect DESIGNABLE false ) + TQ_PROPERTY( Qt::Orientation orientation READ orientation WRITE setOrientation ) + TQ_OVERRIDE( int frameWidth DESIGNABLE false ) + TQ_OVERRIDE( Shape frameShape DESIGNABLE false ) + TQ_OVERRIDE( TQRect frameRect DESIGNABLE false ) + TQ_OVERRIDE( TQRect contentsRect DESIGNABLE false ) public: - Line( TQWidget *parent, const char *name ) - : TQFrame( parent, name, WMouseNoMask ) { + Line( TQWidget *tqparent, const char *name ) + : TQFrame( tqparent, name, WMouseNoMask ) { setFrameStyle( HLine | Sunken ); } - void setOrientation( Orientation orient ) { - if ( orient == Horizontal ) + void setOrientation( Qt::Orientation orient ) { + if ( orient ==Qt::Horizontal ) setFrameShape( HLine ); else setFrameShape( VLine ); } - Orientation orientation() const { - return frameShape() == HLine ? Horizontal : Vertical; + Qt::Orientation orientation() const { + return frameShape() == HLine ?Qt::Horizontal :Qt::Vertical; } }; -class QDesignerLabel : public QLabel +class TQDesignerLabel : public TQLabel { Q_OBJECT + TQ_OBJECT - Q_PROPERTY( TQCString buddy READ buddyWidget WRITE setBuddyWidget ) + TQ_PROPERTY( TQCString buddy READ buddyWidget WRITE setBuddyWidget ) public: - QDesignerLabel( TQWidget *parent = 0, const char *name = 0 ) - : TQLabel( parent, name ) { myBuddy = 0; } + TQDesignerLabel( TQWidget *tqparent = 0, const char *name = 0 ) + : TQLabel( tqparent, name ) { myBuddy = 0; } void setBuddyWidget( const TQCString &b ) { myBuddy = b; @@ -341,14 +348,15 @@ private: }; -class QDesignerWidget : public QWidget +class TQDesignerWidget : public TQWidget { Q_OBJECT + TQ_OBJECT public: - QDesignerWidget( FormWindow *fw, TQWidget *parent, const char *name ) - : TQWidget( parent, name, WResizeNoErase ), formwindow( fw ) { - need_frame = parent && parent->inherits("QDesignerWidgetStack" ); + TQDesignerWidget( FormWindow *fw, TQWidget *tqparent, const char *name ) + : TQWidget( tqparent, name, WResizeNoErase ), formwindow( fw ) { + need_frame = tqparent && tqparent->inherits("TQDesignerWidgetStack" ); } protected: @@ -361,14 +369,15 @@ private: }; -class QDesignerDialog : public QDialog +class TQDesignerDialog : public TQDialog { Q_OBJECT - Q_OVERRIDE( bool modal READ isModal WRITE setModal ) + TQ_OBJECT + TQ_OVERRIDE( bool modal READ isModal WRITE setModal ) public: - QDesignerDialog( FormWindow *fw, TQWidget *parent, const char *name ) - : TQDialog( parent, name, FALSE, WResizeNoErase ), formwindow( fw ), modal(FALSE) {} + TQDesignerDialog( FormWindow *fw, TQWidget *tqparent, const char *name ) + : TQDialog( tqparent, name, FALSE, WResizeNoErase ), formwindow( fw ), modal(FALSE) {} bool isModal() const { return modal; } void setModal(bool b) { modal = b; } @@ -382,110 +391,115 @@ private: }; -class QDesignerToolButton : public QToolButton +class TQDesignerToolButton : public TQToolButton { Q_OBJECT - Q_PROPERTY( int buttonGroupId READ buttonGroupId WRITE setButtonGroupId ) + TQ_OBJECT + TQ_PROPERTY( int buttonGroupId READ buttonGroupId WRITE setButtonGroupId ) public: - QDesignerToolButton( TQWidget *parent, const char *name ) - : TQToolButton( parent, name ) {} + TQDesignerToolButton( TQWidget *tqparent, const char *name ) + : TQToolButton( tqparent, name ) {} bool isInButtonGroup() const { - return parentWidget() && parentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ); + return tqparentWidget() && tqparentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ); } int buttonGroupId() const { - return parentWidget() && parentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ) ? ( (TQButtonGroup*)parentWidget() )->id( (TQButton*)this ) : -1; + return tqparentWidget() && tqparentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ) ? ( (TQButtonGroup*)tqparentWidget() )->id( (TQButton*)this ) : -1; } void setButtonGroupId( int id ) { - if ( parentWidget() && parentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ) ) { - ( (TQButtonGroup*)parentWidget() )->remove( this ); - ( (TQButtonGroup*)parentWidget() )->insert( this, id ); + if ( tqparentWidget() && tqparentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ) ) { + ( (TQButtonGroup*)tqparentWidget() )->remove( this ); + ( (TQButtonGroup*)tqparentWidget() )->insert( this, id ); } } }; -class QDesignerRadioButton : public QRadioButton +class TQDesignerRadioButton : public TQRadioButton { Q_OBJECT - Q_PROPERTY( int buttonGroupId READ buttonGroupId WRITE setButtonGroupId ) + TQ_OBJECT + TQ_PROPERTY( int buttonGroupId READ buttonGroupId WRITE setButtonGroupId ) public: - QDesignerRadioButton( TQWidget *parent, const char *name ) - : TQRadioButton( parent, name ) {} + TQDesignerRadioButton( TQWidget *tqparent, const char *name ) + : TQRadioButton( tqparent, name ) {} bool isInButtonGroup() const { - return parentWidget() && parentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ); + return tqparentWidget() && tqparentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ); } int buttonGroupId() const { - return parentWidget() && parentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ) ? ( (TQButtonGroup*)parentWidget() )->id( (TQButton*)this ) : -1; + return tqparentWidget() && tqparentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ) ? ( (TQButtonGroup*)tqparentWidget() )->id( (TQButton*)this ) : -1; } void setButtonGroupId( int id ) { - if ( parentWidget() && parentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ) ) { - ( (TQButtonGroup*)parentWidget() )->remove( this ); - ( (TQButtonGroup*)parentWidget() )->insert( this, id ); + if ( tqparentWidget() && tqparentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ) ) { + ( (TQButtonGroup*)tqparentWidget() )->remove( this ); + ( (TQButtonGroup*)tqparentWidget() )->insert( this, id ); } } }; -class QDesignerPushButton : public QPushButton +class TQDesignerPushButton : public TQPushButton { Q_OBJECT - Q_PROPERTY( int buttonGroupId READ buttonGroupId WRITE setButtonGroupId ) + TQ_OBJECT + TQ_PROPERTY( int buttonGroupId READ buttonGroupId WRITE setButtonGroupId ) public: - QDesignerPushButton( TQWidget *parent, const char *name ) - : TQPushButton( parent, name ) {} + TQDesignerPushButton( TQWidget *tqparent, const char *name ) + : TQPushButton( tqparent, name ) {} bool isInButtonGroup() const { - return parentWidget() && parentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ); + return tqparentWidget() && tqparentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ); } int buttonGroupId() const { - return parentWidget() && parentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ) ? ( (TQButtonGroup*)parentWidget() )->id( (TQButton*)this ) : -1; + return tqparentWidget() && tqparentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ) ? ( (TQButtonGroup*)tqparentWidget() )->id( (TQButton*)this ) : -1; } void setButtonGroupId( int id ) { - if ( parentWidget() && parentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ) ) { - ( (TQButtonGroup*)parentWidget() )->remove( this ); - ( (TQButtonGroup*)parentWidget() )->insert( this, id ); + if ( tqparentWidget() && tqparentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ) ) { + ( (TQButtonGroup*)tqparentWidget() )->remove( this ); + ( (TQButtonGroup*)tqparentWidget() )->insert( this, id ); } } }; -class QDesignerCheckBox : public QCheckBox +class TQDesignerCheckBox : public TQCheckBox { Q_OBJECT - Q_PROPERTY( int buttonGroupId READ buttonGroupId WRITE setButtonGroupId ) + TQ_OBJECT + TQ_PROPERTY( int buttonGroupId READ buttonGroupId WRITE setButtonGroupId ) public: - QDesignerCheckBox( TQWidget *parent, const char *name ) - : TQCheckBox( parent, name ) {} + TQDesignerCheckBox( TQWidget *tqparent, const char *name ) + : TQCheckBox( tqparent, name ) {} bool isInButtonGroup() const { - return parentWidget() && parentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ); + return tqparentWidget() && tqparentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ); } int buttonGroupId() const { - return parentWidget() && parentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ) ? ( (TQButtonGroup*)parentWidget() )->id( (TQButton*)this ) : -1; + return tqparentWidget() && tqparentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ) ? ( (TQButtonGroup*)tqparentWidget() )->id( (TQButton*)this ) : -1; } void setButtonGroupId( int id ) { - if ( parentWidget() && parentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ) ) { - ( (TQButtonGroup*)parentWidget() )->remove( this ); - ( (TQButtonGroup*)parentWidget() )->insert( this, id ); + if ( tqparentWidget() && tqparentWidget()->inherits( TQBUTTONGROUP_OBJECT_NAME_STRING ) ) { + ( (TQButtonGroup*)tqparentWidget() )->remove( this ); + ( (TQButtonGroup*)tqparentWidget() )->insert( this, id ); } } }; -class QDesignerToolBox : public QToolBox +class TQDesignerToolBox : public TQToolBox { Q_OBJECT - Q_PROPERTY( TQString itemLabel READ itemLabel WRITE setItemLabel STORED false DESIGNABLE true ) - Q_PROPERTY( TQCString itemName READ itemName WRITE setItemName STORED false DESIGNABLE true ) - Q_PROPERTY( BackgroundMode itemBackgroundMode READ itemBackgroundMode WRITE setItemBackgroundMode STORED false DESIGNABLE true ) + TQ_OBJECT + TQ_PROPERTY( TQString itemLabel READ itemLabel WRITE setItemLabel STORED false DESIGNABLE true ) + TQ_PROPERTY( TQCString itemName READ itemName WRITE setItemName STORED false DESIGNABLE true ) + TQ_PROPERTY( BackgroundMode itemBackgroundMode READ itemBackgroundMode WRITE setItemBackgroundMode STORED false DESIGNABLE true ) public: - QDesignerToolBox( TQWidget *parent, const char *name ); + TQDesignerToolBox( TQWidget *tqparent, const char *name ); TQString itemLabel() const; void setItemLabel( const TQString &l ); |