diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-16 19:02:47 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-16 19:02:47 +0000 |
commit | e985f7e545f4739493965aad69bbecb136dc9346 (patch) | |
tree | 54afd409d8acd6202dd8ab611d24e78c28e4c0a0 /kommander/editor/widgetfactory.h | |
parent | f7670c198945adc3b95ad69a959fe5f8ae55b493 (diff) | |
download | tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.tar.gz tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.zip |
TQt4 port kdewebdev
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1237029 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kommander/editor/widgetfactory.h')
-rw-r--r-- | kommander/editor/widgetfactory.h | 217 |
1 files changed, 116 insertions, 101 deletions
diff --git a/kommander/editor/widgetfactory.h b/kommander/editor/widgetfactory.h index 74713544..bfde50ec 100644 --- a/kommander/editor/widgetfactory.h +++ b/kommander/editor/widgetfactory.h @@ -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 @@ -58,7 +58,7 @@ class TQWidget; class TQLayout; class FormWindow; -class WidgetFactory : public Qt +class WidgetFactory : public TQt { friend class CustomWidgetFactory; @@ -70,15 +70,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 ); @@ -90,7 +90,7 @@ public: static bool hasSpecialEditor( int id ); static bool hasItems( int id ); - 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 ); @@ -101,21 +101,22 @@ public: static void saveDefaultProperties( TQWidget *w, int id ); 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 ); }; -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 ); @@ -140,11 +141,12 @@ private: class EditorTabWidget : public TabWidget { 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: - EditorTabWidget( TQWidget *parent, const char *name ); + EditorTabWidget( TQWidget *tqparent, const char *name ); int currentPage() const; void setCurrentPage( int i ); @@ -169,11 +171,12 @@ private: class EditorToolBox : public ToolBox { 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: - EditorToolBox( TQWidget *parent, const char *name ); + EditorToolBox( TQWidget *tqparent, const char *name ); int currentPage() const; void setCurrentPage( int i ); @@ -185,14 +188,15 @@ public: int count() const; }; -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 ) + 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 ) public: - QDesignerWizard( TQWidget *parent, const char *name ) : TQWizard( parent, name ) {} + TQDesignerWizard( TQWidget *tqparent, const char *name ) : TQWizard( tqparent, name ) {} int currentPageNum() const; void setCurrentPage( int i ); @@ -204,7 +208,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); } void reject() {} @@ -212,7 +216,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; }; @@ -220,12 +224,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( TQWidget::tqsizePolicy() ) {} TQSizePolicy sizePolicy() const; void updateSizePolicy(); @@ -238,24 +243,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; } @@ -270,41 +276,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; @@ -328,13 +336,14 @@ 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 ) {} + TQDesignerWidget( FormWindow *fw, TQWidget *tqparent, const char *name ) + : TQWidget( tqparent, name, WResizeNoErase ), formwindow( fw ) {} protected: void paintEvent( TQPaintEvent *e ); @@ -344,13 +353,14 @@ private: }; -class QDesignerDialog : public QDialog +class TQDesignerDialog : public TQDialog { Q_OBJECT + TQ_OBJECT public: - QDesignerDialog( FormWindow *fw, TQWidget *parent, const char *name ) - : TQDialog( parent, name, FALSE, WResizeNoErase ), formwindow( fw ) {} + TQDesignerDialog( FormWindow *fw, TQWidget *tqparent, const char *name ) + : TQDialog( tqparent, name, FALSE, WResizeNoErase ), formwindow( fw ) {} protected: void paintEvent( TQPaintEvent *e ); @@ -360,96 +370,100 @@ 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 ); } } @@ -458,10 +472,11 @@ public: class EditorDialog : public Dialog { Q_OBJECT + TQ_OBJECT public: - EditorDialog( FormWindow *fw, TQWidget *parent, const char *name ) - : Dialog( parent, name, FALSE, WResizeNoErase ), formwindow( fw ) { } + EditorDialog( FormWindow *fw, TQWidget *tqparent, const char *name ) + : Dialog( tqparent, name, FALSE, WResizeNoErase ), formwindow( fw ) { } protected: void paintEvent( TQPaintEvent *e ); |