summaryrefslogtreecommitdiffstats
path: root/kdevdesigner/designer/popupmenueditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kdevdesigner/designer/popupmenueditor.cpp')
-rw-r--r--kdevdesigner/designer/popupmenueditor.cpp316
1 files changed, 158 insertions, 158 deletions
diff --git a/kdevdesigner/designer/popupmenueditor.cpp b/kdevdesigner/designer/popupmenueditor.cpp
index 198880f9..40d77fd1 100644
--- a/kdevdesigner/designer/popupmenueditor.cpp
+++ b/kdevdesigner/designer/popupmenueditor.cpp
@@ -24,18 +24,18 @@
**
**********************************************************************/
-#include <qapplication.h>
-#include <qcstring.h>
-#include <qdatastream.h>
-#include <qdragobject.h>
-#include <qlineedit.h>
-#include <qobjectlist.h>
-#include <qpainter.h>
-#include <qpopupmenu.h>
-#include <qrect.h>
-#include <qsize.h>
-#include <qstyle.h>
-#include <qtimer.h>
+#include <tqapplication.h>
+#include <tqcstring.h>
+#include <tqdatastream.h>
+#include <tqdragobject.h>
+#include <tqlineedit.h>
+#include <tqobjectlist.h>
+#include <tqpainter.h>
+#include <tqpopupmenu.h>
+#include <tqrect.h>
+#include <tqsize.h>
+#include <tqstyle.h>
+#include <tqtimer.h>
#include "actiondnd.h"
#include "actioneditorimpl.h"
#include "command.h"
@@ -54,34 +54,34 @@
class PopupMenuEditorItemPtrDrag : public QStoredDrag
{
public:
- PopupMenuEditorItemPtrDrag( PopupMenuEditorItem * item, QWidget * parent = 0,
+ PopupMenuEditorItemPtrDrag( PopupMenuEditorItem * item, TQWidget * parent = 0,
const char * name = 0 );
~PopupMenuEditorItemPtrDrag() {};
- static bool canDecode( QDragMoveEvent * e );
- static bool decode( QDropEvent * e, PopupMenuEditorItem ** i );
+ static bool canDecode( TQDragMoveEvent * e );
+ static bool decode( TQDropEvent * e, PopupMenuEditorItem ** i );
};
// Drag Object Implementation ---------------------------------------
PopupMenuEditorItemPtrDrag::PopupMenuEditorItemPtrDrag( PopupMenuEditorItem * item,
- QWidget * parent, const char * name )
- : QStoredDrag( "qt/popupmenueditoritemptr", parent, name )
+ TQWidget * parent, const char * name )
+ : TQStoredDrag( "qt/popupmenueditoritemptr", parent, name )
{
- QByteArray data( sizeof( Q_LONG ) );
- QDataStream stream( data, IO_WriteOnly );
+ TQByteArray data( sizeof( Q_LONG ) );
+ TQDataStream stream( data, IO_WriteOnly );
stream << ( Q_LONG ) item;
setEncodedData( data );
}
-bool PopupMenuEditorItemPtrDrag::canDecode( QDragMoveEvent * e )
+bool PopupMenuEditorItemPtrDrag::canDecode( TQDragMoveEvent * e )
{
return e->provides( "qt/popupmenueditoritemptr" );
}
-bool PopupMenuEditorItemPtrDrag::decode( QDropEvent * e, PopupMenuEditorItem ** i )
+bool PopupMenuEditorItemPtrDrag::decode( TQDropEvent * e, PopupMenuEditorItem ** i )
{
- QByteArray data = e->encodedData( "qt/popupmenueditoritemptr" );
- QDataStream stream( data, IO_ReadOnly );
+ TQByteArray data = e->encodedData( "qt/popupmenueditoritemptr" );
+ TQDataStream stream( data, IO_ReadOnly );
if ( !data.size() )
return FALSE;
@@ -95,8 +95,8 @@ bool PopupMenuEditorItemPtrDrag::decode( QDropEvent * e, PopupMenuEditorItem **
// PopupMenuEditorItem Implementation -----------------------------------
-PopupMenuEditorItem::PopupMenuEditorItem( PopupMenuEditor * menu, QObject * parent, const char * name )
- : QObject( parent, name ),
+PopupMenuEditorItem::PopupMenuEditorItem( PopupMenuEditor * menu, TQObject * parent, const char * name )
+ : TQObject( parent, name ),
a( 0 ),
s( 0 ),
m( menu ),
@@ -104,14 +104,14 @@ PopupMenuEditorItem::PopupMenuEditorItem( PopupMenuEditor * menu, QObject * pare
removable( FALSE )
{
init();
- a = new QAction( this );
- QObject::connect( a, SIGNAL( destroyed() ), this, SLOT( selfDestruct() ) );
+ a = new TQAction( this );
+ TQObject::connect( a, TQT_SIGNAL( destroyed() ), this, TQT_SLOT( selfDestruct() ) );
}
-PopupMenuEditorItem::PopupMenuEditorItem( QAction * action, PopupMenuEditor * menu,
- QObject * parent, const char * name )
- : QObject( parent, name ),
+PopupMenuEditorItem::PopupMenuEditorItem( TQAction * action, PopupMenuEditor * menu,
+ TQObject * parent, const char * name )
+ : TQObject( parent, name ),
a( action ),
s( 0 ),
m( menu ),
@@ -126,8 +126,8 @@ PopupMenuEditorItem::PopupMenuEditorItem( QAction * action, PopupMenuEditor * me
}
PopupMenuEditorItem::PopupMenuEditorItem( PopupMenuEditorItem * item, PopupMenuEditor * menu,
- QObject * parent, const char * name )
- : QObject( parent, name ),
+ TQObject * parent, const char * name )
+ : TQObject( parent, name ),
a( item->a ),
s( 0 ),
m( menu ),
@@ -135,7 +135,7 @@ PopupMenuEditorItem::PopupMenuEditorItem( PopupMenuEditorItem * item, PopupMenuE
removable( item->removable )
{
init();
- if ( ::qt_cast<QActionGroup*>(a) )
+ if ( ::qt_cast<TQActionGroup*>(a) )
a->installEventFilter( this );
}
@@ -147,10 +147,10 @@ PopupMenuEditorItem::~PopupMenuEditorItem()
void PopupMenuEditorItem::init()
{
if ( a ) {
- QObject::connect( a, SIGNAL( destroyed() ), this, SLOT( selfDestruct() ) );
+ TQObject::connect( a, TQT_SIGNAL( destroyed() ), this, TQT_SLOT( selfDestruct() ) );
if ( m && !isSeparator() ) {
s = new PopupMenuEditor( m->formWindow(), m );
- QString n = "PopupMenuEditor";
+ TQString n = "PopupMenuEditor";
m->formWindow()->unify( s, n, TRUE );
s->setName( n );
MetaDataBase::addEntry( s );
@@ -175,7 +175,7 @@ void PopupMenuEditorItem::setVisible( bool enable )
bool PopupMenuEditorItem::isVisible() const
{
- QActionGroup *g = ::qt_cast<QActionGroup*>(a);
+ TQActionGroup *g = ::qt_cast<TQActionGroup*>(a);
if ( g )
return ( g->isVisible() && g->usesDropDown() );
else if ( a )
@@ -212,25 +212,25 @@ int PopupMenuEditorItem::count() const
{
if ( s ) {
return s->count();
- } else if ( ::qt_cast<QActionGroup*>(a) ) {
- const QObjectList * l = a->children();
+ } else if ( ::qt_cast<TQActionGroup*>(a) ) {
+ const TQObjectList * l = a->children();
if ( l )
return l->count();
}
return 0;
}
-bool PopupMenuEditorItem::eventFilter( QObject * o, QEvent * event )
+bool PopupMenuEditorItem::eventFilter( TQObject * o, TQEvent * event )
{
- if ( ! ::qt_cast<QActionGroup*>( o ) )
+ if ( ! ::qt_cast<TQActionGroup*>( o ) )
return FALSE;
- if ( event->type() == QEvent::ChildInserted ) {
- QChildEvent * ce = ( QChildEvent * ) event;
- QObject * c = ce->child();
- QAction * action = ::qt_cast<QAction*>( c );
+ if ( event->type() == TQEvent::ChildInserted ) {
+ TQChildEvent * ce = ( TQChildEvent * ) event;
+ TQObject * c = ce->child();
+ TQAction * action = ::qt_cast<TQAction*>( c );
if ( s->find( action ) != -1 ) // avoid duplicates
return FALSE;
- QActionGroup * actionGroup = ::qt_cast<QActionGroup*>( c );
+ TQActionGroup * actionGroup = ::qt_cast<TQActionGroup*>( c );
if ( actionGroup )
s->insert( actionGroup );
else if ( action )
@@ -255,8 +255,8 @@ PopupMenuEditorItem * PopupMenuEditor::draggedItem = 0;
int PopupMenuEditor::clipboardOperation = 0;
PopupMenuEditorItem * PopupMenuEditor::clipboardItem = 0;
-PopupMenuEditor::PopupMenuEditor( FormWindow * fw, QWidget * parent, const char * name )
- : QWidget( 0, name, WStyle_Customize | WStyle_NoBorder | WRepaintNoErase | WResizeNoErase ),
+PopupMenuEditor::PopupMenuEditor( FormWindow * fw, TQWidget * parent, const char * name )
+ : TQWidget( 0, name, WStyle_Customize | WStyle_NoBorder | WRepaintNoErase | WResizeNoErase ),
formWnd( fw ),
parentMenu( parent ),
iconWidth( 0 ),
@@ -271,8 +271,8 @@ PopupMenuEditor::PopupMenuEditor( FormWindow * fw, QWidget * parent, const char
}
PopupMenuEditor::PopupMenuEditor( FormWindow * fw, PopupMenuEditor * menu,
- QWidget * parent, const char * name )
- : QWidget( 0, name, WStyle_Customize | WStyle_NoBorder | WRepaintNoErase ),
+ TQWidget * parent, const char * name )
+ : TQWidget( 0, name, WStyle_Customize | WStyle_NoBorder | WRepaintNoErase ),
formWnd( fw ),
parentMenu( parent ),
iconWidth( menu->iconWidth ),
@@ -298,7 +298,7 @@ PopupMenuEditor::~PopupMenuEditor()
void PopupMenuEditor::init()
{
- reparent( ( QMainWindow * ) formWnd->mainContainer(), pos() );
+ reparent( ( TQMainWindow * ) formWnd->mainContainer(), pos() );
addItem.action()->setMenuText( i18n("new item") );
addSeparator.action()->setMenuText( i18n("new separator") );
@@ -306,15 +306,15 @@ void PopupMenuEditor::init()
setAcceptDrops( TRUE );
setFocusPolicy( StrongFocus );
- lineEdit = new QLineEdit( this );
+ lineEdit = new TQLineEdit( this );
lineEdit->hide();
- lineEdit->setFrameStyle(QFrame::Plain | QFrame::NoFrame);
+ lineEdit->setFrameStyle(TQFrame::Plain | TQFrame::NoFrame);
lineEdit->polish();
lineEdit->setBackgroundOrigin(ParentOrigin);
lineEdit->setBackgroundMode(PaletteButton);
lineEdit->installEventFilter( this );
- dropLine = new QWidget( this, 0, Qt::WStyle_NoBorder | WStyle_StaysOnTop );
+ dropLine = new TQWidget( this, 0, Qt::WStyle_NoBorder | WStyle_StaysOnTop );
dropLine->setBackgroundColor( Qt::red );
dropLine->hide();
@@ -342,39 +342,39 @@ void PopupMenuEditor::insert( PopupMenuEditorItem * item, int index )
emit inserted( item->action() );
}
-void PopupMenuEditor::insert( QAction * action, int index )
+void PopupMenuEditor::insert( TQAction * action, int index )
{
if ( !action )
return;
insert( new PopupMenuEditorItem( action, this, 0, action->name() ), index );
}
-void PopupMenuEditor::insert( QActionGroup * actionGroup, int index )
+void PopupMenuEditor::insert( TQActionGroup * actionGroup, int index )
{
if ( !actionGroup )
return;
bool dropdown = actionGroup->usesDropDown();
- PopupMenuEditorItem *i = new PopupMenuEditorItem( (QAction *)actionGroup, this, 0,
- QString( actionGroup->name() ) + "Menu" );
- QActionGroup *g = 0;
- QObjectList *l = actionGroup->queryList( "QAction", 0, FALSE, FALSE );
- QObjectListIterator it( *l );
+ PopupMenuEditorItem *i = new PopupMenuEditorItem( (TQAction *)actionGroup, this, 0,
+ TQString( actionGroup->name() ) + "Menu" );
+ TQActionGroup *g = 0;
+ TQObjectList *l = actionGroup->queryList( "TQAction", 0, FALSE, FALSE );
+ TQObjectListIterator it( *l );
insert( i, index );
for ( ; it.current(); ++it ) {
- g = ::qt_cast<QActionGroup*>(it.current());
+ g = ::qt_cast<TQActionGroup*>(it.current());
if ( g ) {
if ( dropdown )
i->s->insert( g );
else
insert( g );
} else {
- i->s->insert( (QAction*)it.current() );
+ i->s->insert( (TQAction*)it.current() );
}
}
delete l;
}
-int PopupMenuEditor::find( const QAction * action )
+int PopupMenuEditor::find( const TQAction * action )
{
PopupMenuEditorItem * i = itemList.first();
while ( i ) {
@@ -469,9 +469,9 @@ void PopupMenuEditor::paste( int index )
}
}
-void PopupMenuEditor::insertedActions( QPtrList<QAction> & list )
+void PopupMenuEditor::insertedActions( TQPtrList<TQAction> & list )
{
- QAction * a = 0;
+ TQAction * a = 0;
PopupMenuEditorItem * i = itemList.first();
while ( i ) {
@@ -485,7 +485,7 @@ void PopupMenuEditor::insertedActions( QPtrList<QAction> & list )
void PopupMenuEditor::show()
{
resizeToContents();
- QWidget::show();
+ TQWidget::show();
}
void PopupMenuEditor::choosePixmap( int index )
@@ -493,7 +493,7 @@ void PopupMenuEditor::choosePixmap( int index )
int idx = ( index == -1 ? currentIndex : index );
PopupMenuEditorItem * i = 0;
- QAction * a = 0;
+ TQAction * a = 0;
if ( idx < (int)itemList.count() ) {
i = itemList.at( idx );
@@ -503,7 +503,7 @@ void PopupMenuEditor::choosePixmap( int index )
}
hide(); // qChoosePixmap hides the menu
- QIconSet icons( qChoosePixmap( 0, formWnd, 0, 0 ) );
+ TQIconSet icons( qChoosePixmap( 0, formWnd, 0, 0 ) );
SetActionIconsCommand * cmd =
new SetActionIconsCommand( i18n( "Set Icon" ), formWnd, a, this, icons );
formWnd->commandHistory()->addCommand( cmd );
@@ -557,22 +557,22 @@ void PopupMenuEditor::setAccelerator( int key, Qt::ButtonState state, int index
int alt = ( state & Qt::AltButton ? Qt::ALT : 0 );
int meta = ( state & Qt::MetaButton ? Qt::META : 0 );
- QAction * a = i->action();
- QKeySequence ks = a->accel();
+ TQAction * a = i->action();
+ TQKeySequence ks = a->accel();
int keys[4] = { ks[0], ks[1], ks[2], ks[3] };
int n = 0;
while ( n < 4 && ks[n++] );
n--;
if ( n < 4 )
keys[n] = key | shift | ctrl | alt | meta;
- a->setAccel( QKeySequence( keys[0], keys[1], keys[2], keys[3] ) );
+ a->setAccel( TQKeySequence( keys[0], keys[1], keys[2], keys[3] ) );
MetaDataBase::setPropertyChanged( a, "accel", TRUE );
resizeToContents();
}
void PopupMenuEditor::resizeToContents()
{
- QSize s = contentsSize();
+ TQSize s = contentsSize();
dropLine->resize( s.width(), 2 );
s.rwidth() += borderSize * 2;
s.rheight() += borderSize * 2;
@@ -618,13 +618,13 @@ void PopupMenuEditor::remove( int index )
}
}
-PopupMenuEditorItem * PopupMenuEditor::createItem( QAction * a )
+PopupMenuEditorItem * PopupMenuEditor::createItem( TQAction * a )
{
ActionEditor * ae = (ActionEditor *) formWindow()->mainWindow()->child( 0, "ActionEditor" );
if ( !a )
a = ae->newActionEx();
PopupMenuEditorItem * i = new PopupMenuEditorItem( a, this );
- QString n = QString( a->name() ) + "Item";
+ TQString n = TQString( a->name() ) + "Item";
formWindow()->unify( i, n, FALSE );
i->setName( n );
AddActionToPopupCommand * cmd =
@@ -677,7 +677,7 @@ PopupMenuEditorItem * PopupMenuEditor::itemAt( int y )
return &addSeparator;
}
-void PopupMenuEditor::setFocusAt( const QPoint & pos )
+void PopupMenuEditor::setFocusAt( const TQPoint & pos )
{
hideSubMenu();
lineEdit->hide();
@@ -712,30 +712,30 @@ void PopupMenuEditor::setFocusAt( const QPoint & pos )
showSubMenu();
}
-bool PopupMenuEditor::eventFilter( QObject * o, QEvent * e )
+bool PopupMenuEditor::eventFilter( TQObject * o, TQEvent * e )
{
- if ( o == lineEdit && e->type() == QEvent::FocusOut ) {
+ if ( o == lineEdit && e->type() == TQEvent::FocusOut ) {
leaveEditMode( 0 );
update();
}
- return QWidget::eventFilter( o, e );
+ return TQWidget::eventFilter( o, e );
}
-void PopupMenuEditor::paintEvent( QPaintEvent * )
+void PopupMenuEditor::paintEvent( TQPaintEvent * )
{
- QPainter p( this );
+ TQPainter p( this );
p.save();
- QRegion reg( rect() );
- QRegion mid( borderSize, borderSize,
+ TQRegion reg( rect() );
+ TQRegion mid( borderSize, borderSize,
rect().width() - borderSize * 2, rect().height() - borderSize * 2 );
reg -= mid;
p.setClipRegion( reg );
- style().drawPrimitive( QStyle::PE_PanelPopup, &p, rect(), colorGroup() );
+ style().drawPrimitive( TQStyle::PE_PanelPopup, &p, rect(), colorGroup() );
p.restore();
drawItems( &p );
}
-void PopupMenuEditor::mousePressEvent( QMouseEvent * e )
+void PopupMenuEditor::mousePressEvent( TQMouseEvent * e )
{
mousePressPos = e->pos();
setFocusAt( mousePressPos );
@@ -743,7 +743,7 @@ void PopupMenuEditor::mousePressEvent( QMouseEvent * e )
update();
}
-void PopupMenuEditor::mouseDoubleClickEvent( QMouseEvent * )
+void PopupMenuEditor::mouseDoubleClickEvent( TQMouseEvent * )
{
setFocusAt( mousePressPos );
if ( currentItem() == &addSeparator ) {
@@ -759,7 +759,7 @@ void PopupMenuEditor::mouseDoubleClickEvent( QMouseEvent * )
}
}
-void PopupMenuEditor::mouseMoveEvent( QMouseEvent * e )
+void PopupMenuEditor::mouseMoveEvent( TQMouseEvent * e )
{
if ( e->state() & Qt::LeftButton ) {
if ( ( e->pos() - mousePressPos ).manhattanLength() > 3 ) {
@@ -787,7 +787,7 @@ void PopupMenuEditor::mouseMoveEvent( QMouseEvent * e )
// we will have two instances of the same pointer
// in the list. We use node instead.
int idx = itemList.find( draggedItem );
- QLNode * node = itemList.currentNode();
+ TQLNode * node = itemList.currentNode();
d->dragCopy(); // dragevents and stuff happens
@@ -810,7 +810,7 @@ void PopupMenuEditor::mouseMoveEvent( QMouseEvent * e )
}
}
-void PopupMenuEditor::dragEnterEvent( QDragEnterEvent * e )
+void PopupMenuEditor::dragEnterEvent( TQDragEnterEvent * e )
{
if ( e->provides( "qt/popupmenueditoritemptr" ) ||
e->provides( "application/x-designer-actions" ) ||
@@ -820,14 +820,14 @@ void PopupMenuEditor::dragEnterEvent( QDragEnterEvent * e )
}
}
-void PopupMenuEditor::dragLeaveEvent( QDragLeaveEvent * )
+void PopupMenuEditor::dragLeaveEvent( TQDragLeaveEvent * )
{
dropLine->hide();
}
-void PopupMenuEditor::dragMoveEvent( QDragMoveEvent * e )
+void PopupMenuEditor::dragMoveEvent( TQDragMoveEvent * e )
{
- QPoint pos = e->pos();
+ TQPoint pos = e->pos();
dropLine->move( borderSize, snapToItem( pos.y() ) );
if ( currentItem() != itemAt( pos.y() ) ) {
@@ -837,7 +837,7 @@ void PopupMenuEditor::dragMoveEvent( QDragMoveEvent * e )
}
}
-void PopupMenuEditor::dropEvent( QDropEvent * e )
+void PopupMenuEditor::dropEvent( TQDropEvent * e )
{
if ( !( e->provides( "qt/popupmenueditoritemptr" ) ||
e->provides( "application/x-designer-actions" ) ||
@@ -847,7 +847,7 @@ void PopupMenuEditor::dropEvent( QDropEvent * e )
// Hide the sub menu of the current item, but do it later
if ( currentIndex < (int)itemList.count() ) {
PopupMenuEditor *s = itemList.at( currentIndex )->s;
- QTimer::singleShot( 0, s, SLOT( hide() ) );
+ TQTimer::singleShot( 0, s, TQT_SLOT( hide() ) );
}
draggedItem = 0;
@@ -857,43 +857,43 @@ void PopupMenuEditor::dropEvent( QDropEvent * e )
PopupMenuEditorItemPtrDrag::decode( e, &i );
} else {
if ( e->provides( "application/x-designer-actiongroup" ) ) {
- QActionGroup * g = ::qt_cast<QDesignerActionGroup*>(ActionDrag::action());
+ TQActionGroup * g = ::qt_cast<QDesignerActionGroup*>(ActionDrag::action());
if ( g->usesDropDown() ) {
i = new PopupMenuEditorItem( g, this );
- QString n = QString( g->name() ) + "Item";
+ TQString n = TQString( g->name() ) + "Item";
formWindow()->unify( i, n, FALSE );
i->setName( n );
- QObjectList *l = g->queryList( "QAction", 0, FALSE, FALSE );
- QObjectListIterator it( *l );
+ TQObjectList *l = g->queryList( "TQAction", 0, FALSE, FALSE );
+ TQObjectListIterator it( *l );
for ( ; it.current(); ++it ) {
- g = ::qt_cast<QActionGroup*>(it.current());
+ g = ::qt_cast<TQActionGroup*>(it.current());
if ( g )
i->s->insert( g );
else
- i->s->insert( (QAction*)it.current() );
+ i->s->insert( (TQAction*)it.current() );
}
delete l;
} else {
dropInPlace( g, e->pos().y() );
}
} else if ( e->provides( "application/x-designer-actions" ) ) {
- QAction *a = ::qt_cast<QDesignerAction*>(ActionDrag::action());
+ TQAction *a = ::qt_cast<QDesignerAction*>(ActionDrag::action());
i = new PopupMenuEditorItem( a, this );
}
}
if ( i ) {
dropInPlace( i, e->pos().y() );
- QTimer::singleShot( 0, this, SLOT( resizeToContents() ) );
+ TQTimer::singleShot( 0, this, TQT_SLOT( resizeToContents() ) );
}
- QTimer::singleShot( 0, this, SLOT( showSubMenu() ) );
- QTimer::singleShot( 0, this, SLOT( setFocus() ) );
+ TQTimer::singleShot( 0, this, TQT_SLOT( showSubMenu() ) );
+ TQTimer::singleShot( 0, this, TQT_SLOT( setFocus() ) );
dropLine->hide();
e->accept();
}
-void PopupMenuEditor::keyPressEvent( QKeyEvent * e )
+void PopupMenuEditor::keyPressEvent( TQKeyEvent * e )
{
if ( lineEdit->isHidden() ) { // In navigation mode
@@ -978,7 +978,7 @@ void PopupMenuEditor::keyPressEvent( QKeyEvent * e )
return;
if ( currentField == 1 ) {
showLineEdit();
- QApplication::sendEvent( lineEdit, e );
+ TQApplication::sendEvent( lineEdit, e );
e->accept();
return;
} else if ( currentField == 2 ) {
@@ -1002,21 +1002,21 @@ void PopupMenuEditor::keyPressEvent( QKeyEvent * e )
update();
}
-void PopupMenuEditor::focusInEvent( QFocusEvent * )
+void PopupMenuEditor::focusInEvent( TQFocusEvent * )
{
showSubMenu();
update();
parentMenu->update();
}
-void PopupMenuEditor::focusOutEvent( QFocusEvent * )
+void PopupMenuEditor::focusOutEvent( TQFocusEvent * )
{
- QWidget * fw = qApp->focusWidget();
+ TQWidget * fw = qApp->focusWidget();
if ( !fw || ( !::qt_cast<PopupMenuEditor*>(fw) && fw != lineEdit ) ) {
hideSubMenu();
if ( fw && ::qt_cast<MenuBarEditor*>(fw) )
return;
- QWidget * w = this;
+ TQWidget * w = this;
while ( w && w != fw && ::qt_cast<PopupMenuEditor*>(w) ) { // hide all popups
w->hide();
w = ((PopupMenuEditor *)w)->parentEditor();
@@ -1024,52 +1024,52 @@ void PopupMenuEditor::focusOutEvent( QFocusEvent * )
}
}
-void PopupMenuEditor::drawItem( QPainter * p, PopupMenuEditorItem * i,
- const QRect & r, int f ) const
+void PopupMenuEditor::drawItem( TQPainter * p, PopupMenuEditorItem * i,
+ const TQRect & r, int f ) const
{
int x = r.x();
int y = r.y();
int h = r.height();
- p->fillRect( r, colorGroup().brush( QColorGroup::Background ) );
+ p->fillRect( r, colorGroup().brush( TQColorGroup::Background ) );
if ( i->isSeparator() ) {
- style().drawPrimitive( QStyle::PE_Separator, p,
- QRect( r.x(), r.y() + 2, r.width(), 1 ),
- colorGroup(), QStyle::Style_Sunken | f );
+ style().drawPrimitive( TQStyle::PE_Separator, p,
+ TQRect( r.x(), r.y() + 2, r.width(), 1 ),
+ colorGroup(), TQStyle::Style_Sunken | f );
return;
}
- const QAction * a = i->action();
+ const TQAction * a = i->action();
if ( a->isToggleAction() && a->isOn() ) {
- style().drawPrimitive( QStyle::PE_CheckMark, p,
- QRect( x , y, iconWidth, h ),
+ style().drawPrimitive( TQStyle::PE_CheckMark, p,
+ TQRect( x , y, iconWidth, h ),
colorGroup(), f );
} else {
- QPixmap icon = a->iconSet().pixmap( QIconSet::Automatic, QIconSet::Normal );
+ TQPixmap icon = a->iconSet().pixmap( TQIconSet::Automatic, TQIconSet::Normal );
p->drawPixmap( x + ( iconWidth - icon.width() ) / 2,
y + ( h - icon.height() ) / 2,
icon );
}
x += iconWidth;
p->drawText( x, y, textWidth, h,
- QPainter::AlignLeft |
- QPainter::AlignVCenter |
+ TQPainter::AlignLeft |
+ TQPainter::AlignVCenter |
Qt::ShowPrefix |
Qt::SingleLine,
a->menuText() );
x += textWidth + borderSize * 3;
p->drawText( x, y, accelWidth, h,
- QPainter::AlignLeft | QPainter::AlignVCenter,
+ TQPainter::AlignLeft | TQPainter::AlignVCenter,
a->accel() );
if ( i->count() ) // Item has submenu
- style().drawPrimitive( QStyle::PE_ArrowRight, p,
- QRect( r.width() - arrowWidth, r.y(), arrowWidth, r.height() ),
+ style().drawPrimitive( TQStyle::PE_ArrowRight, p,
+ TQRect( r.width() - arrowWidth, r.y(), arrowWidth, r.height() ),
colorGroup(), f );
}
-void PopupMenuEditor::drawWinFocusRect( QPainter * p, const QRect & r ) const
+void PopupMenuEditor::drawWinFocusRect( TQPainter * p, const TQRect & r ) const
{
if ( currentIndex < (int)itemList.count() &&
((PopupMenuEditor*)this)->itemList.at( currentIndex )->isSeparator() ) {
@@ -1087,15 +1087,15 @@ void PopupMenuEditor::drawWinFocusRect( QPainter * p, const QRect & r ) const
borderSize * 3, y, accelWidth, h );
}
-void PopupMenuEditor::drawItems( QPainter * p )
+void PopupMenuEditor::drawItems( TQPainter * p )
{
int flags = 0;
int idx = 0;
- QColorGroup enabled = colorGroup();
- QColorGroup disabled = palette().disabled();
- QRect focus;
- QRect rect( borderSize, borderSize, width() - borderSize * 2, 0 );
+ TQColorGroup enabled = colorGroup();
+ TQColorGroup disabled = palette().disabled();
+ TQRect focus;
+ TQRect rect( borderSize, borderSize, width() - borderSize * 2, 0 );
PopupMenuEditorItem * i = itemList.first();
while ( i ) {
@@ -1104,10 +1104,10 @@ void PopupMenuEditor::drawItems( QPainter * p )
if ( idx == currentIndex )
focus = rect;
if ( i->action()->isEnabled() ) {
- flags = QStyle::Style_Enabled;
+ flags = TQStyle::Style_Enabled;
p->setPen( enabled.buttonText() );
} else {
- flags = QStyle::Style_Default;
+ flags = TQStyle::Style_Default;
p->setPen( disabled.buttonText() );
}
drawItem( p, i, rect, flags );
@@ -1122,22 +1122,22 @@ void PopupMenuEditor::drawItems( QPainter * p )
rect.setHeight( itemHeight( &addItem ) );
if ( idx == currentIndex )
focus = rect;
- drawItem( p, &addItem, rect, QStyle::Style_Default );
+ drawItem( p, &addItem, rect, TQStyle::Style_Default );
rect.moveBy( 0, rect.height() );
idx++;
rect.setHeight( itemHeight( &addSeparator ) );
if ( idx == currentIndex )
focus = rect;
- drawItem( p, &addSeparator, rect, QStyle::Style_Default );
+ drawItem( p, &addSeparator, rect, TQStyle::Style_Default );
idx++;
if ( hasFocus() && !draggedItem )
drawWinFocusRect( p, focus );
}
-QSize PopupMenuEditor::contentsSize()
+TQSize PopupMenuEditor::contentsSize()
{
- QRect textRect = fontMetrics().boundingRect( addSeparator.action()->menuText() );
+ TQRect textRect = fontMetrics().boundingRect( addSeparator.action()->menuText() );
textWidth = textRect.width();
accelWidth = textRect.height(); // default size
iconWidth = textRect.height();
@@ -1145,12 +1145,12 @@ QSize PopupMenuEditor::contentsSize()
int w = 0;
int h = itemHeight( &addItem ) + itemHeight( &addSeparator );
PopupMenuEditorItem * i = itemList.first();
- QAction * a = 0;
+ TQAction * a = 0;
while ( i ) {
if ( i->isVisible() ) {
if ( !i->isSeparator() ) {
a = i->action();
- w = a->iconSet().pixmap( QIconSet::Automatic, QIconSet::Normal ).rect().width() +
+ w = a->iconSet().pixmap( TQIconSet::Automatic, TQIconSet::Normal ).rect().width() +
borderSize; // padding
iconWidth = QMAX( iconWidth, w );
w = fontMetrics().boundingRect( a->menuText() ).width();
@@ -1164,7 +1164,7 @@ QSize PopupMenuEditor::contentsSize()
}
int width = iconWidth + textWidth + borderSize * 3 + accelWidth + arrowWidth;
- return QSize( width, h );
+ return TQSize( width, h );
}
int PopupMenuEditor::itemHeight( const PopupMenuEditorItem * item ) const
@@ -1174,8 +1174,8 @@ int PopupMenuEditor::itemHeight( const PopupMenuEditorItem * item ) const
if ( item->isSeparator() )
return 4; // FIXME: hardcoded ( get from styles )r
int padding = + borderSize * 6;
- QAction * a = item->action();
- int h = a->iconSet().pixmap( QIconSet::Automatic, QIconSet::Normal ).rect().height();
+ TQAction * a = item->action();
+ int h = a->iconSet().pixmap( TQIconSet::Automatic, TQIconSet::Normal ).rect().height();
h = QMAX( h, fontMetrics().boundingRect( a->menuText() ).height() + padding );
h = QMAX( h, fontMetrics().boundingRect( a->accel() ).height() + padding );
return h;
@@ -1237,14 +1237,14 @@ void PopupMenuEditor::dropInPlace( PopupMenuEditorItem * i, int y )
currentField = 1;
}
-void PopupMenuEditor::dropInPlace( QActionGroup * g, int y )
+void PopupMenuEditor::dropInPlace( TQActionGroup * g, int y )
{
if (!g->children())
return;
- QObjectList l = *g->children();
+ TQObjectList l = *g->children();
for ( int i = 0; i < (int)l.count(); ++i ) {
- QAction *a = ::qt_cast<QAction*>(l.at(i));
- QActionGroup *g = ::qt_cast<QActionGroup*>(l.at(i));
+ TQAction *a = ::qt_cast<TQAction*>(l.at(i));
+ TQActionGroup *g = ::qt_cast<TQActionGroup*>(l.at(i));
if ( g )
dropInPlace( g, y );
else if ( a )
@@ -1283,7 +1283,7 @@ void PopupMenuEditor::clearCurrentField()
if ( i->isSeparator() )
return;
if ( currentField == 0 ) {
- QIconSet icons( 0 );
+ TQIconSet icons( 0 );
SetActionIconsCommand * cmd = new SetActionIconsCommand( i18n( "Remove Icon" ),
formWnd,
i->action(),
@@ -1375,7 +1375,7 @@ void PopupMenuEditor::navigateRight()
}
}
-void PopupMenuEditor::enterEditMode( QKeyEvent * e )
+void PopupMenuEditor::enterEditMode( TQKeyEvent * e )
{
PopupMenuEditorItem * i = currentItem();
@@ -1395,7 +1395,7 @@ void PopupMenuEditor::enterEditMode( QKeyEvent * e )
return;
}
-void PopupMenuEditor::leaveEditMode( QKeyEvent * e )
+void PopupMenuEditor::leaveEditMode( TQKeyEvent * e )
{
setFocus();
lineEdit->hide();
@@ -1408,14 +1408,14 @@ void PopupMenuEditor::leaveEditMode( QKeyEvent * e )
if ( currentIndex >= (int)itemList.count() ) {
// new item was created
- QAction * a = formWnd->mainWindow()->actioneditor()->newActionEx();
- QString actionText = lineEdit->text();
+ TQAction * a = formWnd->mainWindow()->actioneditor()->newActionEx();
+ TQString actionText = lineEdit->text();
actionText.replace("&&", "&");
- QString menuText = lineEdit->text();
+ TQString menuText = lineEdit->text();
a->setText( actionText );
a->setMenuText( menuText );
i = createItem( a );
- QString n = constructName( i );
+ TQString n = constructName( i );
formWindow()->unify( a, n, TRUE );
a->setName( n );
MetaDataBase::addEntry( a );
@@ -1444,22 +1444,22 @@ void PopupMenuEditor::leaveEditMode( QKeyEvent * e )
showSubMenu();
}
-QString PopupMenuEditor::constructName( PopupMenuEditorItem *item )
+TQString PopupMenuEditor::constructName( PopupMenuEditorItem *item )
{
- QString s;
- QString name = item->action()->menuText();
- QWidget *e = parentEditor();
+ TQString s;
+ TQString name = item->action()->menuText();
+ TQWidget *e = parentEditor();
PopupMenuEditor *p = ::qt_cast<PopupMenuEditor*>(e);
if ( p ) {
int idx = p->find( item->m );
PopupMenuEditorItem * i = ( idx > -1 ? p->at( idx ) : 0 );
- s = ( i ? QString( i->action()->name() ).remove( "Action" ) : QString( "" ) );
+ s = ( i ? TQString( i->action()->name() ).remove( "Action" ) : TQString( "" ) );
} else {
MenuBarEditor *b = ::qt_cast<MenuBarEditor*>(e);
if ( b ) {
int idx = b->findItem( item->m );
MenuBarEditorItem * i = ( idx > -1 ? b->item( idx ) : 0 );
- s = ( i ? i->menuText().lower() : QString( "" ) );
+ s = ( i ? i->menuText().lower() : TQString( "" ) );
}
}
// replace illegal characters