diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
commit | d6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch) | |
tree | d109539636691d7b03036ca1c0ed29dbae6577cf /kdevdesigner/designer/listviewdnd.cpp | |
parent | 3331a47a9cad24795c7440ee8107143ce444ef34 (diff) | |
download | tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.tar.gz tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdevdesigner/designer/listviewdnd.cpp')
-rw-r--r-- | kdevdesigner/designer/listviewdnd.cpp | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/kdevdesigner/designer/listviewdnd.cpp b/kdevdesigner/designer/listviewdnd.cpp index b4098237..a4abae07 100644 --- a/kdevdesigner/designer/listviewdnd.cpp +++ b/kdevdesigner/designer/listviewdnd.cpp @@ -25,33 +25,33 @@ **********************************************************************/ #include "listviewdnd.h" -#include <qwidget.h> -#include <qheader.h> -#include <qpainter.h> -#include <qdragobject.h> -#include <qvaluelist.h> +#include <tqwidget.h> +#include <tqheader.h> +#include <tqpainter.h> +#include <tqdragobject.h> +#include <tqvaluelist.h> // The Dragobject Declaration --------------------------------------- class ListViewItemDrag : public QStoredDrag { public: enum DropRelation { Sibling, Child }; - ListViewItemDrag( ListViewItemList & items, QWidget * parent = 0, const char * name = 0 ); + ListViewItemDrag( ListViewItemList & items, TQWidget * parent = 0, const char * name = 0 ); ~ListViewItemDrag() {}; - static bool canDecode( QDragMoveEvent * event ); - static bool decode( QDropEvent * event, QListView * parent, QListViewItem * insertPoint, DropRelation dr ); + static bool canDecode( TQDragMoveEvent * event ); + static bool decode( TQDropEvent * event, TQListView * parent, TQListViewItem * insertPoint, DropRelation dr ); }; // ------------------------------------------------------------------ -ListViewDnd::ListViewDnd( QListView * eventSource, const char * name ) +ListViewDnd::ListViewDnd( TQListView * eventSource, const char * name ) : ListDnd( eventSource, name ) { } -void ListViewDnd::confirmDrop( QListViewItem * ) +void ListViewDnd::confirmDrop( TQListViewItem * ) { dropConfirmed = TRUE; } -bool ListViewDnd::dropEvent( QDropEvent * event ) +bool ListViewDnd::dropEvent( TQDropEvent * event ) { if ( dragInside ) { @@ -61,10 +61,10 @@ bool ListViewDnd::dropEvent( QDropEvent * event ) return TRUE; } - QPoint pos = event->pos(); + TQPoint pos = event->pos(); ListViewItemDrag::DropRelation dr = ListViewItemDrag::Sibling; - QListViewItem *item = itemAt( pos ); + TQListViewItem *item = itemAt( pos ); int dpos = dropDepth( item, pos ); if ( item ) { @@ -78,7 +78,7 @@ bool ListViewDnd::dropEvent( QDropEvent * event ) } } - if ( ListViewItemDrag::decode( event, (QListView *) src, item, dr ) ) { + if ( ListViewItemDrag::decode( event, (TQListView *) src, item, dr ) ) { event->accept(); emit dropped( 0 ); // Use ID instead of item? } @@ -90,7 +90,7 @@ bool ListViewDnd::dropEvent( QDropEvent * event ) return TRUE; } -bool ListViewDnd::mouseMoveEvent( QMouseEvent * event ) +bool ListViewDnd::mouseMoveEvent( TQMouseEvent * event ) { if ( event->state() & LeftButton ) { if ( ( event->pos() - mousePressPos ).manhattanLength() > 3 ) { @@ -101,7 +101,7 @@ bool ListViewDnd::mouseMoveEvent( QMouseEvent * event ) else buildTreeList( list ); - ListViewItemDrag * dragobject = new ListViewItemDrag( list, (QListView *) src ); + ListViewItemDrag * dragobject = new ListViewItemDrag( list, (TQListView *) src ); if ( dMode & Move ) { disabledItems = list; @@ -132,9 +132,9 @@ bool ListViewDnd::mouseMoveEvent( QMouseEvent * event ) int ListViewDnd::buildFlatList( ListViewItemList & list ) { bool addKids = FALSE; - QListViewItem *nextSibling = 0; - QListViewItem *nextParent = 0; - QListViewItemIterator it = ((QListView *)src)->firstChild(); + TQListViewItem *nextSibling = 0; + TQListViewItem *nextParent = 0; + TQListViewItemIterator it = ((TQListView *)src)->firstChild(); for ( ; *it; it++ ) { // Hit the nextSibling, turn of child processing if ( (*it) == nextSibling ) @@ -166,7 +166,7 @@ int ListViewDnd::buildFlatList( ListViewItemList & list ) int ListViewDnd::buildTreeList( ListViewItemList & list ) { - QListViewItemIterator it = ((QListView *)src)->firstChild(); + TQListViewItemIterator it = ((TQListView *)src)->firstChild(); for ( ; *it; it++ ) { if ( (*it)->isSelected() ) list.append( *it ); @@ -185,10 +185,10 @@ void ListViewDnd::setVisibleItems( bool b ) } while ( disabledItems.next() ); } -void ListViewDnd::updateLine( const QPoint & dragPos ) +void ListViewDnd::updateLine( const TQPoint & dragPos ) { - QListViewItem * item = itemAt(dragPos); - QListView * src = (QListView *) this->src; + TQListViewItem * item = itemAt(dragPos); + TQListView * src = (TQListView *) this->src; int ypos = item ? ( src->itemRect( item ).bottom() - ( line->height() / 2 ) ) : @@ -199,12 +199,12 @@ void ListViewDnd::updateLine( const QPoint & dragPos ) line->move( xpos, ypos ); } -QListViewItem * ListViewDnd::itemAt( QPoint pos ) +TQListViewItem * ListViewDnd::itemAt( TQPoint pos ) { - QListView * src = (QListView *) this->src; + TQListView * src = (TQListView *) this->src; int headerHeight = (int)(src->header()->height()); pos.ry() -= headerHeight; - QListViewItem * result = src->itemAt( pos ); + TQListViewItem * result = src->itemAt( pos ); if ( result && ( pos.ry() < (src->itemPos(result) + result->height()/2) ) ) result = result->itemAbove(); @@ -227,14 +227,14 @@ QListViewItem * ListViewDnd::itemAt( QPoint pos ) return result; } -int ListViewDnd::dropDepth( QListViewItem * item, QPoint pos ) +int ListViewDnd::dropDepth( TQListViewItem * item, TQPoint pos ) { if ( !item || (dMode & Flat) ) return 0; int result = 0; int itemDepth = item->depth(); - int indentSize = ((QListView *)src)->treeStepSize(); + int indentSize = ((TQListView *)src)->treeStepSize(); int itemLeft = indentSize * itemDepth; int childMargin = indentSize*2; if ( pos.x() > itemLeft + childMargin ) { @@ -247,7 +247,7 @@ int ListViewDnd::dropDepth( QListViewItem * item, QPoint pos ) return result; } -bool ListViewDnd::canDecode( QDragEnterEvent * event ) +bool ListViewDnd::canDecode( TQDragEnterEvent * event ) { return ListViewItemDrag::canDecode( event ); } @@ -256,19 +256,19 @@ bool ListViewDnd::canDecode( QDragEnterEvent * event ) // The Dragobject Implementation ------------------------------------ // ------------------------------------------------------------------ -QDataStream & operator<< ( QDataStream & stream, const QListViewItem & item ); -QDataStream & operator>> ( QDataStream & stream, QListViewItem & item ); +TQDataStream & operator<< ( TQDataStream & stream, const TQListViewItem & item ); +TQDataStream & operator>> ( TQDataStream & stream, TQListViewItem & item ); -ListViewItemDrag::ListViewItemDrag( ListViewItemList & items, QWidget * parent, const char * name ) - : QStoredDrag( "qt/listviewitem", parent, name ) +ListViewItemDrag::ListViewItemDrag( ListViewItemList & items, TQWidget * parent, const char * name ) + : TQStoredDrag( "qt/listviewitem", parent, name ) { // ### FIX! - QByteArray data( sizeof( Q_INT32 ) + sizeof( QListViewItem ) * items.count() ); - QDataStream stream( data, IO_WriteOnly ); + TQByteArray data( sizeof( Q_INT32 ) + sizeof( TQListViewItem ) * items.count() ); + TQDataStream stream( data, IO_WriteOnly ); stream << items.count(); - QListViewItem *i = items.first(); + TQListViewItem *i = items.first(); while ( i ) { stream << *i; i = items.next(); @@ -277,15 +277,15 @@ ListViewItemDrag::ListViewItemDrag( ListViewItemList & items, QWidget * parent, setEncodedData( data ); } -bool ListViewItemDrag::canDecode( QDragMoveEvent * event ) +bool ListViewItemDrag::canDecode( TQDragMoveEvent * event ) { return event->provides( "qt/listviewitem" ); } -bool ListViewItemDrag::decode( QDropEvent * event, QListView * parent, QListViewItem * insertPoint, DropRelation dr ) +bool ListViewItemDrag::decode( TQDropEvent * event, TQListView * parent, TQListViewItem * insertPoint, DropRelation dr ) { - QByteArray data = event->encodedData( "qt/listviewitem" ); - QListViewItem* itemParent = insertPoint ? insertPoint->parent() : 0; + TQByteArray data = event->encodedData( "qt/listviewitem" ); + TQListViewItem* itemParent = insertPoint ? insertPoint->parent() : 0; // Change from sibling (default) to child creation if ( insertPoint && dr == Child ) { @@ -295,17 +295,17 @@ bool ListViewItemDrag::decode( QDropEvent * event, QListView * parent, QListView if ( data.size() ) { event->accept(); - QDataStream stream( data, IO_ReadOnly ); + TQDataStream stream( data, IO_ReadOnly ); int count = 0; stream >> count; for( int i = 0; i < count; i++ ) { if ( itemParent ) { - insertPoint = new QListViewItem( itemParent, insertPoint ); + insertPoint = new TQListViewItem( itemParent, insertPoint ); itemParent->setOpen( TRUE ); } else { // No parent for insertPoint, use QListView - insertPoint = new QListViewItem( parent, insertPoint ); + insertPoint = new TQListViewItem( parent, insertPoint ); } stream >> *insertPoint; } @@ -315,7 +315,7 @@ bool ListViewItemDrag::decode( QDropEvent * event, QListView * parent, QListView } -QDataStream & operator<< ( QDataStream & stream, const QListViewItem & item ) +TQDataStream & operator<< ( TQDataStream & stream, const TQListViewItem & item ) { int columns = item.listView()->columns(); stream << columns; @@ -324,7 +324,7 @@ QDataStream & operator<< ( QDataStream & stream, const QListViewItem & item ) int i; for ( i = 0; i < columns; i++ ) { - b = (Q_UINT8) ( item.text( i ) != QString::null ); // does column i have a string ? + b = (Q_UINT8) ( item.text( i ) != TQString::null ); // does column i have a string ? stream << b; if ( b ) { stream << item.text( i ); @@ -354,7 +354,7 @@ QDataStream & operator<< ( QDataStream & stream, const QListViewItem & item ) stream << item.childCount(); if ( item.childCount() > 0 ) { - QListViewItem * child = item.firstChild(); + TQListViewItem * child = item.firstChild(); while ( child ) { stream << ( *child ); // recursive call child = child->nextSibling(); @@ -364,14 +364,14 @@ QDataStream & operator<< ( QDataStream & stream, const QListViewItem & item ) return stream; } -QDataStream & operator>> ( QDataStream & stream, QListViewItem & item ) +TQDataStream & operator>> ( TQDataStream & stream, TQListViewItem & item ) { Q_INT32 columns; stream >> columns; Q_UINT8 b = 0; - QString text; + TQString text; int i; for ( i = 0; i < columns; i++ ) { stream >> b; @@ -381,7 +381,7 @@ QDataStream & operator>> ( QDataStream & stream, QListViewItem & item ) } } - QPixmap pixmap; + TQPixmap pixmap; for ( i = 0; i < columns; i++ ) { stream >> b; // column i has pixmap ? if ( b ) { @@ -419,10 +419,10 @@ QDataStream & operator>> ( QDataStream & stream, QListViewItem & item ) int childCount; stream >> childCount; - QListViewItem *child = 0; - QListViewItem *prevchild = 0; + TQListViewItem *child = 0; + TQListViewItem *prevchild = 0; for ( i = 0; i < childCount; i++ ) { - child = new QListViewItem( &item, prevchild ); + child = new TQListViewItem( &item, prevchild ); stream >> ( *child ); item.insertItem( child ); prevchild = child; |