diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-14 16:45:05 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-14 16:45:05 +0000 |
commit | 48d4a26399959121f33d2bc3bfe51c7827b654fc (patch) | |
tree | 5ae5e6e00d3ba330b7b8be9bc097154b6bc739e8 /kdevdesigner/designer/listviewdnd.cpp | |
parent | 7e701ace6592d09e1f2c0cf28c7d6d872d78f4f5 (diff) | |
download | tdevelop-48d4a26399959121f33d2bc3bfe51c7827b654fc.tar.gz tdevelop-48d4a26399959121f33d2bc3bfe51c7827b654fc.zip |
TQt4 port kdevelop
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1236710 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdevdesigner/designer/listviewdnd.cpp')
-rw-r--r-- | kdevdesigner/designer/listviewdnd.cpp | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/kdevdesigner/designer/listviewdnd.cpp b/kdevdesigner/designer/listviewdnd.cpp index a4abae07..b1d5323d 100644 --- a/kdevdesigner/designer/listviewdnd.cpp +++ b/kdevdesigner/designer/listviewdnd.cpp @@ -1,15 +1,15 @@ /********************************************************************** ** Copyright (C) 2002 Trolltech AS. All rights reserved. ** -** This file is part of Qt Designer. +** This file is part of TQt Designer. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** -** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition -** licenses may use this file in accordance with the Qt Commercial License +** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition +** licenses may use this file in accordance with the TQt Commercial License ** Agreement provided with the Software. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE @@ -17,7 +17,7 @@ ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for -** information about Qt Commercial License Agreements. +** information about TQt Commercial License Agreements. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. @@ -32,14 +32,14 @@ #include <tqvaluelist.h> // The Dragobject Declaration --------------------------------------- -class ListViewItemDrag : public QStoredDrag +class ListViewItemDrag : public TQStoredDrag { public: enum DropRelation { Sibling, Child }; - ListViewItemDrag( ListViewItemList & items, TQWidget * parent = 0, const char * name = 0 ); + ListViewItemDrag( ListViewItemList & items, TQWidget * tqparent = 0, const char * name = 0 ); ~ListViewItemDrag() {}; static bool canDecode( TQDragMoveEvent * event ); - static bool decode( TQDropEvent * event, TQListView * parent, TQListViewItem * insertPoint, DropRelation dr ); + static bool decode( TQDropEvent * event, TQListView * tqparent, TQListViewItem * insertPoint, DropRelation dr ); }; // ------------------------------------------------------------------ @@ -74,7 +74,7 @@ bool ListViewDnd::dropEvent( TQDropEvent * event ) } else if ( dpos < item->depth() ) { // Parent(s) Sibling while ( item && (item->depth() > dpos) ) - item = item->parent(); + item = item->tqparent(); } } @@ -92,7 +92,7 @@ bool ListViewDnd::dropEvent( TQDropEvent * event ) bool ListViewDnd::mouseMoveEvent( TQMouseEvent * event ) { - if ( event->state() & LeftButton ) { + if ( event->state() & Qt::LeftButton ) { if ( ( event->pos() - mousePressPos ).manhattanLength() > 3 ) { ListViewItemList list; @@ -142,22 +142,22 @@ int ListViewDnd::buildFlatList( ListViewItemList & list ) if ( (*it)->isSelected() ) { if ( (*it)->childCount() == 0 ) { - // Selected, no children + // Selected, no tqchildren list.append( *it ); } else if ( !addKids ) { // Children processing not set, so set it // Also find the item were we shall quit - // processing children...if any such item + // processing tqchildren...if any such item addKids = TRUE; nextSibling = (*it)->nextSibling(); - nextParent = (*it)->parent(); + nextParent = (*it)->tqparent(); while ( nextParent && !nextSibling ) { nextSibling = nextParent->nextSibling(); - nextParent = nextParent->parent(); + nextParent = nextParent->tqparent(); } } } else if ( ((*it)->childCount() == 0) && addKids ) { - // Leaf node, and we _do_ process children + // Leaf node, and we _do_ process tqchildren list.append( *it ); } } @@ -191,8 +191,8 @@ void ListViewDnd::updateLine( const TQPoint & dragPos ) TQListView * src = (TQListView *) this->src; int ypos = item ? - ( src->itemRect( item ).bottom() - ( line->height() / 2 ) ) : - ( src->itemRect( src->firstChild() ).top() ); + ( src->tqitemRect( item ).bottom() - ( line->height() / 2 ) ) : + ( src->tqitemRect( src->firstChild() ).top() ); int xpos = dropDepth( item, dragPos ) * src->treeStepSize(); line->resize( src->viewport()->width() - xpos, line->height() ); @@ -209,15 +209,15 @@ TQListViewItem * ListViewDnd::itemAt( TQPoint pos ) if ( result && ( pos.ry() < (src->itemPos(result) + result->height()/2) ) ) result = result->itemAbove(); - // Wind back if has parent, and we're in flat mode - while ( result && result->parent() && (dMode & Flat) ) - result = result->parent(); + // Wind back if has tqparent, and we're in flat mode + while ( result && result->tqparent() && (dMode & Flat) ) + result = result->tqparent(); - // Wind back if has parent, and we're in flat mode - while ( result && !result->isVisible() && result->parent() ) - result = result->parent(); + // Wind back if has tqparent, and we're in flat mode + while ( result && !result->isVisible() && result->tqparent() ) + result = result->tqparent(); - if ( !result && src->firstChild() && (pos.y() > src->itemRect(src->firstChild()).bottom()) ) { + if ( !result && src->firstChild() && (pos.y() > src->tqitemRect(src->firstChild()).bottom()) ) { result = src->lastItem(); if ( !result->isVisible() ) // Handle special case where last item is actually hidden @@ -259,11 +259,11 @@ bool ListViewDnd::canDecode( TQDragEnterEvent * event ) TQDataStream & operator<< ( TQDataStream & stream, const TQListViewItem & item ); TQDataStream & operator>> ( TQDataStream & stream, TQListViewItem & item ); -ListViewItemDrag::ListViewItemDrag( ListViewItemList & items, TQWidget * parent, const char * name ) - : TQStoredDrag( "qt/listviewitem", parent, name ) +ListViewItemDrag::ListViewItemDrag( ListViewItemList & items, TQWidget * tqparent, const char * name ) + : TQStoredDrag( "qt/listviewitem", tqparent, name ) { // ### FIX! - TQByteArray data( sizeof( Q_INT32 ) + sizeof( TQListViewItem ) * items.count() ); + TQByteArray data( sizeof( TQ_INT32 ) + sizeof( TQListViewItem ) * items.count() ); TQDataStream stream( data, IO_WriteOnly ); stream << items.count(); @@ -282,10 +282,10 @@ bool ListViewItemDrag::canDecode( TQDragMoveEvent * event ) return event->provides( "qt/listviewitem" ); } -bool ListViewItemDrag::decode( TQDropEvent * event, TQListView * parent, TQListViewItem * insertPoint, DropRelation dr ) +bool ListViewItemDrag::decode( TQDropEvent * event, TQListView * tqparent, TQListViewItem * insertPoint, DropRelation dr ) { - TQByteArray data = event->encodedData( "qt/listviewitem" ); - TQListViewItem* itemParent = insertPoint ? insertPoint->parent() : 0; + TQByteArray data = event->tqencodedData( "qt/listviewitem" ); + TQListViewItem* itemParent = insertPoint ? insertPoint->tqparent() : 0; // Change from sibling (default) to child creation if ( insertPoint && dr == Child ) { @@ -304,8 +304,8 @@ bool ListViewItemDrag::decode( TQDropEvent * event, TQListView * parent, TQListV if ( itemParent ) { insertPoint = new TQListViewItem( itemParent, insertPoint ); itemParent->setOpen( TRUE ); - } else { // No parent for insertPoint, use QListView - insertPoint = new TQListViewItem( parent, insertPoint ); + } else { // No tqparent for insertPoint, use TQListView + insertPoint = new TQListViewItem( tqparent, insertPoint ); } stream >> *insertPoint; } @@ -320,11 +320,11 @@ TQDataStream & operator<< ( TQDataStream & stream, const TQListViewItem & item ) int columns = item.listView()->columns(); stream << columns; - Q_UINT8 b = 0; + TQ_UINT8 b = 0; int i; for ( i = 0; i < columns; i++ ) { - b = (Q_UINT8) ( item.text( i ) != TQString::null ); // does column i have a string ? + b = (TQ_UINT8) ( item.text( i ) != TQString() ); // does column i have a string ? stream << b; if ( b ) { stream << item.text( i ); @@ -332,25 +332,25 @@ TQDataStream & operator<< ( TQDataStream & stream, const TQListViewItem & item ) } for ( i = 0; i < columns; i++ ) { - b = (Q_UINT8) ( !!item.pixmap( i ) ); // does column i have a pixmap ? + b = (TQ_UINT8) ( !!item.pixmap( i ) ); // does column i have a pixmap ? stream << b; if ( b ) { stream << ( *item.pixmap( i ) ); } } - stream << (Q_UINT8) item.isOpen(); - stream << (Q_UINT8) item.isSelectable(); - stream << (Q_UINT8) item.isExpandable(); - stream << (Q_UINT8) item.dragEnabled(); - stream << (Q_UINT8) item.dropEnabled(); - stream << (Q_UINT8) item.isVisible(); + stream << (TQ_UINT8) item.isOpen(); + stream << (TQ_UINT8) item.isSelectable(); + stream << (TQ_UINT8) item.isExpandable(); + stream << (TQ_UINT8) item.dragEnabled(); + stream << (TQ_UINT8) item.dropEnabled(); + stream << (TQ_UINT8) item.isVisible(); for ( i = 0; i < columns; i++ ) { - stream << (Q_UINT8) item.renameEnabled( i ); + stream << (TQ_UINT8) item.renameEnabled( i ); } - stream << (Q_UINT8) item.multiLinesEnabled(); + stream << (TQ_UINT8) item.multiLinesEnabled(); stream << item.childCount(); if ( item.childCount() > 0 ) { @@ -366,10 +366,10 @@ TQDataStream & operator<< ( TQDataStream & stream, const TQListViewItem & item ) TQDataStream & operator>> ( TQDataStream & stream, TQListViewItem & item ) { - Q_INT32 columns; + TQ_INT32 columns; stream >> columns; - Q_UINT8 b = 0; + TQ_UINT8 b = 0; TQString text; int i; |