summaryrefslogtreecommitdiffstats
path: root/krita/ui/layerlist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'krita/ui/layerlist.cpp')
-rw-r--r--krita/ui/layerlist.cpp444
1 files changed, 222 insertions, 222 deletions
diff --git a/krita/ui/layerlist.cpp b/krita/ui/layerlist.cpp
index 5246896d..d1c925b4 100644
--- a/krita/ui/layerlist.cpp
+++ b/krita/ui/layerlist.cpp
@@ -20,15 +20,15 @@
#include "layerlist.h"
-#include <qtooltip.h>
-#include <qbitmap.h>
-#include <qcursor.h>
-#include <qimage.h>
-#include <qheader.h>
-#include <qpainter.h>
-#include <qpixmap.h>
-#include <qsimplerichtext.h>
-#include <qtimer.h>
+#include <tqtooltip.h>
+#include <tqbitmap.h>
+#include <tqcursor.h>
+#include <tqimage.h>
+#include <tqheader.h>
+#include <tqpainter.h>
+#include <tqpixmap.h>
+#include <tqsimplerichtext.h>
+#include <tqtimer.h>
#include <kapplication.h>
#include <kdebug.h>
@@ -40,27 +40,27 @@
#include <kpopupmenu.h>
#include <kstringhandler.h>
-class LayerItemIterator: public QListViewItemIterator
+class LayerItemIterator: public TQListViewItemIterator
{
public:
- LayerItemIterator( LayerList *list ): QListViewItemIterator( list ) { }
- LayerItemIterator( LayerList *list, IteratorFlag flags ): QListViewItemIterator( list, flags ) { }
- LayerItemIterator( LayerItem *item ): QListViewItemIterator( item ) { }
- LayerItemIterator( LayerItem *item, IteratorFlag flags ): QListViewItemIterator( item, flags ) { }
- LayerItem *operator*() { return static_cast<LayerItem*>( QListViewItemIterator::operator*() ); }
+ LayerItemIterator( LayerList *list ): TQListViewItemIterator( list ) { }
+ LayerItemIterator( LayerList *list, IteratorFlag flags ): TQListViewItemIterator( list, flags ) { }
+ LayerItemIterator( LayerItem *item ): TQListViewItemIterator( item ) { }
+ LayerItemIterator( LayerItem *item, IteratorFlag flags ): TQListViewItemIterator( item, flags ) { }
+ LayerItem *operator*() { return static_cast<LayerItem*>( TQListViewItemIterator::operator*() ); }
};
struct LayerProperty
{
- QString name;
- QString displayName;
- QPixmap enabledIcon;
- QPixmap disabledIcon;
+ TQString name;
+ TQString displayName;
+ TQPixmap enabledIcon;
+ TQPixmap disabledIcon;
bool defaultValue;
bool validForFolders;
LayerProperty(): defaultValue( false ), validForFolders( true ) { }
- LayerProperty( const QString &pname, const QString &pdisplayName, const QPixmap &enabled, const QPixmap &disabled,
+ LayerProperty( const TQString &pname, const TQString &pdisplayName, const TQPixmap &enabled, const TQPixmap &disabled,
bool pdefaultValue, bool pvalidForFolders )
: name( pname ),
displayName( pdisplayName ),
@@ -79,11 +79,11 @@ public:
bool foldersCanBeActive;
bool previewsShown;
int itemHeight;
- QValueList<LayerProperty> properties;
+ TQValueList<LayerProperty> properties;
KPopupMenu contextMenu;
LayerToolTip *tooltip;
- Private( QWidget *parent, LayerList *list );
+ Private( TQWidget *tqparent, LayerList *list );
~Private();
};
@@ -92,43 +92,43 @@ class LayerItem::Private
public:
bool isFolder;
int id;
- QValueList<bool> properties;
- QImage *previewImage;
+ TQValueList<bool> properties;
+ TQImage *previewImage;
bool previewChanged;
- QPixmap scaledPreview;
- QSize previewSize;
- QPoint previewOffset;
+ TQPixmap scaledPreview;
+ TQSize previewSize;
+ TQPoint previewOffset;
Private( int pid ): isFolder( false ), id( pid ), previewImage( 0 ), previewChanged( false )
{ }
};
static const int MAX_SIZE = 256;
-class LayerToolTip: public QToolTip, public QFrame
+class LayerToolTip: public TQToolTip, public TQFrame
{
LayerList *m_list;
LayerItem *m_item;
- QPoint m_pos;
- QTimer m_timer;
- QImage m_img;
+ TQPoint m_pos;
+ TQTimer m_timer;
+ TQImage m_img;
public:
- LayerToolTip( QWidget *parent, LayerList *list )
- : QToolTip( parent ),
- QFrame( 0, 0, WStyle_Customize | WStyle_NoBorder | WStyle_Tool | WStyle_StaysOnTop | WX11BypassWM | WNoAutoErase ),
+ LayerToolTip( TQWidget *tqparent, LayerList *list )
+ : TQToolTip( tqparent ),
+ TQFrame( 0, 0, WStyle_Customize | WStyle_NoBorder | WStyle_Tool | WStyle_StaysOnTop | WX11BypassWM | WNoAutoErase ),
m_list( list )
{
- QFrame::setPalette( QToolTip::palette() );
- connect( &m_timer, SIGNAL( timeout() ), m_list, SLOT( hideTip() ) );
- qApp->installEventFilter( this );
+ TQFrame::setPalette( TQToolTip::palette() );
+ connect( &m_timer, TQT_SIGNAL( timeout() ), m_list, TQT_SLOT( hideTip() ) );
+ tqApp->installEventFilter( this );
}
- virtual void maybeTip( const QPoint &pos )
+ virtual void maybeTip( const TQPoint &pos )
{
m_pos = pos;
LayerItem *prev = m_item;
m_item = static_cast<LayerItem*>(m_list->itemAt( m_pos ));
- if( QToolTip::parentWidget() && m_list->showToolTips() && m_item )
+ if( TQToolTip::tqparentWidget() && m_list->showToolTips() && m_item )
{
if( m_item != prev )
hideTip();
@@ -142,9 +142,9 @@ public:
{
m_img = m_item->tooltipPreview();
m_timer.start( 15000, true );
- if( !isVisible() || sizeHint() != size() )
+ if( !isVisible() || tqsizeHint() != size() )
{
- resize( sizeHint() );
+ resize( tqsizeHint() );
position();
}
if( !isVisible() )
@@ -157,29 +157,29 @@ public:
{
if( !isVisible() )
return;
- QFrame::hide();
- QToolTip::hide();
+ TQFrame::hide();
+ TQToolTip::hide();
m_timer.stop();
m_img.reset();
m_list->triggerUpdate();
}
- virtual void drawContents( QPainter *painter )
+ virtual void drawContents( TQPainter *painter )
{
- QPixmap buf( width(), height() );
- QPainter p( &buf );
- buf.fill( colorGroup().background() );
- p.setPen( colorGroup().foreground() );
+ TQPixmap buf( width(), height() );
+ TQPainter p( &buf );
+ buf.fill( tqcolorGroup().background() );
+ p.setPen( tqcolorGroup().foreground() );
p.drawRect( buf.rect() );
- QSimpleRichText text( m_item->tooltip(), QToolTip::font() );
- text.setWidth( QCOORD_MAX );
+ TQSimpleRichText text( m_item->tooltip(), TQToolTip::font() );
+ text.setWidth( TQCOORD_MAX );
p.translate( 5, 5 );
if( !m_img.isNull() )
{
if( m_img.width() > MAX_SIZE || m_img.height() > MAX_SIZE )
- m_img = m_img.scale( MAX_SIZE, MAX_SIZE, QImage::ScaleMin );
+ m_img = m_img.scale( MAX_SIZE, MAX_SIZE, TQ_ScaleMin );
int y = 0;
if( m_img.height() < text.height() )
y = text.height()/2 - m_img.height()/2;
@@ -188,18 +188,18 @@ public:
p.translate( m_img.width() + 10, 0 );
}
- text.draw( &p, 0, 0, rect(), colorGroup() );
+ text.draw( &p, 0, 0, rect(), tqcolorGroup() );
painter->drawPixmap( 0, 0, buf );
}
- virtual QSize sizeHint() const
+ virtual TQSize tqsizeHint() const
{
if( !m_item )
- return QSize( 0, 0 );
+ return TQSize( 0, 0 );
- QSimpleRichText text( m_item->tooltip(), QToolTip::font() );
- text.setWidth( QCOORD_MAX );
+ TQSimpleRichText text( m_item->tooltip(), TQToolTip::font() );
+ text.setWidth( TQCOORD_MAX );
int width = text.widthUsed();
if( !m_img.isNull() )
@@ -211,16 +211,16 @@ public:
height = kMin( m_img.height(), MAX_SIZE );
height += 10;
- return QSize( width, height );
+ return TQSize( width, height );
}
void position()
{
- const QRect drect = QApplication::desktop()->availableGeometry( QToolTip::parentWidget() );
- const QSize size = sizeHint();
+ const TQRect drect = TQApplication::desktop()->availableGeometry( TQToolTip::tqparentWidget() );
+ const TQSize size = tqsizeHint();
const int width = size.width(), height = size.height();
- const QRect tmp = m_item->rect();
- const QRect irect( m_list->viewport()->mapToGlobal( m_list->contentsToViewport(tmp.topLeft()) ), tmp.size() );
+ const TQRect tmp = m_item->rect();
+ const TQRect irect( m_list->viewport()->mapToGlobal( m_list->contentsToViewport(tmp.topLeft()) ), tmp.size() );
int y;
if( irect.bottom() + height < drect.bottom() )
@@ -228,27 +228,27 @@ public:
else
y = kMax( drect.top(), irect.top() - height );
- int x = kMax( drect.x(), QToolTip::parentWidget()->mapToGlobal( m_pos ).x() - width/2 );
+ int x = kMax( drect.x(), TQToolTip::tqparentWidget()->mapToGlobal( m_pos ).x() - width/2 );
if( x + width > drect.right() )
x = drect.right() - width;
move( x, y );
}
- virtual bool eventFilter( QObject *, QEvent *e )
+ virtual bool eventFilter( TQObject *, TQEvent *e )
{
if( isVisible() )
switch ( e->type() )
{
- case QEvent::KeyPress:
- case QEvent::KeyRelease:
- case QEvent::MouseButtonPress:
- case QEvent::MouseButtonRelease:
- //case QEvent::MouseMove:
- case QEvent::FocusIn:
- case QEvent::FocusOut:
- case QEvent::Wheel:
- case QEvent::Leave:
+ case TQEvent::KeyPress:
+ case TQEvent::KeyRelease:
+ case TQEvent::MouseButtonPress:
+ case TQEvent::MouseButtonRelease:
+ //case TQEvent::MouseMove:
+ case TQEvent::FocusIn:
+ case TQEvent::FocusOut:
+ case TQEvent::Wheel:
+ case TQEvent::Leave:
hideTip();
default: break;
}
@@ -257,9 +257,9 @@ public:
}
};
-LayerList::Private::Private( QWidget *parent, LayerList *list )
+LayerList::Private::Private( TQWidget *tqparent, LayerList *list )
: activeLayer( 0 ), foldersCanBeActive( false ), previewsShown( false ), itemHeight( 32 ),
- tooltip( new LayerToolTip( parent, list ) ) { }
+ tooltip( new LayerToolTip( tqparent, list ) ) { }
LayerList::Private::~Private()
{
@@ -273,17 +273,17 @@ static int getID()
return id--;
}
-static QSize iconSize() { return QIconSet::iconSize( QIconSet::Small ); }
+static TQSize iconSize() { return TQIconSet::iconSize( TQIconSet::Small ); }
///////////////
// LayerList //
///////////////
-LayerList::LayerList( QWidget *parent, const char *name )
- : super( parent, name ), d( new Private( viewport(), this ) )
+LayerList::LayerList( TQWidget *tqparent, const char *name )
+ : super( tqparent, name ), d( new Private( viewport(), this ) )
{
- setSelectionMode( QListView::Extended );
+ setSelectionMode( TQListView::Extended );
setRootIsDecorated( true );
setSorting( -1 );
setSortColumn( -1 );
@@ -291,23 +291,23 @@ LayerList::LayerList( QWidget *parent, const char *name )
setFullWidth( true );
setItemsRenameable( false );
setDropHighlighter( true );
- setDefaultRenameAction( QListView::Accept );
+ setDefaultRenameAction( TQListView::Accept );
setDragEnabled( true );
setAcceptDrops( true );
setItemsMovable( true );
- addColumn( QString() );
+ addColumn( TQString() );
header()->hide();
- QToolTip::add(this, i18n("Right-click to create folders. Click on the layername to change the layer's name. Click and drag to move layers."));
+ TQToolTip::add(this, i18n("Right-click to create folders. Click on the layername to change the layer's name. Click and drag to move layers."));
setNumRows( 2 );
- connect( this, SIGNAL( itemRenamed( QListViewItem*, const QString&, int ) ),
- SLOT( slotItemRenamed( QListViewItem*, const QString&, int ) ) );
- connect( this, SIGNAL( moved( QPtrList<QListViewItem>&, QPtrList<QListViewItem>&, QPtrList<QListViewItem>& ) ),
- SLOT( slotItemMoved( QPtrList<QListViewItem>&, QPtrList<QListViewItem>&, QPtrList<QListViewItem>& ) ) );
- connect( this, SIGNAL( onItem( QListViewItem* ) ), SLOT( hideTip() ) );
- connect( this, SIGNAL( onViewport() ), SLOT( hideTip() ) );
+ connect( this, TQT_SIGNAL( itemRenamed( TQListViewItem*, const TQString&, int ) ),
+ TQT_SLOT( slotItemRenamed( TQListViewItem*, const TQString&, int ) ) );
+ connect( this, TQT_SIGNAL( moved( TQPtrList<TQListViewItem>&, TQPtrList<TQListViewItem>&, TQPtrList<TQListViewItem>& ) ),
+ TQT_SLOT( slotItemMoved( TQPtrList<TQListViewItem>&, TQPtrList<TQListViewItem>&, TQPtrList<TQListViewItem>& ) ) );
+ connect( this, TQT_SIGNAL( onItem( TQListViewItem* ) ), TQT_SLOT( hideTip() ) );
+ connect( this, TQT_SIGNAL( onViewport() ), TQT_SLOT( hideTip() ) );
}
LayerList::~LayerList()
@@ -315,13 +315,13 @@ LayerList::~LayerList()
delete d;
}
-void LayerList::addProperty( const QString &name, const QString &displayName, const QIconSet &icon,
+void LayerList::addProperty( const TQString &name, const TQString &displayName, const TQIconSet &icon,
bool defaultValue, bool validForFolders )
{
- addProperty( name, displayName, icon.pixmap( QIconSet::Small, QIconSet::Normal ), icon.pixmap( QIconSet::Small, QIconSet::Disabled ), defaultValue, validForFolders );
+ addProperty( name, displayName, icon.pixmap( TQIconSet::Small, TQIconSet::Normal ), icon.pixmap( TQIconSet::Small, TQIconSet::Disabled ), defaultValue, validForFolders );
}
-void LayerList::addProperty( const QString &name, const QString &displayName, QPixmap enabled, QPixmap disabled,
+void LayerList::addProperty( const TQString &name, const TQString &displayName, TQPixmap enabled, TQPixmap disabled,
bool defaultValue, bool validForFolders )
{
d->properties.append( LayerProperty( name, displayName, enabled, disabled, defaultValue, validForFolders ) );
@@ -376,12 +376,12 @@ int LayerList::activeLayerID() const
return -1;
}
-QValueList<LayerItem*> LayerList::selectedLayers() const
+TQValueList<LayerItem*> LayerList::selectedLayers() const
{
if( !firstChild() )
- return QValueList<LayerItem*>();
+ return TQValueList<LayerItem*>();
- QValueList<LayerItem*> layers;
+ TQValueList<LayerItem*> layers;
for( LayerItemIterator it( firstChild() ); *it; ++it )
if( (*it)->isSelected() )
layers.append( *it );
@@ -389,10 +389,10 @@ QValueList<LayerItem*> LayerList::selectedLayers() const
return layers;
}
-QValueList<int> LayerList::selectedLayerIDs() const
+TQValueList<int> LayerList::selectedLayerIDs() const
{
- const QValueList<LayerItem*> layers = selectedLayers();
- QValueList<int> ids;
+ const TQValueList<LayerItem*> layers = selectedLayers();
+ TQValueList<int> ids;
for( int i = 0, n = layers.count(); i < n; ++i )
ids.append( layers[i]->id() );
@@ -438,16 +438,16 @@ bool LayerList::isFolder( int id ) const
return l->isFolder();
}
-QString LayerList::displayName( int id ) const
+TQString LayerList::displayName( int id ) const
{
LayerItem* const l = layer( id );
if( !l )
- return QString::null; //should be more severe...
+ return TQString(); //should be more severe...
return l->displayName();
}
-bool LayerList::property( int id, const QString &name ) const
+bool LayerList::property( int id, const TQString &name ) const
{
LayerItem* const l = layer( id );
if( !l )
@@ -533,7 +533,7 @@ void LayerList::setActiveLayer( int id ) //SLOT
setActiveLayer( layer( id ) );
}
-void LayerList::setLayerDisplayName( LayerItem *layer, const QString &displayName )
+void LayerList::setLayerDisplayName( LayerItem *layer, const TQString &displayName )
{
if( !layer )
return;
@@ -541,12 +541,12 @@ void LayerList::setLayerDisplayName( LayerItem *layer, const QString &displayNam
layer->setDisplayName( displayName );
}
-void LayerList::setLayerDisplayName( int id, const QString &displayName )
+void LayerList::setLayerDisplayName( int id, const TQString &displayName )
{
setLayerDisplayName( layer( id ), displayName );
}
-void LayerList::setLayerProperty( LayerItem *layer, const QString &name, bool on ) //SLOT
+void LayerList::setLayerProperty( LayerItem *layer, const TQString &name, bool on ) //SLOT
{
if( !layer )
return;
@@ -554,12 +554,12 @@ void LayerList::setLayerProperty( LayerItem *layer, const QString &name, bool on
layer->setProperty( name, on );
}
-void LayerList::setLayerProperty( int id, const QString &name, bool on ) //SLOT
+void LayerList::setLayerProperty( int id, const TQString &name, bool on ) //SLOT
{
setLayerProperty( layer( id ), name, on );
}
-void LayerList::toggleLayerProperty( LayerItem *layer, const QString &name ) //SLOT
+void LayerList::toggleLayerProperty( LayerItem *layer, const TQString &name ) //SLOT
{
if( !layer )
return;
@@ -567,12 +567,12 @@ void LayerList::toggleLayerProperty( LayerItem *layer, const QString &name ) //S
layer->toggleProperty( name );
}
-void LayerList::toggleLayerProperty( int id, const QString &name ) //SLOT
+void LayerList::toggleLayerProperty( int id, const TQString &name ) //SLOT
{
toggleLayerProperty( layer( id ), name );
}
-void LayerList::setLayerPreviewImage( LayerItem *layer, QImage *image )
+void LayerList::setLayerPreviewImage( LayerItem *layer, TQImage *image )
{
if( !layer )
return;
@@ -580,7 +580,7 @@ void LayerList::setLayerPreviewImage( LayerItem *layer, QImage *image )
layer->setPreviewImage( image );
}
-void LayerList::setLayerPreviewImage( int id, QImage *image )
+void LayerList::setLayerPreviewImage( int id, TQImage *image )
{
setLayerPreviewImage( layer( id ), image );
}
@@ -598,54 +598,54 @@ void LayerList::layerPreviewChanged( int id )
layerPreviewChanged( layer( id ) );
}
-LayerItem *LayerList::addLayer( const QString &displayName, LayerItem *after, int id ) //SLOT
+LayerItem *LayerList::addLayer( const TQString &displayName, LayerItem *after, int id ) //SLOT
{
return new LayerItem( displayName, this, after, id );
}
-LayerItem *LayerList::addLayer( const QString &displayName, int afterID, int id ) //SLOT
+LayerItem *LayerList::addLayer( const TQString &displayName, int afterID, int id ) //SLOT
{
return new LayerItem( displayName, this, layer( afterID ), id );
}
//SLOT
-LayerItem *LayerList::addLayerToParent( const QString &displayName, LayerItem *parent, LayerItem *after, int id )
+LayerItem *LayerList::addLayerToParent( const TQString &displayName, LayerItem *tqparent, LayerItem *after, int id )
{
- if( parent && parent->isFolder() )
- return parent->addLayer( displayName, after, id );
+ if( tqparent && tqparent->isFolder() )
+ return tqparent->addLayer( displayName, after, id );
else
return 0;
}
-LayerItem *LayerList::addLayerToParent( const QString &displayName, int parentID, int afterID, int id ) //SLOT
+LayerItem *LayerList::addLayerToParent( const TQString &displayName, int tqparentID, int afterID, int id ) //SLOT
{
- return addLayerToParent( displayName, folder( parentID ), layer( afterID ), id );
+ return addLayerToParent( displayName, folder( tqparentID ), layer( afterID ), id );
}
-void LayerList::moveLayer( LayerItem *layer, LayerItem *parent, LayerItem *after ) //SLOT
+void LayerList::moveLayer( LayerItem *layer, LayerItem *tqparent, LayerItem *after ) //SLOT
{
if( !layer )
return;
- if( parent && !parent->isFolder() )
- parent = 0;
+ if( tqparent && !tqparent->isFolder() )
+ tqparent = 0;
- if( layer->parent() == parent && layer->prevSibling() == after )
+ if( layer->tqparent() == tqparent && layer->prevSibling() == after )
return;
- QListViewItem *current = currentItem();
+ TQListViewItem *current = currentItem();
- moveItem( layer, parent, after );
+ moveItem( layer, tqparent, after );
- emit layerMoved( layer, parent, after );
- emit layerMoved( layer->id(), parent ? parent->id() : -1, after ? after->id() : -1 );
+ emit layerMoved( layer, tqparent, after );
+ emit layerMoved( layer->id(), tqparent ? tqparent->id() : -1, after ? after->id() : -1 );
- setCurrentItem( current ); //HACK, sometimes Qt changes this under us
+ setCurrentItem( current ); //HACK, sometimes TQt changes this under us
}
-void LayerList::moveLayer( int id, int parentID, int afterID ) //SLOT
+void LayerList::moveLayer( int id, int tqparentID, int afterID ) //SLOT
{
- moveLayer( layer( id ), folder( parentID ), layer( afterID ) );
+ moveLayer( layer( id ), folder( tqparentID ), layer( afterID ) );
}
void LayerList::removeLayer( LayerItem *layer ) //SLOT
@@ -658,13 +658,13 @@ void LayerList::removeLayer( int id ) //SLOT
delete layer( id );
}
-void LayerList::contentsMousePressEvent( QMouseEvent *e )
+void LayerList::contentsMousePressEvent( TQMouseEvent *e )
{
LayerItem *item = static_cast<LayerItem*>( itemAt( contentsToViewport( e->pos() ) ) );
if( item )
{
- QMouseEvent m( QEvent::MouseButtonPress, item->mapFromListView( e->pos() ), e->button(), e->state() );
+ TQMouseEvent m( TQEvent::MouseButtonPress, item->mapFromListView( e->pos() ), e->button(), e->state() );
if( !item->mousePressEvent( &m ) )
super::contentsMousePressEvent( e );
}
@@ -676,12 +676,12 @@ void LayerList::contentsMousePressEvent( QMouseEvent *e )
}
}
-void LayerList::contentsMouseDoubleClickEvent( QMouseEvent *e )
+void LayerList::contentsMouseDoubleClickEvent( TQMouseEvent *e )
{
super::contentsMouseDoubleClickEvent( e );
if( LayerItem *layer = static_cast<LayerItem*>( itemAt( contentsToViewport( e->pos() ) ) ) )
{
- if( !layer->iconsRect().contains( layer->mapFromListView( e->pos() ) ) )
+ if( !layer->iconsRect().tqcontains( layer->mapFromListView( e->pos() ) ) )
{
emit requestLayerProperties( layer );
emit requestLayerProperties( layer->id() );
@@ -694,26 +694,26 @@ void LayerList::contentsMouseDoubleClickEvent( QMouseEvent *e )
}
}
-void LayerList::findDrop( const QPoint &pos, QListViewItem *&parent, QListViewItem *&after )
+void LayerList::findDrop( const TQPoint &pos, TQListViewItem *&tqparent, TQListViewItem *&after )
{
LayerItem *item = static_cast<LayerItem*>( itemAt( contentsToViewport( pos ) ) );
if( item && item->isFolder() )
{
- parent = item;
+ tqparent = item;
after = 0;
}
else
- super::findDrop( pos, parent, after );
+ super::findDrop( pos, tqparent, after );
}
void LayerList::showContextMenu()
{
- LayerItem *layer = static_cast<LayerItem*>( itemAt( viewport()->mapFromGlobal( QCursor::pos() ) ) );
+ LayerItem *layer = static_cast<LayerItem*>( itemAt( viewport()->mapFromGlobal( TQCursor::pos() ) ) );
if( layer )
setCurrentItem( layer );
d->contextMenu.clear();
constructMenu( layer );
- menuActivated( d->contextMenu.exec( QCursor::pos() ), layer );
+ menuActivated( d->contextMenu.exec( TQCursor::pos() ), layer );
}
void LayerList::hideTip()
@@ -723,7 +723,7 @@ void LayerList::hideTip()
void LayerList::maybeTip()
{
- d->tooltip->maybeTip( d->tooltip->QToolTip::parentWidget()->mapFromGlobal( QCursor::pos() ) );
+ d->tooltip->maybeTip( d->tooltip->TQToolTip::tqparentWidget()->mapFromGlobal( TQCursor::pos() ) );
}
void LayerList::constructMenu( LayerItem *layer )
@@ -746,28 +746,28 @@ void LayerList::constructMenu( LayerItem *layer )
void LayerList::menuActivated( int id, LayerItem *layer )
{
- const QValueList<LayerItem*> selected = selectedLayers();
+ const TQValueList<LayerItem*> selected = selectedLayers();
- LayerItem *parent = ( layer && layer->isFolder() ) ? layer : 0;
+ LayerItem *tqparent = ( layer && layer->isFolder() ) ? layer : 0;
LayerItem *after = 0;
- if( layer && !parent )
+ if( layer && !tqparent )
{
- parent = layer->parent();
+ tqparent = layer->tqparent();
after = layer->prevSibling();
}
switch( id )
{
case MenuItems::NewLayer:
- emit requestNewLayer( parent, after );
- emit requestNewLayer( parent ? parent->id() : -1, after ? after->id() : -1 );
+ emit requestNewLayer( tqparent, after );
+ emit requestNewLayer( tqparent ? tqparent->id() : -1, after ? after->id() : -1 );
break;
case MenuItems::NewFolder:
- emit requestNewFolder( parent, after );
- emit requestNewFolder( parent ? parent->id() : -1, after ? after->id() : -1 );
+ emit requestNewFolder( tqparent, after );
+ emit requestNewFolder( tqparent ? tqparent->id() : -1, after ? after->id() : -1 );
break;
case MenuItems::RemoveLayer:
{
- QValueList<int> ids;
+ TQValueList<int> ids;
for( int i = 0, n = selected.count(); i < n; ++i )
{
ids.append( selected[i]->id() );
@@ -793,7 +793,7 @@ void LayerList::menuActivated( int id, LayerItem *layer )
}
}
-void LayerList::slotItemRenamed( QListViewItem *item, const QString &text, int col )
+void LayerList::slotItemRenamed( TQListViewItem *item, const TQString &text, int col )
{
if( !item || col != 0 )
return;
@@ -802,7 +802,7 @@ void LayerList::slotItemRenamed( QListViewItem *item, const QString &text, int c
emit displayNameChanged( static_cast<LayerItem*>( item )->id(), text );
}
-void LayerList::slotItemMoved( QPtrList<QListViewItem> &items, QPtrList<QListViewItem> &/*afterBefore*/, QPtrList<QListViewItem> &afterNow )
+void LayerList::slotItemMoved( TQPtrList<TQListViewItem> &items, TQPtrList<TQListViewItem> &/*afterBefore*/, TQPtrList<TQListViewItem> &afterNow )
{
for( int i = 0, n = items.count(); i < n; ++i )
{
@@ -810,15 +810,15 @@ void LayerList::slotItemMoved( QPtrList<QListViewItem> &items, QPtrList<QListVie
if( !l )
continue;
- if( l->parent() )
- l->parent()->setOpen( true );
+ if( l->tqparent() )
+ l->tqparent()->setOpen( true );
- emit layerMoved( l, l->parent(), a );
- emit layerMoved( l->id(), l->parent() ? l->parent()->id() : -1, a ? a->id() : -1 );
+ emit layerMoved( l, l->tqparent(), a );
+ emit layerMoved( l->id(), l->tqparent() ? l->tqparent()->id() : -1, a ? a->id() : -1 );
}
}
-void LayerList::setCurrentItem( QListViewItem *item )
+void LayerList::setCurrentItem( TQListViewItem *item )
{
if( !item )
return;
@@ -839,14 +839,14 @@ void LayerList::setCurrentItem( QListViewItem *item )
// LayerItem //
///////////////
-LayerItem::LayerItem( const QString &displayName, LayerList *p, LayerItem *after, int id )
+LayerItem::LayerItem( const TQString &displayName, LayerList *p, LayerItem *after, int id )
: super( p, after ), d( new Private( id ) )
{
init();
setDisplayName( displayName );
}
-LayerItem::LayerItem( const QString &displayName, LayerItem *p, LayerItem *after, int id )
+LayerItem::LayerItem( const TQString &displayName, LayerItem *p, LayerItem *after, int id )
: super( ( p && p->isFolder() ) ? p : 0, after ), d( new Private( id ) )
{
init();
@@ -861,13 +861,13 @@ void LayerItem::init()
for( int i = 0, n = listView()->d->properties.count(); i < n; ++i )
d->properties.append( listView()->d->properties[i].defaultValue );
- if( parent())
- parent()->setOpen( true );
+ if( tqparent())
+ tqparent()->setOpen( true );
}
LayerItem::~LayerItem()
{
- if (listView() && (listView()->activeLayer() == this || contains(listView()->activeLayer())))
+ if (listView() && (listView()->activeLayer() == this || tqcontains(listView()->activeLayer())))
listView()->setActiveLayer( static_cast<LayerItem*>( 0 ) );
delete d;
}
@@ -885,9 +885,9 @@ bool LayerItem::isFolder() const
return d->isFolder;
}
-bool LayerItem::contains(const LayerItem *item)
+bool LayerItem::tqcontains(const LayerItem *item)
{
- QListViewItemIterator it(this);
+ TQListViewItemIterator it(this);
while (it.current()) {
if (static_cast<const LayerItem *>(it.current()) == item) {
@@ -903,12 +903,12 @@ int LayerItem::id() const
return d->id;
}
-QString LayerItem::displayName() const
+TQString LayerItem::displayName() const
{
return text( 0 );
}
-void LayerItem::setDisplayName( const QString &s )
+void LayerItem::setDisplayName( const TQString &s )
{
if( displayName() == s )
return;
@@ -927,7 +927,7 @@ void LayerItem::setActive()
listView()->setActiveLayer( this );
}
-bool LayerItem::property( const QString &name ) const
+bool LayerItem::property( const TQString &name ) const
{
int i = listView()->d->properties.count() - 1;
while( i && listView()->d->properties[i].name != name )
@@ -939,7 +939,7 @@ bool LayerItem::property( const QString &name ) const
return d->properties[i];
}
-void LayerItem::setProperty( const QString &name, bool on )
+void LayerItem::setProperty( const TQString &name, bool on )
{
int i = listView()->d->properties.count() - 1;
while( i && listView()->d->properties[i].name != name )
@@ -959,7 +959,7 @@ void LayerItem::setProperty( const QString &name, bool on )
update();
}
-void LayerItem::toggleProperty( const QString &name )
+void LayerItem::toggleProperty( const TQString &name )
{
int i = listView()->d->properties.count() - 1;
while( i && listView()->d->properties[i].name != name )
@@ -975,7 +975,7 @@ void LayerItem::toggleProperty( const QString &name )
update();
}
-void LayerItem::setPreviewImage( QImage *image )
+void LayerItem::setPreviewImage( TQImage *image )
{
d->previewImage = image;
previewChanged();
@@ -987,7 +987,7 @@ void LayerItem::previewChanged()
update();
}
-LayerItem *LayerItem::addLayer( const QString &displayName, LayerItem *after, int id )
+LayerItem *LayerItem::addLayer( const TQString &displayName, LayerItem *after, int id )
{
if( !isFolder() )
return 0;
@@ -996,7 +996,7 @@ LayerItem *LayerItem::addLayer( const QString &displayName, LayerItem *after, in
LayerItem *LayerItem::prevSibling() const
{
- LayerItem *item = parent() ? parent()->firstChild() : listView()->firstChild();
+ LayerItem *item = tqparent() ? tqparent()->firstChild() : listView()->firstChild();
if( !item || this == item )
return 0;
for(; item && this != item->nextSibling(); item = item->nextSibling() );
@@ -1013,14 +1013,14 @@ int LayerItem::mapYFromListView( int y ) const
return y - rect().top();
}
-QPoint LayerItem::mapFromListView( const QPoint &point ) const
+TQPoint LayerItem::mapFromListView( const TQPoint &point ) const
{
- return QPoint( mapXFromListView( point.x() ), mapYFromListView( point.y() ) );
+ return TQPoint( mapXFromListView( point.x() ), mapYFromListView( point.y() ) );
}
-QRect LayerItem::mapFromListView( const QRect &rect ) const
+TQRect LayerItem::mapFromListView( const TQRect &rect ) const
{
- return QRect( mapFromListView( rect.topLeft() ), rect.size() );
+ return TQRect( mapFromListView( rect.topLeft() ), rect.size() );
}
int LayerItem::mapXToListView( int x ) const
@@ -1033,26 +1033,26 @@ int LayerItem::mapYToListView( int y ) const
return y + rect().top();
}
-QPoint LayerItem::mapToListView( const QPoint &point ) const
+TQPoint LayerItem::mapToListView( const TQPoint &point ) const
{
- return QPoint( mapXToListView( point.x() ), mapYToListView( point.y() ) );
+ return TQPoint( mapXToListView( point.x() ), mapYToListView( point.y() ) );
}
-QRect LayerItem::mapToListView( const QRect &rect ) const
+TQRect LayerItem::mapToListView( const TQRect &rect ) const
{
- return QRect( mapToListView( rect.topLeft() ), rect.size() );
+ return TQRect( mapToListView( rect.topLeft() ), rect.size() );
}
-QRect LayerItem::rect() const
+TQRect LayerItem::rect() const
{
const int indent = listView()->treeStepSize() * ( depth() + 1 );
- return QRect( listView()->header()->sectionPos( 0 ) + indent, itemPos(),
+ return TQRect( listView()->header()->sectionPos( 0 ) + indent, itemPos(),
listView()->header()->sectionSize( 0 ) - indent, height() );
}
-QRect LayerItem::textRect() const
+TQRect LayerItem::textRect() const
{
- static QFont f;
+ static TQFont f;
static int minbearing = 1337 + 666; //can be 0 or negative, 2003 is less likely
if( minbearing == 2003 || f != font() )
{
@@ -1067,12 +1067,12 @@ QRect LayerItem::textRect() const
const int width = ( multiline() ? rect().right() : iconsRect().left() ) - indent - margin + minbearing;
- return QRect( indent, 0, width, fontMetrics().height() );
+ return TQRect( indent, 0, width, fontMetrics().height() );
}
-QRect LayerItem::iconsRect() const
+TQRect LayerItem::iconsRect() const
{
- const QValueList<LayerProperty> &lp = listView()->d->properties;
+ const TQValueList<LayerProperty> &lp = listView()->d->properties;
int propscount = 0;
for( int i = 0, n = lp.count(); i < n; ++i )
if( !lp[i].enabledIcon.isNull() && ( !multiline() || !isFolder() || lp[i].validForFolders ) )
@@ -1083,32 +1083,32 @@ QRect LayerItem::iconsRect() const
const int x = multiline() ? previewRect().right() + listView()->itemMargin() : rect().width() - iconswidth;
const int y = multiline() ? fontMetrics().height() : 0;
- return QRect( x, y, iconswidth, iconSize().height() );
+ return TQRect( x, y, iconswidth, iconSize().height() );
}
-QRect LayerItem::previewRect() const
+TQRect LayerItem::previewRect() const
{
- return QRect( 0, 0, listView()->previewsShown() ? height() : 0, height() );
+ return TQRect( 0, 0, listView()->previewsShown() ? height() : 0, height() );
}
-void LayerItem::drawText( QPainter *p, const QColorGroup &cg, const QRect &r )
+void LayerItem::drawText( TQPainter *p, const TQColorGroup &cg, const TQRect &r )
{
p->translate( r.left(), r.top() );
p->setPen( isSelected() ? cg.highlightedText() : cg.text() );
- const QString text = KStringHandler::rPixelSqueeze( displayName(), p->fontMetrics(), r.width() );
- p->drawText( listView()->itemMargin(), 0, r.width(), r.height(), Qt::AlignAuto | Qt::AlignTop, text );
+ const TQString text = KStringHandler::rPixelSqueeze( displayName(), p->fontMetrics(), r.width() );
+ p->drawText( listView()->itemMargin(), 0, r.width(), r.height(), TQt::AlignAuto | TQt::AlignTop, text );
p->translate( -r.left(), -r.top() );
}
-void LayerItem::drawIcons( QPainter *p, const QColorGroup &/*cg*/, const QRect &r )
+void LayerItem::drawIcons( TQPainter *p, const TQColorGroup &/*cg*/, const TQRect &r )
{
p->translate( r.left(), r.top() );
int x = 0;
- const QValueList<LayerProperty> &lp = listView()->d->properties;
+ const TQValueList<LayerProperty> &lp = listView()->d->properties;
for( int i = 0, n = lp.count(); i < n; ++i )
if( !lp[i].enabledIcon.isNull() && ( !multiline() || !isFolder() || lp[i].validForFolders ) )
{
@@ -1120,7 +1120,7 @@ void LayerItem::drawIcons( QPainter *p, const QColorGroup &/*cg*/, const QRect &
p->translate( -r.left(), -r.top() );
}
-void LayerItem::drawPreview( QPainter *p, const QColorGroup &/*cg*/, const QRect &r )
+void LayerItem::drawPreview( TQPainter *p, const TQColorGroup &/*cg*/, const TQRect &r )
{
if( !showPreview() )
return;
@@ -1128,7 +1128,7 @@ void LayerItem::drawPreview( QPainter *p, const QColorGroup &/*cg*/, const QRect
if( d->previewChanged || r.size() != d->previewSize )
{ //TODO handle width() != height()
const int size = kMin( r.width(), kMax( previewImage()->width(), previewImage()->height() ) );
- const QImage i = previewImage()->smoothScale( size, size, QImage::ScaleMin );
+ const TQImage i = previewImage()->smoothScale( size, size, TQ_ScaleMin );
d->scaledPreview.convertFromImage( i );
d->previewOffset.setX( r.width()/2 - i.width()/2 );
d->previewOffset.setY( r.height()/2 - i.height()/2 );
@@ -1150,11 +1150,11 @@ bool LayerItem::multiline() const
return height() >= fontMetrics().height() + iconSize().height();
}
-QFont LayerItem::font() const
+TQFont LayerItem::font() const
{
if( isActive() )
{
- QFont f = listView()->font();
+ TQFont f = listView()->font();
f.setBold( !f.bold() );
f.setItalic( !f.italic() );
return f;
@@ -1163,30 +1163,30 @@ QFont LayerItem::font() const
return listView()->font();
}
-QFontMetrics LayerItem::fontMetrics() const
+TQFontMetrics LayerItem::fontMetrics() const
{
- return QFontMetrics( font() );
+ return TQFontMetrics( font() );
}
-bool LayerItem::mousePressEvent( QMouseEvent *e )
+bool LayerItem::mousePressEvent( TQMouseEvent *e )
{
if( e->button() == Qt::RightButton )
{
- if ( !(e->state() & Qt::ControlButton) && !(e->state() & Qt::ShiftButton) )
+ if ( !(e->state() & TQt::ControlButton) && !(e->state() & TQt::ShiftButton) )
setActive();
- QTimer::singleShot( 0, listView(), SLOT( showContextMenu() ) );
+ TQTimer::singleShot( 0, listView(), TQT_SLOT( showContextMenu() ) );
return false;
}
- const QRect ir = iconsRect(), tr = textRect();
+ const TQRect ir = iconsRect(), tr = textRect();
- if( ir.contains( e->pos() ) )
+ if( ir.tqcontains( e->pos() ) )
{
const int iconWidth = iconSize().width();
int x = e->pos().x() - ir.left();
if( x % ( iconWidth + listView()->itemMargin() ) < iconWidth ) //it's on an icon, not a margin
{
- const QValueList<LayerProperty> &lp = listView()->d->properties;
+ const TQValueList<LayerProperty> &lp = listView()->d->properties;
int p = -1;
for( int i = 0, n = lp.count(); i < n; ++i )
{
@@ -1201,56 +1201,56 @@ bool LayerItem::mousePressEvent( QMouseEvent *e )
return true;
}
- else if( tr.contains( e->pos() ) && isSelected() && !listView()->renameLineEdit()->isVisible() )
+ else if( tr.tqcontains( e->pos() ) && isSelected() && !listView()->renameLineEdit()->isVisible() )
{
listView()->rename( this, 0 );
- QRect r( listView()->contentsToViewport( mapToListView( tr.topLeft() ) ), tr.size() );
+ TQRect r( listView()->contentsToViewport( mapToListView( tr.topLeft() ) ), tr.size() );
listView()->renameLineEdit()->setGeometry( r );
return true;
}
- if ( !(e->state() & Qt::ControlButton) && !(e->state() & Qt::ShiftButton) )
+ if ( !(e->state() & TQt::ControlButton) && !(e->state() & TQt::ShiftButton) )
setActive();
return false;
}
-QString LayerItem::tooltip() const
+TQString LayerItem::tooltip() const
{
- QString tip;
+ TQString tip;
tip += "<table cellspacing=\"0\" cellpadding=\"0\">";
- tip += QString("<tr><td colspan=\"2\" align=\"center\"><b>%1</b></td></tr>").arg( displayName() );
- QString row = "<tr><td>%1</td><td>%2</td></tr>";
+ tip += TQString("<tr><td colspan=\"2\" align=\"center\"><b>%1</b></td></tr>").tqarg( displayName() );
+ TQString row = "<tr><td>%1</td><td>%2</td></tr>";
for( int i = 0, n = listView()->d->properties.count(); i < n; ++i )
if( !isFolder() || listView()->d->properties[i].validForFolders )
{
if( d->properties[i] )
- tip += row.arg( i18n( "%1:" ).arg( listView()->d->properties[i].displayName ) ).arg( i18n( "Yes" ) );
+ tip += row.tqarg( i18n( "%1:" ).tqarg( listView()->d->properties[i].displayName ) ).tqarg( i18n( "Yes" ) );
else
- tip += row.arg( i18n( "%1:" ).arg( listView()->d->properties[i].displayName ) ).arg( i18n( "No" ) );
+ tip += row.tqarg( i18n( "%1:" ).tqarg( listView()->d->properties[i].displayName ) ).tqarg( i18n( "No" ) );
}
tip += "</table>";
return tip;
}
-QImage *LayerItem::previewImage() const
+TQImage *LayerItem::previewImage() const
{
return d->previewImage;
}
-QImage LayerItem::tooltipPreview() const
+TQImage LayerItem::tooltipPreview() const
{
if( previewImage() )
return *previewImage();
- return QImage();
+ return TQImage();
}
-int LayerItem::width( const QFontMetrics &fm, const QListView *lv, int c ) const
+int LayerItem::width( const TQFontMetrics &fm, const TQListView *lv, int c ) const
{
if( c != 0 )
return super::width( fm, lv, c );
- const QValueList<LayerProperty> &lp = listView()->d->properties;
+ const TQValueList<LayerProperty> &lp = listView()->d->properties;
int propscount = 0;
for( int i = 0, n = d->properties.count(); i < n; ++i )
if( !lp[i].enabledIcon.isNull() && ( !multiline() || !isFolder() || lp[i].validForFolders ) )
@@ -1264,7 +1264,7 @@ int LayerItem::width( const QFontMetrics &fm, const QListView *lv, int c ) const
return super::width( fm, lv, 0 ) + iconswidth;
}
-void LayerItem::paintCell( QPainter *painter, const QColorGroup &cg, int column, int width, int align )
+void LayerItem::paintCell( TQPainter *painter, const TQColorGroup &cg, int column, int width, int align )
{
if( column != 0 )
{
@@ -1272,14 +1272,14 @@ void LayerItem::paintCell( QPainter *painter, const QColorGroup &cg, int column,
return;
}
- QPixmap buf( width, height() );
- QPainter p( &buf );
+ TQPixmap buf( width, height() );
+ TQPainter p( &buf );
p.setFont( font() );
- const QColorGroup cg_ = isEnabled() ? listView()->palette().active() : listView()->palette().disabled();
+ const TQColorGroup cg_ = isEnabled() ? listView()->palette().active() : listView()->palette().disabled();
- const QColor bg = isSelected() ? cg_.highlight()
+ const TQColor bg = isSelected() ? cg_.highlight()
: isAlternate() ? listView()->alternateBackground()
: listView()->viewport()->backgroundColor();
@@ -1316,10 +1316,10 @@ void LayerItem::setSelected( bool selected )
LayerItem *LayerList::firstChild() const { return static_cast<LayerItem*>( super::firstChild() ); }
LayerItem *LayerList::lastChild() const { return static_cast<LayerItem*>( super::lastChild() ); }
LayerList *LayerItem::listView() const { return static_cast<LayerList*>( super::listView() ); }
-void LayerItem::update() const { listView()->repaintItem( this ); }
+void LayerItem::update() const { listView()->tqrepaintItem( this ); }
LayerItem *LayerItem::firstChild() const { return static_cast<LayerItem*>( super::firstChild() ); }
LayerItem *LayerItem::nextSibling() const { return static_cast<LayerItem*>( super::nextSibling() ); }
-LayerItem *LayerItem::parent() const { return static_cast<LayerItem*>( super::parent() ); }
+LayerItem *LayerItem::tqparent() const { return static_cast<LayerItem*>( super::tqparent() ); }
#include "layerlist.moc"