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/hierarchyview.cpp | |
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/hierarchyview.cpp')
-rw-r--r-- | kommander/editor/hierarchyview.cpp | 144 |
1 files changed, 72 insertions, 72 deletions
diff --git a/kommander/editor/hierarchyview.cpp b/kommander/editor/hierarchyview.cpp index 57dc817c..5907b348 100644 --- a/kommander/editor/hierarchyview.cpp +++ b/kommander/editor/hierarchyview.cpp @@ -1,7 +1,7 @@ /********************************************************************** ** Copyright (C) 2000-2001 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 @@ -74,15 +74,15 @@ static const char * const folder_xpm[]={ TQListViewItem *newItem = 0; -HierarchyItem::HierarchyItem( Type type, TQListViewItem *parent, +HierarchyItem::HierarchyItem( Type type, TQListViewItem *tqparent, const TQString &txt1, const TQString &txt2, const TQString &txt3 ) - : TQListViewItem( parent, txt1, txt2, txt3 ), typ( type ) + : TQListViewItem( tqparent, txt1, txt2, txt3 ), typ( type ) { } -HierarchyItem::HierarchyItem( Type type, TQListView *parent, +HierarchyItem::HierarchyItem( Type type, TQListView *tqparent, const TQString &txt1, const TQString &txt2, const TQString &txt3 ) - : TQListViewItem( parent, txt1, txt2, txt3 ), typ( type ) + : TQListViewItem( tqparent, txt1, txt2, txt3 ), typ( type ) { } @@ -90,8 +90,8 @@ void HierarchyItem::paintCell( TQPainter *p, const TQColorGroup &cg, int column, { TQColorGroup g( cg ); g.setColor( TQColorGroup::Base, backgroundColor() ); - g.setColor( TQColorGroup::Foreground, Qt::black ); - g.setColor( TQColorGroup::Text, Qt::black ); + g.setColor( TQColorGroup::Foreground, TQt::black ); + g.setColor( TQColorGroup::Text, TQt::black ); TQString txt = text( 0 ); if ( rtti() == Slot && ( txt == "init()" || txt == "destroy()" ) ) { @@ -177,8 +177,8 @@ void HierarchyItem::cancelRename( int col ) -HierarchyList::HierarchyList( TQWidget *parent, FormWindow *fw, bool doConnects ) - : TQListView( parent ), formWindow( fw ) +HierarchyList::HierarchyList( TQWidget *tqparent, FormWindow *fw, bool doConnects ) + : TQListView( tqparent ), formWindow( fw ) { init_colors(); @@ -250,21 +250,21 @@ void HierarchyList::objectClicked( TQListViewItem *i ) if ( formWindow == w ) { if ( deselect ) formWindow->clearSelection( false ); - formWindow->emitShowProperties( formWindow ); + formWindow->emitShowProperties( TQT_TQOBJECT(formWindow) ); return; } - if ( !formWindow->widgets()->find( w ) ) { - if ( w->parent() && w->parent()->inherits( TQWIDGETSTACK_OBJECT_NAME_STRING ) && - w->parent()->parent() && - ( w->parent()->parent()->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) || - w->parent()->parent()->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) ) { - if ( w->parent()->parent()->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) - ( (TQTabWidget*)w->parent()->parent() )->showPage( w ); + if ( !formWindow->widgets()->tqfind( w ) ) { + if ( w->tqparent() && w->tqparent()->inherits( TQWIDGETSTACK_OBJECT_NAME_STRING ) && + w->tqparent()->tqparent() && + ( w->tqparent()->tqparent()->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) || + w->tqparent()->tqparent()->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) ) { + if ( w->tqparent()->tqparent()->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) + ( (TQTabWidget*)w->tqparent()->tqparent() )->showPage( w ); else - ( (QDesignerWizard*)w->parent()->parent() )->setCurrentPage( ( (QDesignerWizard*)w->parent()->parent() )->pageNum( w ) ); - w = (TQWidget*)w->parent()->parent(); - formWindow->emitUpdateProperties( formWindow->currentWidget() ); + ( (TQDesignerWizard*)w->tqparent()->tqparent() )->setCurrentPage( ( (TQDesignerWizard*)w->tqparent()->tqparent() )->pageNum( w ) ); + w = (TQWidget*)w->tqparent()->tqparent(); + formWindow->emitUpdateProperties( TQT_TQOBJECT(formWindow->currentWidget()) ); } else { return; } @@ -273,7 +273,7 @@ void HierarchyList::objectClicked( TQListViewItem *i ) if ( deselect ) formWindow->clearSelection( false ); if ( w->isVisibleTo( formWindow ) ) - formWindow->selectWidget( w, true ); + formWindow->selectWidget( TQT_TQOBJECT(w), true ); } TQWidget *HierarchyList::findWidget( TQListViewItem *i ) @@ -310,7 +310,7 @@ void HierarchyList::changeNameOf( TQWidget *w, const TQString &name ) void HierarchyList::changeDatabaseOf( TQWidget *w, const TQString & info ) { -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL if ( !formWindow->isDatabaseAware() ) return; TQListViewItem *item = findItem( w ); @@ -329,7 +329,7 @@ void HierarchyList::setup() return; clear(); TQWidget *w = formWindow->mainContainer(); -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL if ( formWindow->isDatabaseAware() ) { if ( columns() == 2 ) { addColumn( i18n("Database" ) ); @@ -345,7 +345,7 @@ void HierarchyList::setup() } #endif if ( w ) - insertObject( w, 0 ); + insertObject( TQT_TQOBJECT(w), 0 ); } void HierarchyList::setOpen( TQListViewItem *i, bool b ) @@ -353,11 +353,11 @@ void HierarchyList::setOpen( TQListViewItem *i, bool b ) TQListView::setOpen( i, b ); } -void HierarchyList::insertObject( TQObject *o, TQListViewItem *parent ) +void HierarchyList::insertObject( TQObject *o, TQListViewItem *tqparent ) { bool fakeMainWindow = false; if ( o && o->inherits( TQMAINWINDOW_OBJECT_NAME_STRING ) ) { - TQObject *cw = ( (TQMainWindow*)o )->centralWidget(); + TQObject *cw = TQT_TQOBJECT(( (TQMainWindow*)o )->centralWidget()); if ( cw ) { o = cw; fakeMainWindow = true; @@ -366,7 +366,7 @@ void HierarchyList::insertObject( TQObject *o, TQListViewItem *parent ) TQListViewItem *item = 0; TQString className = WidgetFactory::classNameOf( o ); if ( o->inherits( TQLAYOUTWIDGET_OBJECT_NAME_STRING ) ) { - switch ( WidgetFactory::layoutType( (TQWidget*)o ) ) { + switch ( WidgetFactory::tqlayoutType( (TQWidget*)o ) ) { case WidgetFactory::HBox: className = "HBox"; break; @@ -382,79 +382,79 @@ void HierarchyList::insertObject( TQObject *o, TQListViewItem *parent ) } TQString dbInfo; -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL dbInfo = MetaDataBase::fakeProperty( o, "database" ).toStringList().join("."); #endif TQString name = o->name(); - if ( o->parent() && o->parent()->inherits( TQWIDGETSTACK_OBJECT_NAME_STRING ) && - o->parent()->parent() ) { - if ( o->parent()->parent()->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) - name = ( (TQTabWidget*)o->parent()->parent() )->tabLabel( (TQWidget*)o ); - else if ( o->parent()->parent()->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) - name = ( (TQWizard*)o->parent()->parent() )->title( (TQWidget*)o ); + if ( o->tqparent() && o->tqparent()->inherits( TQWIDGETSTACK_OBJECT_NAME_STRING ) && + o->tqparent()->tqparent() ) { + if ( o->tqparent()->tqparent()->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) + name = ( (TQTabWidget*)o->tqparent()->tqparent() )->tabLabel( (TQWidget*)o ); + else if ( o->tqparent()->tqparent()->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) + name = ( (TQWizard*)o->tqparent()->tqparent() )->title( (TQWidget*)o ); } TQToolBox *tb; - if ( o->parent() && o->parent()->parent() && - (tb = ::qt_cast<TQToolBox*>(o->parent()->parent()->parent())) ) + if ( o->tqparent() && o->tqparent()->tqparent() && + (tb = ::tqqt_cast<TQToolBox*>(o->tqparent()->tqparent()->tqparent())) ) name = tb->itemLabel( tb->indexOf((TQWidget*)o) ); if ( fakeMainWindow ) { - name = o->parent()->name(); + name = o->tqparent()->name(); className = TQMAINWINDOW_OBJECT_NAME_STRING; } - if ( !parent ) + if ( !tqparent ) item = new HierarchyItem( HierarchyItem::Widget, this, name, className, dbInfo ); else - item = new HierarchyItem( HierarchyItem::Widget, parent, name, className, dbInfo ); - if ( !parent ) + item = new HierarchyItem( HierarchyItem::Widget, tqparent, name, className, dbInfo ); + if ( !tqparent ) item->setPixmap( 0, PixmapChooser::loadPixmap( "form.xpm", PixmapChooser::Mini ) ); - else if ( o->inherits( "QLayoutWidget") ) - item->setPixmap( 0, PixmapChooser::loadPixmap( "layout.xpm", PixmapChooser::Small ) ); + else if ( o->inherits( TQLAYOUTWIDGET_OBJECT_NAME_STRING) ) + item->setPixmap( 0, PixmapChooser::loadPixmap( "tqlayout.xpm", PixmapChooser::Small ) ); else item->setPixmap( 0, WidgetDatabase::iconSet( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( o ) ) ). pixmap( TQIconSet::Small, TQIconSet::Normal ) ); ( (HierarchyItem*)item )->setWidget( (TQWidget*)o ); - const TQObjectList *l = o->children(); - if ( !l ) + const TQObjectList l = o->childrenListObject(); + if ( l.isEmpty() ) return; - TQObjectListIt it( *l ); + TQObjectListIt it( l ); it.toLast(); for ( ; it.current(); --it ) { if ( !it.current()->isWidgetType() || ( (TQWidget*)it.current() )->isHidden() ) continue; - if ( !formWindow->widgets()->find( (TQWidget*)it.current() ) ) { - if ( it.current()->parent() && - ( it.current()->parent()->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) || - it.current()->parent()->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) && + if ( !formWindow->widgets()->tqfind( (TQWidget*)it.current() ) ) { + if ( it.current()->tqparent() && + ( it.current()->tqparent()->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) || + it.current()->tqparent()->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) && it.current()->inherits( TQWIDGETSTACK_OBJECT_NAME_STRING ) ) { TQObject *obj = it.current(); TQObjectList *l2 = obj->queryList( TQWIDGET_OBJECT_NAME_STRING, 0, true, false ); - QDesignerTabWidget *tw = 0; - QDesignerWizard *dw = 0; - if ( it.current()->parent()->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) - tw = (QDesignerTabWidget*)it.current()->parent(); - if ( it.current()->parent()->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) - dw = (QDesignerWizard*)it.current()->parent(); + TQDesignerTabWidget *tw = 0; + TQDesignerWizard *dw = 0; + if ( it.current()->tqparent()->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) + tw = (TQDesignerTabWidget*)it.current()->tqparent(); + if ( it.current()->tqparent()->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) + dw = (TQDesignerWizard*)it.current()->tqparent(); TQWidgetStack *stack = (TQWidgetStack*)obj; for ( obj = l2->last(); obj; obj = l2->prev() ) { - if ( qstrcmp( obj->className(), "QWidgetStackPrivate::Invisible" ) == 0 || + if ( qstrcmp( obj->className(), "TQWidgetStackPrivate::Invisible" ) == 0 || ( tw && !tw->tabBar()->tab( stack->id( (TQWidget*)obj ) ) ) || ( dw && dw->isPageRemoved( (TQWidget*)obj ) ) ) continue; insertObject( obj, item ); } delete l2; - } else if ( ::qt_cast<TQToolBox*>(it.current()->parent()) ) { - if ( !::qt_cast<TQScrollView*>(it.current()) ) + } else if ( ::tqqt_cast<TQToolBox*>(it.current()->tqparent()) ) { + if ( !::tqqt_cast<TQScrollView*>(it.current()) ) continue; - TQToolBox *tb = (TQToolBox*)it.current()->parent(); + TQToolBox *tb = (TQToolBox*)it.current()->tqparent(); for ( int i = tb->count() - 1; i >= 0; --i ) - insertObject( tb->item( i ), item ); + insertObject( TQT_TQOBJECT(tb->item( i )), item ); } continue; } @@ -491,7 +491,7 @@ void HierarchyList::showRMBMenu( TQListViewItem *i, const TQPoint & p ) return; if ( w != formWindow && - !formWindow->widgets()->find( w ) ) + !formWindow->widgets()->tqfind( w ) ) return; if ( w->isVisibleTo( formWindow ) ) { @@ -516,13 +516,13 @@ void HierarchyList::addTabPage() return; if ( w->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) { TQTabWidget *tw = (TQTabWidget*)w; - AddTabPageCommand *cmd = new AddTabPageCommand( i18n("Add Page to %1" ).arg( tw->name() ), formWindow, + AddTabPageCommand *cmd = new AddTabPageCommand( i18n("Add Page to %1" ).tqarg( tw->name() ), formWindow, tw, "Tab" ); formWindow->commandHistory()->addCommand( cmd ); cmd->execute(); } else if ( w->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) { TQWizard *wiz = (TQWizard*)formWindow->mainContainer(); - AddWizardPageCommand *cmd = new AddWizardPageCommand( i18n("Add Page to %1" ).arg( wiz->name() ), formWindow, + AddWizardPageCommand *cmd = new AddWizardPageCommand( i18n("Add Page to %1" ).tqarg( wiz->name() ), formWindow, wiz, "Page" ); formWindow->commandHistory()->addCommand( cmd ); cmd->execute(); @@ -537,9 +537,9 @@ void HierarchyList::removeTabPage() if ( w->inherits( TQTABWIDGET_OBJECT_NAME_STRING ) ) { TQTabWidget *tw = (TQTabWidget*)w; if ( tw->currentPage() ) { - QDesignerTabWidget *dtw = (QDesignerTabWidget*)tw; + TQDesignerTabWidget *dtw = (TQDesignerTabWidget*)tw; DeleteTabPageCommand *cmd = new DeleteTabPageCommand( i18n("Delete Page %1 of %2" ). - arg( dtw->pageTitle() ).arg( tw->name() ), + tqarg( dtw->pageTitle() ).tqarg( tw->name() ), formWindow, tw, tw->currentPage() ); formWindow->commandHistory()->addCommand( cmd ); cmd->execute(); @@ -547,9 +547,9 @@ void HierarchyList::removeTabPage() } else if ( w->inherits( TQWIZARD_OBJECT_NAME_STRING ) ) { TQWizard *wiz = (TQWizard*)formWindow->mainContainer(); if ( wiz->currentPage() ) { - QDesignerWizard *dw = (QDesignerWizard*)wiz; + TQDesignerWizard *dw = (TQDesignerWizard*)wiz; DeleteWizardPageCommand *cmd = new DeleteWizardPageCommand( i18n("Delete Page %1 of %2" ). - arg( dw->pageTitle() ).arg( wiz->name() ), + tqarg( dw->pageTitle() ).tqarg( wiz->name() ), formWindow, wiz, wiz->indexOf( wiz->currentPage() ), true ); formWindow->commandHistory()->addCommand( cmd ); @@ -587,19 +587,19 @@ static HierarchyItem::Type getChildType( int type ) void HierarchyList::insertEntry( TQListViewItem *i, const TQPixmap &pix, const TQString &s ) { HierarchyItem *item = new HierarchyItem( getChildType( i->rtti() ), i, s, - TQString::null, TQString::null ); + TQString(), TQString() ); if ( !pix.isNull() ) item->setPixmap( 0, pix ); item->setRenameEnabled( 0, true ); setCurrentItem( item ); ensureItemVisible( item ); - qApp->processEvents(); + tqApp->processEvents(); newItem = item; item->startRename( 0 ); } -HierarchyView::HierarchyView( TQWidget *parent ) - : TQTabWidget( parent, 0, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | +HierarchyView::HierarchyView( TQWidget *tqparent ) + : TQTabWidget( tqparent, 0, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_Tool |WStyle_MinMax | WStyle_SysMenu ) { formwindow = 0; @@ -685,7 +685,7 @@ void HierarchyView::namePropertyChanged( TQWidget *w, const TQVariant & ) void HierarchyView::databasePropertyChanged( TQWidget *w, const TQStringList& info ) { -#ifndef QT_NO_SQL +#ifndef TQT_NO_SQL TQString i = info.join( "." ); listview->changeDatabaseOf( w, i ); #else |