diff options
Diffstat (limited to 'kdevdesigner/designer/menubareditor.cpp')
-rw-r--r-- | kdevdesigner/designer/menubareditor.cpp | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/kdevdesigner/designer/menubareditor.cpp b/kdevdesigner/designer/menubareditor.cpp index 0c123886..c6fa7fb4 100644 --- a/kdevdesigner/designer/menubareditor.cpp +++ b/kdevdesigner/designer/menubareditor.cpp @@ -1,15 +1,15 @@ /********************************************************************** ** Copyright (C) 2003 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. @@ -43,11 +43,11 @@ extern void find_accel( const TQString &txt, TQMap<TQChar, TQWidgetList > &accel // Drag Object Declaration ------------------------------------------- -class MenuBarEditorItemPtrDrag : public QStoredDrag +class MenuBarEditorItemPtrDrag : public TQStoredDrag { public: MenuBarEditorItemPtrDrag( MenuBarEditorItem * item, - TQWidget * parent = 0, + TQWidget * tqparent = 0, const char * name = 0 ); ~MenuBarEditorItemPtrDrag() {}; static bool canDecode( TQDragMoveEvent * e ); @@ -57,13 +57,13 @@ public: // Drag Object Implementation --------------------------------------- MenuBarEditorItemPtrDrag::MenuBarEditorItemPtrDrag( MenuBarEditorItem * item, - TQWidget * parent, + TQWidget * tqparent, const char * name ) - : TQStoredDrag( "qt/menubareditoritemptr", parent, name ) + : TQStoredDrag( "qt/menubareditoritemptr", tqparent, name ) { - TQByteArray data( sizeof( Q_LONG ) ); + TQByteArray data( sizeof( TQ_LONG ) ); TQDataStream stream( data, IO_WriteOnly ); - stream << ( Q_LONG ) item; + stream << ( TQ_LONG ) item; setEncodedData( data ); } @@ -74,13 +74,13 @@ bool MenuBarEditorItemPtrDrag::canDecode( TQDragMoveEvent * e ) bool MenuBarEditorItemPtrDrag::decode( TQDropEvent * e, MenuBarEditorItem ** i ) { - TQByteArray data = e->encodedData( "qt/menubareditoritemptr" ); + TQByteArray data = e->tqencodedData( "qt/menubareditoritemptr" ); TQDataStream stream( data, IO_ReadOnly ); if ( !data.size() ) return FALSE; - Q_LONG p = 0; + TQ_LONG p = 0; stream >> p; *i = ( MenuBarEditorItem *) p; @@ -89,8 +89,8 @@ bool MenuBarEditorItemPtrDrag::decode( TQDropEvent * e, MenuBarEditorItem ** i ) // MenuBarEditorItem --------------------------------------------------- -MenuBarEditorItem::MenuBarEditorItem( MenuBarEditor * bar, TQObject * parent, const char * name ) - : TQObject( parent, name ), +MenuBarEditorItem::MenuBarEditorItem( MenuBarEditor * bar, TQObject * tqparent, const char * name ) + : TQObject( tqparent, name ), menuBar( bar ), popupMenu( 0 ), visible( TRUE ), @@ -99,8 +99,8 @@ MenuBarEditorItem::MenuBarEditorItem( MenuBarEditor * bar, TQObject * parent, co { } MenuBarEditorItem::MenuBarEditorItem( PopupMenuEditor * menu, MenuBarEditor * bar, - TQObject * parent, const char * name ) - : TQObject( parent, name ), + TQObject * tqparent, const char * name ) + : TQObject( tqparent, name ), menuBar( bar ), popupMenu( menu ), visible( TRUE ), @@ -111,8 +111,8 @@ MenuBarEditorItem::MenuBarEditorItem( PopupMenuEditor * menu, MenuBarEditor * ba } MenuBarEditorItem::MenuBarEditorItem( TQActionGroup * actionGroup, MenuBarEditor * bar, - TQObject * parent, const char * name ) - : TQObject( parent, name ), + TQObject * tqparent, const char * name ) + : TQObject( tqparent, name ), menuBar( bar ), popupMenu( 0 ), visible( TRUE ), @@ -124,8 +124,8 @@ MenuBarEditorItem::MenuBarEditorItem( TQActionGroup * actionGroup, MenuBarEditor popupMenu->insert( actionGroup ); } -MenuBarEditorItem::MenuBarEditorItem( MenuBarEditorItem * item, TQObject * parent, const char * name ) - : TQObject( parent, name ), +MenuBarEditorItem::MenuBarEditorItem( MenuBarEditorItem * item, TQObject * tqparent, const char * name ) + : TQObject( tqparent, name ), menuBar( item->menuBar ), popupMenu( 0 ), text( item->text ), @@ -141,8 +141,8 @@ MenuBarEditorItem::MenuBarEditorItem( MenuBarEditorItem * item, TQObject * paren int MenuBarEditor::clipboardOperation = 0; MenuBarEditorItem * MenuBarEditor::clipboardItem = 0; -MenuBarEditor::MenuBarEditor( FormWindow * fw, TQWidget * parent, const char * name ) - : TQMenuBar( parent, name ), +MenuBarEditor::MenuBarEditor( FormWindow * fw, TQWidget * tqparent, const char * name ) + : TQMenuBar( tqparent, name ), formWnd( fw ), draggedItem( 0 ), currentIndex( 0 ), @@ -152,7 +152,7 @@ MenuBarEditor::MenuBarEditor( FormWindow * fw, TQWidget * parent, const char * n hasSeparator( FALSE ) { setAcceptDrops( TRUE ); - setFocusPolicy( StrongFocus ); + setFocusPolicy( TQ_StrongFocus ); addItem.setMenuText( i18n("new menu") ); addSeparator.setMenuText( i18n("new separator") ); @@ -165,8 +165,8 @@ MenuBarEditor::MenuBarEditor( FormWindow * fw, TQWidget * parent, const char * n lineEdit->setBackgroundOrigin(ParentOrigin); lineEdit->installEventFilter( this ); - dropLine = new TQWidget( this, "menubar dropline", Qt::WStyle_NoBorder | WStyle_StaysOnTop ); - dropLine->setBackgroundColor( Qt::red ); + dropLine = new TQWidget( this, "menubar dropline", TQt::WStyle_NoBorder | WStyle_StaysOnTop ); + dropLine->setBackgroundColor( TQt::red ); dropLine->hide(); setMinimumHeight( fontMetrics().height() + 2 * borderSize() ); @@ -185,7 +185,7 @@ FormWindow * MenuBarEditor::formWindow() MenuBarEditorItem * MenuBarEditor::createItem( int index, bool addToCmdStack ) { MenuBarEditorItem * i = - new MenuBarEditorItem( new PopupMenuEditor( formWnd, ( TQWidget * ) parent() ), this ); + new MenuBarEditorItem( new PopupMenuEditor( formWnd, ( TQWidget * ) tqparent() ), this ); if ( addToCmdStack ) { AddMenuCommand * cmd = new AddMenuCommand( i18n( "Add Menu" ), formWnd, this, i, index ); formWnd->commandHistory()->addCommand( cmd ); @@ -199,7 +199,7 @@ MenuBarEditorItem * MenuBarEditor::createItem( int index, bool addToCmdStack ) void MenuBarEditor::insertItem( MenuBarEditorItem * item, int index ) { - item->menu()->parentMenu = this; + item->menu()->tqparentMenu = this; if ( index != -1 ) itemList.insert( index, item ); @@ -273,7 +273,7 @@ void MenuBarEditor::removeItem( MenuBarEditorItem * item ) int MenuBarEditor::findItem( MenuBarEditorItem * item ) { - return itemList.findRef( item ); + return itemList.tqfindRef( item ); } int MenuBarEditor::findItem( PopupMenuEditor * menu ) @@ -314,7 +314,7 @@ int MenuBarEditor::findItem( TQPoint & pos ) r = TQRect( x, y, s.width(), s.height() ); - if ( r.contains( pos ) ) + if ( r.tqcontains( pos ) ) return itemList.at(); addItemSizeToCoords( i, x, y, w ); @@ -334,7 +334,7 @@ int MenuBarEditor::findItem( TQPoint & pos ) r = TQRect( x, y, s.width(), s.height() ); - if ( r.contains( pos ) ) + if ( r.tqcontains( pos ) ) return itemList.count(); return itemList.count() + 1; @@ -415,8 +415,8 @@ void MenuBarEditor::exchange( int a, int b ) ia == &addItem || ia == &addSeparator || ib == &addItem || ib == &addSeparator ) return; // do nothing - itemList.replace( b, ia ); - itemList.replace( a, ib ); + itemList.tqreplace( b, ia ); + itemList.tqreplace( a, ib ); } void MenuBarEditor::showLineEdit( int index ) @@ -502,9 +502,9 @@ void MenuBarEditor::deleteItem( int index ) } } -TQSize MenuBarEditor::sizeHint() const +TQSize MenuBarEditor::tqsizeHint() const { - return TQSize( parentWidget()->width(), heightForWidth( parentWidget()->width() ) ); + return TQSize( tqparentWidget()->width(), heightForWidth( tqparentWidget()->width() ) ); } int MenuBarEditor::heightForWidth( int max_width ) const @@ -534,8 +534,8 @@ void MenuBarEditor::show() TQWidget::show(); resizeInternals(); - TQResizeEvent e( parentWidget()->size(), parentWidget()->size() ); - TQApplication::sendEvent( parentWidget(), &e ); + TQResizeEvent e( tqparentWidget()->size(), tqparentWidget()->size() ); + TQApplication::sendEvent( tqparentWidget(), &e ); } void MenuBarEditor::checkAccels( TQMap<TQChar, TQWidgetList > &accels ) @@ -571,12 +571,12 @@ void MenuBarEditor::paste() bool MenuBarEditor::eventFilter( TQObject * o, TQEvent * e ) { - if ( o == lineEdit && e->type() == TQEvent::FocusOut ) { + if ( TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(lineEdit) && e->type() == TQEvent::FocusOut ) { leaveEditMode(); lineEdit->hide(); update(); } else if ( e->type() == TQEvent::LayoutHint ) { - resize( sizeHint() ); + resize( tqsizeHint() ); } return TQMenuBar::eventFilter( o, e ); } @@ -585,8 +585,8 @@ void MenuBarEditor::paintEvent( TQPaintEvent * ) { TQPainter p( this ); TQRect r = rect(); - style().drawPrimitive( TQStyle::PE_PanelMenuBar, &p, - r, colorGroup() ); + tqstyle().tqdrawPrimitive( TQStyle::PE_PanelMenuBar, &p, + r, tqcolorGroup() ); drawItems( p ); } @@ -646,7 +646,7 @@ void MenuBarEditor::mouseMoveEvent( TQMouseEvent * e ) // If the item is dropped in the same list, // we will have two instances of the same pointer // in the list. - itemList.find( draggedItem ); + itemList.tqfind( draggedItem ); TQLNode * node = itemList.currentNode(); dropConfirmed = FALSE; d->dragCopy(); // dragevents and stuff happens @@ -719,67 +719,67 @@ void MenuBarEditor::keyPressEvent( TQKeyEvent * e ) if ( lineEdit->isHidden() ) { // In navigation mode switch ( e->key() ) { - case Qt::Key_Delete: + case TQt::Key_Delete: hideItem(); deleteItem(); showItem(); break; - case Qt::Key_Left: + case TQt::Key_Left: e->accept(); - navigateLeft( e->state() & Qt::ControlButton ); + navigateLeft( e->state() & TQt::ControlButton ); return; - case Qt::Key_Right: + case TQt::Key_Right: e->accept(); - navigateRight( e->state() & Qt::ControlButton ); + navigateRight( e->state() & TQt::ControlButton ); return; // no update - case Qt::Key_Down: + case TQt::Key_Down: e->accept(); focusItem(); return; // no update - case Qt::Key_PageUp: + case TQt::Key_PageUp: currentIndex = 0; break; - case Qt::Key_PageDown: + case TQt::Key_PageDown: currentIndex = itemList.count(); break; - case Qt::Key_Enter: - case Qt::Key_Return: - case Qt::Key_F2: + case TQt::Key_Enter: + case TQt::Key_Return: + case TQt::Key_F2: e->accept(); enterEditMode(); return; // no update - case Qt::Key_Up: - case Qt::Key_Alt: - case Qt::Key_Shift: - case Qt::Key_Control: - case Qt::Key_Escape: + case TQt::Key_Up: + case TQt::Key_Alt: + case TQt::Key_Shift: + case TQt::Key_Control: + case TQt::Key_Escape: e->ignore(); setFocus(); // FIXME: this is because some other widget get the focus when CTRL is pressed return; // no update - case Qt::Key_C: - if ( e->state() & Qt::ControlButton && currentIndex < (int)itemList.count() ) { + case TQt::Key_C: + if ( e->state() & TQt::ControlButton && currentIndex < (int)itemList.count() ) { copy( currentIndex ); break; } - case Qt::Key_X: - if ( e->state() & Qt::ControlButton && currentIndex < (int)itemList.count() ) { + case TQt::Key_X: + if ( e->state() & TQt::ControlButton && currentIndex < (int)itemList.count() ) { hideItem(); cut( currentIndex ); showItem(); break; } - case Qt::Key_V: - if ( e->state() & Qt::ControlButton ) { + case TQt::Key_V: + if ( e->state() & TQt::ControlButton ) { hideItem(); paste( currentIndex < (int)itemList.count() ? currentIndex + 1: itemList.count() ); showItem(); @@ -799,13 +799,13 @@ void MenuBarEditor::keyPressEvent( TQKeyEvent * e ) } else { // In edit mode switch ( e->key() ) { - case Qt::Key_Control: + case TQt::Key_Control: e->ignore(); return; - case Qt::Key_Enter: - case Qt::Key_Return: + case TQt::Key_Enter: + case TQt::Key_Return: leaveEditMode(); - case Qt::Key_Escape: + case TQt::Key_Escape: lineEdit->hide(); setFocus(); break; @@ -817,8 +817,8 @@ void MenuBarEditor::keyPressEvent( TQKeyEvent * e ) void MenuBarEditor::focusOutEvent( TQFocusEvent * e ) { - TQWidget * fw = qApp->focusWidget(); - if ( e->lostFocus() && !::qt_cast<PopupMenuEditor*>(fw) ) + TQWidget * fw = tqApp->tqfocusWidget(); + if ( e->lostFocus() && !::tqqt_cast<PopupMenuEditor*>(fw) ) hideItem(); update(); } @@ -834,7 +834,7 @@ void MenuBarEditor::drawItems( TQPainter & p ) TQPoint pos( borderSize(), 0 ); uint c = 0; - p.setPen( colorGroup().buttonText() ); + p.setPen( tqcolorGroup().buttonText() ); MenuBarEditorItem * i = itemList.first(); while ( i ) { @@ -866,7 +866,7 @@ void MenuBarEditor::drawItem( TQPainter & p, drawSeparator( p, pos ); } else { int flags = TQPainter::AlignLeft | TQPainter::AlignVCenter | - Qt::ShowPrefix | Qt::SingleLine; + TQt::ShowPrefix | TQt::SingleLine; p.drawText( pos.x() + borderSize(), pos.y(), w - borderSize(), itemHeight, flags, i->menuText() ); } @@ -892,7 +892,7 @@ void MenuBarEditor::drawSeparator( TQPainter & p, TQPoint & pos ) p.fillRect( left, pos.y() + borderSize() * 2, separatorWidth - 1, itemHeight - borderSize() * 4, - TQBrush( darkBlue, Qt::Dense5Pattern ) ); + TQBrush( darkBlue, TQt::Dense5Pattern ) ); p.restore(); } @@ -1004,7 +1004,7 @@ void MenuBarEditor::dropInPlace( MenuBarEditorItem * i, const TQPoint & pos ) hideItem(); Command * cmd = 0; - int iidx = itemList.findRef( i ); + int iidx = itemList.tqfindRef( i ); if ( iidx != -1 ) { // internal dnd cmd = new MoveMenuCommand( i18n( "Item Dragged" ), formWnd, this, iidx, idx ); item( iidx )->setVisible( TRUE ); |