summaryrefslogtreecommitdiffstats
path: root/kdevdesigner/designer/listboxdnd.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:56:07 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:56:07 +0000
commitd6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch)
treed109539636691d7b03036ca1c0ed29dbae6577cf /kdevdesigner/designer/listboxdnd.cpp
parent3331a47a9cad24795c7440ee8107143ce444ef34 (diff)
downloadtdevelop-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/listboxdnd.cpp')
-rw-r--r--kdevdesigner/designer/listboxdnd.cpp100
1 files changed, 50 insertions, 50 deletions
diff --git a/kdevdesigner/designer/listboxdnd.cpp b/kdevdesigner/designer/listboxdnd.cpp
index a83ace44..8ed979f2 100644
--- a/kdevdesigner/designer/listboxdnd.cpp
+++ b/kdevdesigner/designer/listboxdnd.cpp
@@ -25,33 +25,33 @@
**********************************************************************/
#include "listboxdnd.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 ListBoxItemDrag : public QStoredDrag
{
public:
- ListBoxItemDrag( ListBoxItemList & items, bool sendPtr = FALSE, QListBox * parent = 0, const char * name = 0 );
+ ListBoxItemDrag( ListBoxItemList & items, bool sendPtr = FALSE, TQListBox * parent = 0, const char * name = 0 );
~ListBoxItemDrag() {};
- static bool canDecode( QDragMoveEvent * event );
- static bool decode( QDropEvent * event, QListBox * parent, QListBoxItem * insertPoint );
+ static bool canDecode( TQDragMoveEvent * event );
+ static bool decode( TQDropEvent * event, TQListBox * parent, TQListBoxItem * insertPoint );
enum ItemType { ListBoxText = 1, ListBoxPixmap = 2 };
};
// ------------------------------------------------------------------
-ListBoxDnd::ListBoxDnd( QListBox * eventSource, const char * name )
+ListBoxDnd::ListBoxDnd( TQListBox * eventSource, const char * name )
: ListDnd( eventSource, name ) { }
-void ListBoxDnd::confirmDrop( QListBoxItem * )
+void ListBoxDnd::confirmDrop( TQListBoxItem * )
{
dropConfirmed = TRUE;
}
-bool ListBoxDnd::dropEvent( QDropEvent * event )
+bool ListBoxDnd::dropEvent( TQDropEvent * event )
{
if ( dragInside ) {
@@ -61,13 +61,13 @@ bool ListBoxDnd::dropEvent( QDropEvent * event )
return TRUE;
}
- QPoint pos = event->pos();
- QListBoxItem * after = itemAt( pos );
+ TQPoint pos = event->pos();
+ TQListBoxItem * after = itemAt( pos );
- if ( ListBoxItemDrag::decode( event, (QListBox *) src, after ) ) {
+ if ( ListBoxItemDrag::decode( event, (TQListBox *) src, after ) ) {
event->accept();
- QListBox * src = (QListBox *) this->src;
- QListBoxItem * item = ( after ? after->next() : src->firstItem() );
+ TQListBox * src = (TQListBox *) this->src;
+ TQListBoxItem * item = ( after ? after->next() : src->firstItem() );
src->setCurrentItem( item );
emit dropped( item ); // ###FIX: Supports only one item!
}
@@ -79,17 +79,17 @@ bool ListBoxDnd::dropEvent( QDropEvent * event )
return TRUE;
}
-bool ListBoxDnd::mouseMoveEvent( QMouseEvent * event )
+bool ListBoxDnd::mouseMoveEvent( TQMouseEvent * event )
{
if ( event->state() & LeftButton ) {
if ( ( event->pos() - mousePressPos ).manhattanLength() > 3 ) {
ListBoxItemList list;
buildList( list );
- ListBoxItemDrag * dragobject = new ListBoxItemDrag( list, (dMode & Internal), (QListBox *) src );
+ ListBoxItemDrag * dragobject = new ListBoxItemDrag( list, (dMode & Internal), (TQListBox *) src );
// Emit signal for all dragged items
- QListBoxItem * i = list.first();
+ TQListBoxItem * i = list.first();
while ( i ) {
emit dragged( i );
i = list.next();
@@ -117,10 +117,10 @@ bool ListBoxDnd::mouseMoveEvent( QMouseEvent * event )
int ListBoxDnd::buildList( ListBoxItemList & list )
{
- QListBoxItem * i = ((QListBox *)src)->firstItem();
+ TQListBoxItem * i = ((TQListBox *)src)->firstItem();
while ( i ) {
if ( i->isSelected() ) {
- ((QListBox *)src)->setSelected( i, FALSE );
+ ((TQListBox *)src)->setSelected( i, FALSE );
list.append( i );
}
i = i->next();
@@ -130,40 +130,40 @@ int ListBoxDnd::buildList( ListBoxItemList & list )
void ListBoxDnd::insertList( ListBoxItemList & list )
{
- QListBoxItem * i = list.first();
+ TQListBoxItem * i = list.first();
while ( i ) {
- ((QListBox *)src)->insertItem( i, i->prev() );
+ ((TQListBox *)src)->insertItem( i, i->prev() );
i = list.next();
}
}
void ListBoxDnd::removeList( ListBoxItemList & list )
{
- QListBoxItem * i = list.first();
+ TQListBoxItem * i = list.first();
while ( i ) {
- ((QListBox *)src)->takeItem( i ); // remove item from QListBox
+ ((TQListBox *)src)->takeItem( i ); // remove item from QListBox
i = list.next();
}
}
-void ListBoxDnd::updateLine( const QPoint & dragPos )
+void ListBoxDnd::updateLine( const TQPoint & dragPos )
{
- QListBox * src = (QListBox *) this->src;
- QListBoxItem *item = itemAt( dragPos );
+ TQListBox * src = (TQListBox *) this->src;
+ TQListBoxItem *item = itemAt( dragPos );
int ypos = item ?
( src->itemRect( item ).bottom() - ( line->height() / 2 ) ) :
- ( src->itemRect( ((QListBox *)src)->firstItem() ).top() );
+ ( src->itemRect( ((TQListBox *)src)->firstItem() ).top() );
line->resize( src->viewport()->width(), line->height() );
line->move( 0, ypos );
}
-QListBoxItem * ListBoxDnd::itemAt( QPoint pos )
+TQListBoxItem * ListBoxDnd::itemAt( TQPoint pos )
{
- QListBox * src = (QListBox *) this->src;
- QListBoxItem * result = src->itemAt( pos );
- QListBoxItem * last = src->item( src->count() - 1 );
+ TQListBox * src = (TQListBox *) this->src;
+ TQListBoxItem * result = src->itemAt( pos );
+ TQListBoxItem * last = src->item( src->count() - 1 );
int i = src->index( result );
if ( result && ( pos.y() < (src->itemRect(result).top() + src->itemHeight(i)/2) ) )
@@ -174,7 +174,7 @@ QListBoxItem * ListBoxDnd::itemAt( QPoint pos )
return result;
}
-bool ListBoxDnd::canDecode( QDragEnterEvent * event )
+bool ListBoxDnd::canDecode( TQDragEnterEvent * event )
{
return ListBoxItemDrag::canDecode( event );
}
@@ -184,17 +184,17 @@ bool ListBoxDnd::canDecode( QDragEnterEvent * event )
// The Dragobject Implementation ------------------------------------
// ------------------------------------------------------------------
-ListBoxItemDrag::ListBoxItemDrag( ListBoxItemList & items, bool sendPtr, QListBox * parent, const char * name )
- : QStoredDrag( "qt/listboxitem", parent, name )
+ListBoxItemDrag::ListBoxItemDrag( ListBoxItemList & items, bool sendPtr, TQListBox * parent, const char * name )
+ : TQStoredDrag( "qt/listboxitem", parent, name )
{
// ### FIX!
- QByteArray data( sizeof( Q_INT32 ) + sizeof( QListBoxItem ) * items.count() );
- QDataStream stream( data, IO_WriteOnly );
+ TQByteArray data( sizeof( Q_INT32 ) + sizeof( TQListBoxItem ) * items.count() );
+ TQDataStream stream( data, IO_WriteOnly );
stream << items.count();
stream << (Q_UINT8) sendPtr; // just transfer item pointer; omit data
- QListBoxItem * i = items.first();
+ TQListBoxItem * i = items.first();
if ( sendPtr ) {
@@ -211,7 +211,7 @@ ListBoxItemDrag::ListBoxItemDrag( ListBoxItemList & items, bool sendPtr, QListBo
Q_UINT8 b = 0;
- b = (Q_UINT8) ( i->text() != QString::null ); // does item have text ?
+ b = (Q_UINT8) ( i->text() != TQString::null ); // does item have text ?
stream << b;
if ( b ) {
stream << i->text();
@@ -233,18 +233,18 @@ ListBoxItemDrag::ListBoxItemDrag( ListBoxItemList & items, bool sendPtr, QListBo
setEncodedData( data );
}
-bool ListBoxItemDrag::canDecode( QDragMoveEvent * event )
+bool ListBoxItemDrag::canDecode( TQDragMoveEvent * event )
{
return event->provides( "qt/listboxitem" );
}
-bool ListBoxItemDrag::decode( QDropEvent * event, QListBox * parent, QListBoxItem * after )
+bool ListBoxItemDrag::decode( TQDropEvent * event, TQListBox * parent, TQListBoxItem * after )
{
- QByteArray data = event->encodedData( "qt/listboxitem" );
+ TQByteArray data = event->encodedData( "qt/listboxitem" );
if ( data.size() ) {
event->accept();
- QDataStream stream( data, IO_ReadOnly );
+ TQDataStream stream( data, IO_ReadOnly );
int count = 0;
stream >> count;
@@ -252,7 +252,7 @@ bool ListBoxItemDrag::decode( QDropEvent * event, QListBox * parent, QListBoxIte
Q_UINT8 recievePtr = 0; // data contains just item pointers; no data
stream >> recievePtr;
- QListBoxItem * item = 0;
+ TQListBoxItem * item = 0;
if ( recievePtr ) {
@@ -260,7 +260,7 @@ bool ListBoxItemDrag::decode( QDropEvent * event, QListBox * parent, QListBoxIte
Q_ULONG p = 0; //###FIX: demands sizeof(ulong) >= sizeof(void*)
stream >> p;
- item = (QListBoxItem *) p;
+ item = (TQListBoxItem *) p;
parent->insertItem( item, after );
@@ -271,14 +271,14 @@ bool ListBoxItemDrag::decode( QDropEvent * event, QListBox * parent, QListBoxIte
for ( int i = 0; i < count; i++ ) {
Q_UINT8 hasText = 0;
- QString text;
+ TQString text;
stream >> hasText;
if ( hasText ) {
stream >> text;
}
Q_UINT8 hasPixmap = 0;
- QPixmap pixmap;
+ TQPixmap pixmap;
stream >> hasPixmap;
if ( hasPixmap ) {
stream >> pixmap;
@@ -288,9 +288,9 @@ bool ListBoxItemDrag::decode( QDropEvent * event, QListBox * parent, QListBoxIte
stream >> isSelectable;
if ( hasPixmap ) {
- item = new QListBoxPixmap( parent, pixmap, text, after );
+ item = new TQListBoxPixmap( parent, pixmap, text, after );
} else {
- item = new QListBoxText( parent, text, after );
+ item = new TQListBoxText( parent, text, after );
}
item->setSelectable( isSelectable );