diff options
Diffstat (limited to 'kdevdesigner/designer/actiondnd.cpp')
-rw-r--r-- | kdevdesigner/designer/actiondnd.cpp | 276 |
1 files changed, 139 insertions, 137 deletions
diff --git a/kdevdesigner/designer/actiondnd.cpp b/kdevdesigner/designer/actiondnd.cpp index 347348bd..2bd08500 100644 --- a/kdevdesigner/designer/actiondnd.cpp +++ b/kdevdesigner/designer/actiondnd.cpp @@ -1,15 +1,15 @@ /********************************************************************** ** Copyright (C) 2000-2002 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 [email protected] for -** information about Qt Commercial License Agreements. +** information about TQt Commercial License Agreements. ** ** Contact [email protected] if any conditions of this licensing are ** not clear to you. @@ -84,7 +84,7 @@ ActionDrag::~ActionDrag() the_action = 0; } -void QDesignerAction::init() +void TQDesignerAction::init() { MetaDataBase::addEntry( this ); int id = WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( this ) ); @@ -92,7 +92,7 @@ void QDesignerAction::init() WidgetFactory::saveChangedProperties( this, id ); } -void QDesignerActionGroup::init() +void TQDesignerActionGroup::init() { MetaDataBase::addEntry( this ); int id = WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( this ) ); @@ -100,12 +100,12 @@ void QDesignerActionGroup::init() WidgetFactory::saveChangedProperties( this, id ); } -bool QDesignerAction::addTo( TQWidget *w ) +bool TQDesignerAction::addTo( TQWidget *w ) { if ( !widgetToInsert ) return TQAction::addTo( w ); - if ( ::qt_cast<TQPopupMenu*>(w) ) + if ( ::tqqt_cast<TQPopupMenu*>(w) ) return FALSE; widgetToInsert->reparent( w, TQPoint( 0, 0 ), FALSE ); @@ -114,7 +114,7 @@ bool QDesignerAction::addTo( TQWidget *w ) return TRUE; } -bool QDesignerAction::removeFrom( TQWidget *w ) +bool TQDesignerAction::removeFrom( TQWidget *w ) { if ( !widgetToInsert ) return TQAction::removeFrom( w ); @@ -123,72 +123,72 @@ bool QDesignerAction::removeFrom( TQWidget *w ) return TRUE; } -void QDesignerAction::remove() +void TQDesignerAction::remove() { if ( !widgetToInsert ) return; - MainWindow::self->formWindow()->selectWidget( widgetToInsert, FALSE ); + MainWindow::self->formWindow()->selectWidget( TQT_TQOBJECT(widgetToInsert), FALSE ); widgetToInsert->reparent( 0, TQPoint( 0, 0 ), FALSE ); } -QDesignerToolBarSeparator::QDesignerToolBarSeparator(Orientation o , TQToolBar *parent, +TQDesignerToolBarSeparator::TQDesignerToolBarSeparator(Qt::Orientation o , TQToolBar *tqparent, const char* name ) - : TQWidget( parent, name ) + : TQWidget( tqparent, name ) { - connect( parent, TQT_SIGNAL(orientationChanged(Orientation)), - this, TQT_SLOT(setOrientation(Orientation)) ); + connect( tqparent, TQT_SIGNAL(orientationChanged(Qt::Orientation)), + this, TQT_SLOT(setOrientation(Qt::Orientation)) ); setOrientation( o ); - setBackgroundMode( parent->backgroundMode() ); + setBackgroundMode( tqparent->backgroundMode() ); setBackgroundOrigin( ParentOrigin ); - setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Minimum ) ); + tqsetSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Minimum ) ); } -void QDesignerToolBarSeparator::setOrientation( Orientation o ) +void TQDesignerToolBarSeparator::setOrientation( Qt::Orientation o ) { orient = o; } -void QDesignerToolBarSeparator::styleChange( TQStyle& ) +void TQDesignerToolBarSeparator::styleChange( TQStyle& ) { setOrientation( orient ); } -TQSize QDesignerToolBarSeparator::sizeHint() const +TQSize TQDesignerToolBarSeparator::tqsizeHint() const { - int extent = style().pixelMetric( TQStyle::PM_DockWindowSeparatorExtent, + int extent = tqstyle().tqpixelMetric( TQStyle::PM_DockWindowSeparatorExtent, this ); - if ( orient == Horizontal ) + if ( orient ==Qt::Horizontal ) return TQSize( extent, 0 ); else return TQSize( 0, extent ); } -void QDesignerToolBarSeparator::paintEvent( TQPaintEvent * ) +void TQDesignerToolBarSeparator::paintEvent( TQPaintEvent * ) { TQPainter p( this ); TQStyle::SFlags flags = TQStyle::Style_Default; - if ( orientation() == Horizontal ) + if ( orientation() ==Qt::Horizontal ) flags |= TQStyle::Style_Horizontal; - style().drawPrimitive( TQStyle::PE_DockWindowSeparator, &p, rect(), - colorGroup(), flags ); + tqstyle().tqdrawPrimitive( TQStyle::PE_DockWindowSeparator, &p, rect(), + tqcolorGroup(), flags ); } -QSeparatorAction::QSeparatorAction( TQObject *parent ) - : TQAction( parent, "qt_designer_separator" ), wid( 0 ) +TQSeparatorAction::TQSeparatorAction( TQObject *tqparent ) + : TQAction( tqparent, "qt_designer_separator" ), wid( 0 ) { } -bool QSeparatorAction::addTo( TQWidget *w ) +bool TQSeparatorAction::addTo( TQWidget *w ) { - if ( ::qt_cast<TQToolBar*>(w) ) { + if ( ::tqqt_cast<TQToolBar*>(w) ) { TQToolBar *tb = (TQToolBar*)w; - wid = new QDesignerToolBarSeparator( tb->orientation(), tb ); + wid = new TQDesignerToolBarSeparator( tb->orientation(), tb ); return TRUE; - } else if ( ::qt_cast<TQPopupMenu*>(w) ) { + } else if ( ::tqqt_cast<TQPopupMenu*>(w) ) { idx = ( (TQPopupMenu*)w )->count(); ( (TQPopupMenu*)w )->insertSeparator( idx ); return TRUE; @@ -196,34 +196,34 @@ bool QSeparatorAction::addTo( TQWidget *w ) return FALSE; } -bool QSeparatorAction::removeFrom( TQWidget *w ) +bool TQSeparatorAction::removeFrom( TQWidget *w ) { - if ( ::qt_cast<TQToolBar*>(w) ) { + if ( ::tqqt_cast<TQToolBar*>(w) ) { delete wid; return TRUE; - } else if ( ::qt_cast<TQPopupMenu*>(w) ) { + } else if ( ::tqqt_cast<TQPopupMenu*>(w) ) { ( (TQPopupMenu*)w )->removeItemAt( idx ); return TRUE; } return FALSE; } -TQWidget *QSeparatorAction::widget() const +TQWidget *TQSeparatorAction::widget() const { return wid; } -QDesignerToolBar::QDesignerToolBar( TQMainWindow *mw ) +TQDesignerToolBar::TQDesignerToolBar( TQMainWindow *mw ) : TQToolBar( mw ), lastIndicatorPos( -1, -1 ) { insertAnchor = 0; afterAnchor = TRUE; setAcceptDrops( TRUE ); - MetaDataBase::addEntry( this ); + MetaDataBase::addEntry( TQT_TQOBJECT(this) ); lastIndicatorPos = TQPoint( -1, -1 ); - indicator = new QDesignerIndicatorWidget( this ); + indicator = new TQDesignerIndicatorWidget( this ); indicator->hide(); installEventFilter( this ); widgetInserting = FALSE; @@ -231,66 +231,66 @@ QDesignerToolBar::QDesignerToolBar( TQMainWindow *mw ) mw->setDockEnabled( DockTornOff, FALSE ); } -QDesignerToolBar::QDesignerToolBar( TQMainWindow *mw, Dock dock ) - : TQToolBar( TQString::null, mw, dock), lastIndicatorPos( -1, -1 ) +TQDesignerToolBar::TQDesignerToolBar( TQMainWindow *mw, Dock dock ) + : TQToolBar( TQString(), mw, dock), lastIndicatorPos( -1, -1 ) { insertAnchor = 0; afterAnchor = TRUE; setAcceptDrops( TRUE ); - indicator = new QDesignerIndicatorWidget( this ); + indicator = new TQDesignerIndicatorWidget( this ); indicator->hide(); - MetaDataBase::addEntry( this ); + MetaDataBase::addEntry( TQT_TQOBJECT(this) ); installEventFilter( this ); widgetInserting = FALSE; findFormWindow(); mw->setDockEnabled( DockTornOff, FALSE ); } -void QDesignerToolBar::findFormWindow() +void TQDesignerToolBar::findFormWindow() { TQWidget *w = this; while ( w ) { - formWindow = ::qt_cast<FormWindow*>(w); + formWindow = ::tqqt_cast<FormWindow*>(w); if ( formWindow ) break; - w = w->parentWidget(); + w = w->tqparentWidget(); } } -void QDesignerToolBar::addAction( TQAction *a ) +void TQDesignerToolBar::addAction( TQAction *a ) { actionList.append( a ); connect( a, TQT_SIGNAL( destroyed() ), this, TQT_SLOT( actionRemoved() ) ); - if ( ::qt_cast<TQActionGroup*>(a) ) { - ( (QDesignerActionGroup*)a )->widget()->installEventFilter( this ); - actionMap.insert( ( (QDesignerActionGroup*)a )->widget(), a ); - } else if ( ::qt_cast<QSeparatorAction*>(a) ) { - ( (QSeparatorAction*)a )->widget()->installEventFilter( this ); - actionMap.insert( ( (QSeparatorAction*)a )->widget(), a ); + if ( ::tqqt_cast<TQActionGroup*>(a) ) { + ( (TQDesignerActionGroup*)a )->widget()->installEventFilter( this ); + actionMap.insert( ( (TQDesignerActionGroup*)a )->widget(), a ); + } else if ( ::tqqt_cast<TQSeparatorAction*>(a) ) { + ( (TQSeparatorAction*)a )->widget()->installEventFilter( this ); + actionMap.insert( ( (TQSeparatorAction*)a )->widget(), a ); } else { - ( (QDesignerAction*)a )->widget()->installEventFilter( this ); - actionMap.insert( ( (QDesignerAction*)a )->widget(), a ); + ( (TQDesignerAction*)a )->widget()->installEventFilter( this ); + actionMap.insert( ( (TQDesignerAction*)a )->widget(), a ); } } static void fixObject( TQObject *&o ) { - while ( o && o->parent() && !::qt_cast<QDesignerToolBar*>(o->parent()) ) - o = o->parent(); + while ( o && o->tqparent() && !::tqqt_cast<TQDesignerToolBar*>(o->tqparent()) ) + o = o->tqparent(); } -bool QDesignerToolBar::eventFilter( TQObject *o, TQEvent *e ) +bool TQDesignerToolBar::eventFilter( TQObject *o, TQEvent *e ) { - if ( !o || !e || o->inherits( "QDockWindowHandle" ) || o->inherits( "QDockWindowTitleBar" ) ) + if ( !o || !e || o->inherits( TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING ) || o->inherits( "TQDockWindowTitleBar" ) ) return TQToolBar::eventFilter( o, e ); - if ( o == this && e->type() == TQEvent::MouseButtonPress && - ( ( TQMouseEvent*)e )->button() == LeftButton ) { + if ( TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(this) && e->type() == TQEvent::MouseButtonPress && + ( ( TQMouseEvent*)e )->button() == Qt::LeftButton ) { mousePressEvent( (TQMouseEvent*)e ); return TRUE; } - if ( o == this ) + if ( TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(this) ) return TQToolBar::eventFilter( o, e ); if ( e->type() == TQEvent::MouseButtonPress ) { @@ -334,7 +334,7 @@ bool QDesignerToolBar::eventFilter( TQObject *o, TQEvent *e ) return TQToolBar::eventFilter( o, e ); } -void QDesignerToolBar::paintEvent( TQPaintEvent *e ) +void TQDesignerToolBar::paintEvent( TQPaintEvent *e ) { TQToolBar::paintEvent( e ); if ( e->rect() != rect() ) @@ -342,24 +342,24 @@ void QDesignerToolBar::paintEvent( TQPaintEvent *e ) lastIndicatorPos = TQPoint( -1, -1 ); } -void QDesignerToolBar::contextMenuEvent( TQContextMenuEvent *e ) +void TQDesignerToolBar::contextMenuEvent( TQContextMenuEvent *e ) { e->accept(); TQPopupMenu menu( 0 ); menu.insertItem( i18n( "Delete Toolbar" ), 1 ); int res = menu.exec( e->globalPos() ); if ( res != -1 ) { - RemoveToolBarCommand *cmd = new RemoveToolBarCommand( i18n( "Delete Toolbar '%1'" ).arg( name() ), + RemoveToolBarCommand *cmd = new RemoveToolBarCommand( i18n( "Delete Toolbar '%1'" ).tqarg( name() ), formWindow, 0, this ); formWindow->commandHistory()->addCommand( cmd ); cmd->execute(); } } -void QDesignerToolBar::mousePressEvent( TQMouseEvent *e ) +void TQDesignerToolBar::mousePressEvent( TQMouseEvent *e ) { widgetInserting = FALSE; - if ( e->button() == LeftButton && + if ( e->button() == Qt::LeftButton && MainWindow::self->currentTool() != POINTER_TOOL && MainWindow::self->currentTool() != ORDER_TOOL && MainWindow::self->currentTool() != CONNECT_TOOL && @@ -367,33 +367,33 @@ void QDesignerToolBar::mousePressEvent( TQMouseEvent *e ) widgetInserting = TRUE; } -void QDesignerToolBar::mouseReleaseEvent( TQMouseEvent *e ) +void TQDesignerToolBar::mouseReleaseEvent( TQMouseEvent *e ) { if ( widgetInserting ) doInsertWidget( mapFromGlobal( e->globalPos() ) ); widgetInserting = FALSE; } -void QDesignerToolBar::buttonMouseReleaseEvent( TQMouseEvent *e, TQObject *w ) +void TQDesignerToolBar::buttonMouseReleaseEvent( TQMouseEvent *e, TQObject *w ) { if ( widgetInserting ) doInsertWidget( mapFromGlobal( e->globalPos() ) ); - else if ( w->isWidgetType() && formWindow->widgets()->find( w ) ) { + else if ( w->isWidgetType() && formWindow->widgets()->tqfind( w ) ) { formWindow->clearSelection( FALSE ); formWindow->selectWidget( w ); } widgetInserting = FALSE; } -void QDesignerToolBar::buttonContextMenuEvent( TQContextMenuEvent *e, TQObject *o ) +void TQDesignerToolBar::buttonContextMenuEvent( TQContextMenuEvent *e, TQObject *o ) { e->accept(); TQPopupMenu menu( 0 ); const int ID_DELETE = 1; const int ID_SEP = 2; const int ID_DELTOOLBAR = 3; - TQMap<TQWidget*, TQAction*>::Iterator it = actionMap.find( (TQWidget*)o ); - if ( it != actionMap.end() && ::qt_cast<QSeparatorAction*>(*it) ) + TQMap<TQWidget*, TQAction*>::Iterator it = actionMap.tqfind( (TQWidget*)o ); + if ( it != actionMap.end() && ::tqqt_cast<TQSeparatorAction*>(*it) ) menu.insertItem( i18n( "Delete Separator" ), ID_DELETE ); else menu.insertItem( i18n( "Delete Item" ), ID_DELETE ); @@ -402,21 +402,21 @@ void QDesignerToolBar::buttonContextMenuEvent( TQContextMenuEvent *e, TQObject * menu.insertItem( i18n( "Delete Toolbar" ), ID_DELTOOLBAR ); int res = menu.exec( e->globalPos() ); if ( res == ID_DELETE ) { - TQMap<TQWidget*, TQAction*>::Iterator it = actionMap.find( (TQWidget*)o ); + TQMap<TQWidget*, TQAction*>::Iterator it = actionMap.tqfind( (TQWidget*)o ); if ( it == actionMap.end() ) return; TQAction *a = *it; - int index = actionList.find( a ); + int index = actionList.tqfind( a ); RemoveActionFromToolBarCommand *cmd = new RemoveActionFromToolBarCommand( i18n( "Delete Action '%1' From Toolbar '%2'" ). - arg( a->name() ).arg( caption() ), + tqarg( a->name() ).tqarg( caption() ), formWindow, a, this, index ); formWindow->commandHistory()->addCommand( cmd ); cmd->execute(); } else if ( res == ID_SEP ) { calcIndicatorPos( mapFromGlobal( e->globalPos() ) ); - TQAction *a = new QSeparatorAction( 0 ); - int index = actionList.findRef( *actionMap.find( insertAnchor ) ); + TQAction *a = new TQSeparatorAction( 0 ); + int index = actionList.tqfindRef( *actionMap.tqfind( insertAnchor ) ); if ( index != -1 && afterAnchor ) ++index; if ( !insertAnchor ) @@ -429,21 +429,21 @@ void QDesignerToolBar::buttonContextMenuEvent( TQContextMenuEvent *e, TQObject * formWindow->commandHistory()->addCommand( cmd ); cmd->execute(); } else if ( res == ID_DELTOOLBAR ) { - RemoveToolBarCommand *cmd = new RemoveToolBarCommand( i18n( "Delete Toolbar '%1'" ).arg( name() ), + RemoveToolBarCommand *cmd = new RemoveToolBarCommand( i18n( "Delete Toolbar '%1'" ).tqarg( name() ), formWindow, 0, this ); formWindow->commandHistory()->addCommand( cmd ); cmd->execute(); } } -void QDesignerToolBar::buttonMousePressEvent( TQMouseEvent *e, TQObject * ) +void TQDesignerToolBar::buttonMousePressEvent( TQMouseEvent *e, TQObject * ) { widgetInserting = FALSE; - if ( e->button() == MidButton ) + if ( e->button() == Qt::MidButton ) return; - if ( e->button() == LeftButton && + if ( e->button() == Qt::LeftButton && MainWindow::self->currentTool() != POINTER_TOOL && MainWindow::self->currentTool() != ORDER_TOOL && MainWindow::self->currentTool() != CONNECT_TOOL && @@ -455,16 +455,16 @@ void QDesignerToolBar::buttonMousePressEvent( TQMouseEvent *e, TQObject * ) dragStartPos = e->pos(); } -void QDesignerToolBar::removeWidget( TQWidget *w ) +void TQDesignerToolBar::removeWidget( TQWidget *w ) { - TQMap<TQWidget*, TQAction*>::Iterator it = actionMap.find( w ); + TQMap<TQWidget*, TQAction*>::Iterator it = actionMap.tqfind( w ); if ( it == actionMap.end() ) return; TQAction *a = *it; - int index = actionList.find( a ); + int index = actionList.tqfind( a ); RemoveActionFromToolBarCommand *cmd = new RemoveActionFromToolBarCommand( i18n( "Delete Action '%1' From Toolbar '%2'" ). - arg( a->name() ).arg( caption() ), + tqarg( a->name() ).tqarg( caption() ), formWindow, a, this, index ); formWindow->commandHistory()->addCommand( cmd ); cmd->execute(); @@ -472,39 +472,39 @@ void QDesignerToolBar::removeWidget( TQWidget *w ) adjustSize(); } -void QDesignerToolBar::buttonMouseMoveEvent( TQMouseEvent *e, TQObject *o ) +void TQDesignerToolBar::buttonMouseMoveEvent( TQMouseEvent *e, TQObject *o ) { - if ( widgetInserting || ( e->state() & LeftButton ) == 0 ) + if ( widgetInserting || ( e->state() & Qt::LeftButton ) == 0 ) return; - if ( QABS( TQPoint( dragStartPos - e->pos() ).manhattanLength() ) < TQApplication::startDragDistance() ) + if ( TQABS( TQPoint( dragStartPos - e->pos() ).manhattanLength() ) < TQApplication::startDragDistance() ) return; - TQMap<TQWidget*, TQAction*>::Iterator it = actionMap.find( (TQWidget*)o ); + TQMap<TQWidget*, TQAction*>::Iterator it = actionMap.tqfind( (TQWidget*)o ); if ( it == actionMap.end() ) return; TQAction *a = *it; if ( !a ) return; - int index = actionList.find( a ); + int index = actionList.tqfind( a ); RemoveActionFromToolBarCommand *cmd = new RemoveActionFromToolBarCommand( i18n( "Delete Action '%1' From Toolbar '%2'" ). - arg( a->name() ).arg( caption() ), + tqarg( a->name() ).tqarg( caption() ), formWindow, a, this, index ); formWindow->commandHistory()->addCommand( cmd ); cmd->execute(); TQApplication::sendPostedEvents(); adjustSize(); - TQString type = ::qt_cast<TQActionGroup*>(a) ? TQString( "application/x-designer-actiongroup" ) : - ::qt_cast<QSeparatorAction*>(a) ? TQString( "application/x-designer-separator" ) : TQString( "application/x-designer-actions" ); + TQString type = ::tqqt_cast<TQActionGroup*>(a) ? TQString( "application/x-designer-actiongroup" ) : + ::tqqt_cast<TQSeparatorAction*>(a) ? TQString( "application/x-designer-separator" ) : TQString( "application/x-designer-actions" ); TQStoredDrag *drag = new ActionDrag( type, a, this ); drag->setPixmap( a->iconSet().pixmap() ); - if ( ::qt_cast<QDesignerAction*>(a) ) { - if ( formWindow->widgets()->find( ( (QDesignerAction*)a )->widget() ) ) - formWindow->selectWidget( ( (QDesignerAction*)a )->widget(), FALSE ); + if ( ::tqqt_cast<TQDesignerAction*>(a) ) { + if ( formWindow->widgets()->tqfind( ( (TQDesignerAction*)a )->widget() ) ) + formWindow->selectWidget( ( TQT_TQOBJECT(( (TQDesignerAction*)a )->widget())), FALSE ); } if ( !drag->drag() ) { AddActionToToolBarCommand *cmd = new AddActionToToolBarCommand( i18n( "Add Action '%1' to Toolbar '%2'" ). - arg( a->name() ).arg( caption() ), + tqarg( a->name() ).tqarg( caption() ), formWindow, a, this, index ); formWindow->commandHistory()->addCommand( cmd ); cmd->execute(); @@ -513,9 +513,9 @@ void QDesignerToolBar::buttonMouseMoveEvent( TQMouseEvent *e, TQObject *o ) indicator->hide(); } -#ifndef QT_NO_DRAGANDDROP +#ifndef TQT_NO_DRAGANDDROP -void QDesignerToolBar::dragEnterEvent( TQDragEnterEvent *e ) +void TQDesignerToolBar::dragEnterEvent( TQDragEnterEvent *e ) { widgetInserting = FALSE; lastIndicatorPos = TQPoint( -1, -1 ); @@ -523,7 +523,7 @@ void QDesignerToolBar::dragEnterEvent( TQDragEnterEvent *e ) e->accept(); } -void QDesignerToolBar::dragMoveEvent( TQDragMoveEvent *e ) +void TQDesignerToolBar::dragMoveEvent( TQDragMoveEvent *e ) { if (ActionDrag::canDecode(e)) { e->accept(); @@ -531,14 +531,14 @@ void QDesignerToolBar::dragMoveEvent( TQDragMoveEvent *e ) } } -void QDesignerToolBar::dragLeaveEvent( TQDragLeaveEvent * ) +void TQDesignerToolBar::dragLeaveEvent( TQDragLeaveEvent * ) { indicator->hide(); insertAnchor = 0; afterAnchor = TRUE; } -void QDesignerToolBar::dropEvent( TQDropEvent *e ) +void TQDesignerToolBar::dropEvent( TQDropEvent *e ) { if (!ActionDrag::canDecode(e)) return; @@ -547,7 +547,7 @@ void QDesignerToolBar::dropEvent( TQDropEvent *e ) indicator->hide(); TQAction *a = 0; - int index = actionList.findRef( *actionMap.find( insertAnchor ) ); + int index = actionList.tqfindRef( *actionMap.tqfind( insertAnchor ) ); if ( index != -1 && afterAnchor ) ++index; if ( !insertAnchor ) @@ -555,14 +555,14 @@ void QDesignerToolBar::dropEvent( TQDropEvent *e ) if ( e->provides( "application/x-designer-actions" ) || e->provides( "application/x-designer-separator" ) ) { if ( e->provides( "application/x-designer-actions" ) ) - a = ::qt_cast<QDesignerAction*>(ActionDrag::action()); + a = ::tqqt_cast<TQDesignerAction*>(ActionDrag::action()); else - a = ::qt_cast<QSeparatorAction*>(ActionDrag::action()); + a = ::tqqt_cast<TQSeparatorAction*>(ActionDrag::action()); } else { - a = ::qt_cast<QDesignerActionGroup*>(ActionDrag::action()); + a = ::tqqt_cast<TQDesignerActionGroup*>(ActionDrag::action()); } - if ( actionList.findRef( a ) != -1 ) { + if ( actionList.tqfindRef( a ) != -1 ) { TQMessageBox::warning( MainWindow::self, i18n( "Insert/Move Action" ), i18n( "Action '%1' has already been added to this toolbar.\n" "An Action may only occur once in a given toolbar." ). @@ -571,7 +571,7 @@ void QDesignerToolBar::dropEvent( TQDropEvent *e ) } AddActionToToolBarCommand *cmd = new AddActionToToolBarCommand( i18n( "Add Action '%1' to Toolbar '%2'" ). - arg( a->name() ).arg( caption() ), + tqarg( a->name() ).tqarg( caption() ), formWindow, a, this, index ); formWindow->commandHistory()->addCommand( cmd ); cmd->execute(); @@ -581,44 +581,45 @@ void QDesignerToolBar::dropEvent( TQDropEvent *e ) #endif -void QDesignerToolBar::reInsert() +void TQDesignerToolBar::reInsert() { TQAction *a = 0; actionMap.clear(); clear(); for ( a = actionList.first(); a; a = actionList.next() ) { a->addTo( this ); - if ( ::qt_cast<TQActionGroup*>(a) ) { - actionMap.insert( ( (QDesignerActionGroup*)a )->widget(), a ); - if ( ( (QDesignerActionGroup*)a )->widget() ) - ( (QDesignerActionGroup*)a )->widget()->installEventFilter( this ); - } else if ( ::qt_cast<QDesignerAction*>(a) ) { - actionMap.insert( ( (QDesignerAction*)a )->widget(), a ); - ( (QDesignerAction*)a )->widget()->installEventFilter( this ); - } else if ( ::qt_cast<QSeparatorAction*>(a) ) { - actionMap.insert( ( (QSeparatorAction*)a )->widget(), a ); - ( (QSeparatorAction*)a )->widget()->installEventFilter( this ); + if ( ::tqqt_cast<TQActionGroup*>(a) ) { + actionMap.insert( ( (TQDesignerActionGroup*)a )->widget(), a ); + if ( ( (TQDesignerActionGroup*)a )->widget() ) + ( (TQDesignerActionGroup*)a )->widget()->installEventFilter( this ); + } else if ( ::tqqt_cast<TQDesignerAction*>(a) ) { + actionMap.insert( ( (TQDesignerAction*)a )->widget(), a ); + ( (TQDesignerAction*)a )->widget()->installEventFilter( this ); + } else if ( ::tqqt_cast<TQSeparatorAction*>(a) ) { + actionMap.insert( ( (TQSeparatorAction*)a )->widget(), a ); + ( (TQSeparatorAction*)a )->widget()->installEventFilter( this ); } } TQApplication::sendPostedEvents(); adjustSize(); } -void QDesignerToolBar::actionRemoved() +void TQDesignerToolBar::actionRemoved() { actionList.removeRef( (TQAction*)sender() ); } -TQPoint QDesignerToolBar::calcIndicatorPos( const TQPoint &pos ) +TQPoint TQDesignerToolBar::calcIndicatorPos( const TQPoint &pos ) { - if ( orientation() == Horizontal ) { + if ( orientation() ==Qt::Horizontal ) { TQPoint pnt( width() - 2, 0 ); insertAnchor = 0; afterAnchor = TRUE; - if ( !children() ) + TQObjectList clo = childrenListObject(); + if ( clo.isEmpty() ) return pnt; pnt = TQPoint( 13, 0 ); - TQObjectListIt it( *children() ); + TQObjectListIt it( clo ); TQObject * obj; while( (obj=it.current()) != 0 ) { ++it; @@ -637,10 +638,11 @@ TQPoint QDesignerToolBar::calcIndicatorPos( const TQPoint &pos ) TQPoint pnt( 0, height() - 2 ); insertAnchor = 0; afterAnchor = TRUE; - if ( !children() ) + TQObjectList clo = childrenListObject(); + if ( clo.isEmpty() ) return pnt; pnt = TQPoint( 0, 13 ); - TQObjectListIt it( *children() ); + TQObjectListIt it( clo ); TQObject * obj; while( (obj=it.current()) != 0 ) { ++it; @@ -658,12 +660,12 @@ TQPoint QDesignerToolBar::calcIndicatorPos( const TQPoint &pos ) } } -void QDesignerToolBar::drawIndicator( const TQPoint &pos ) +void TQDesignerToolBar::drawIndicator( const TQPoint &pos ) { if ( lastIndicatorPos == pos ) return; bool wasVsisible = indicator->isVisible(); - if ( orientation() == Horizontal ) { + if ( orientation() ==Qt::Horizontal ) { indicator->resize( 3, height() ); if ( pos != TQPoint( -1, -1 ) ) indicator->move( pos.x() - 1, 0 ); @@ -682,7 +684,7 @@ void QDesignerToolBar::drawIndicator( const TQPoint &pos ) TQApplication::sendPostedEvents(); } -void QDesignerToolBar::doInsertWidget( const TQPoint &p ) +void TQDesignerToolBar::doInsertWidget( const TQPoint &p ) { if ( formWindow != MainWindow::self->formWindow() ) return; @@ -690,30 +692,30 @@ void QDesignerToolBar::doInsertWidget( const TQPoint &p ) TQWidget *w = WidgetFactory::create( MainWindow::self->currentTool(), this, 0, TRUE ); installEventFilters( w ); MainWindow::self->formWindow()->insertWidget( w, TRUE ); - QDesignerAction *a = new QDesignerAction( w, parent() ); - int index = actionList.findRef( *actionMap.find( insertAnchor ) ); + TQDesignerAction *a = new TQDesignerAction( w, tqparent() ); + int index = actionList.tqfindRef( *actionMap.tqfind( insertAnchor ) ); if ( index != -1 && afterAnchor ) ++index; if ( !insertAnchor ) index = 0; AddActionToToolBarCommand *cmd = new AddActionToToolBarCommand( i18n( "Add Widget '%1' to Toolbar '%2'" ). - arg( w->name() ).arg( caption() ), + tqarg( w->name() ).tqarg( caption() ), formWindow, a, this, index ); formWindow->commandHistory()->addCommand( cmd ); cmd->execute(); MainWindow::self->resetTool(); } -void QDesignerToolBar::clear() +void TQDesignerToolBar::clear() { for ( TQAction *a = actionList.first(); a; a = actionList.next() ) { - if ( ::qt_cast<QDesignerAction*>(a) ) - ( (QDesignerAction*)a )->remove(); + if ( ::tqqt_cast<TQDesignerAction*>(a) ) + ( (TQDesignerAction*)a )->remove(); } TQToolBar::clear(); } -void QDesignerToolBar::installEventFilters( TQWidget *w ) +void TQDesignerToolBar::installEventFilters( TQWidget *w ) { if ( !w ) return; |