diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
commit | 0a80cfd57d271dd44221467efb426675fa470356 (patch) | |
tree | 6f503a31aa078eaf8fa015cf1749808529d49fc9 /src/modules/objects/class_listview.cpp | |
parent | 3329e5a804e28ef3f5eb51d1e7affdd5a508e8f2 (diff) | |
download | kvirc-0a80cfd57d271dd44221467efb426675fa470356.tar.gz kvirc-0a80cfd57d271dd44221467efb426675fa470356.zip |
TQt4 port kvirc
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1238719 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/modules/objects/class_listview.cpp')
-rw-r--r-- | src/modules/objects/class_listview.cpp | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/src/modules/objects/class_listview.cpp b/src/modules/objects/class_listview.cpp index f571788c..036e758e 100644 --- a/src/modules/objects/class_listview.cpp +++ b/src/modules/objects/class_listview.cpp @@ -27,10 +27,10 @@ #include "kvi_tal_listview.h" #ifdef COMPILE_USE_QT4 -#include <q3header.h> -#include <qevent.h> +#include <tq3header.h> +#include <tqevent.h> #else -#include <qheader.h> +#include <tqheader.h> #endif #include "class_listview.h" #include "kvi_error.h" @@ -55,11 +55,11 @@ [class]widget[/class] @description: It can display and control a hierarchy of multi-column items, and provides the ability to add new items at any time. - The items are added by creating children [class]listviewitem[/class] objects: simply allocating them with $new + The items are added by creating tqchildren [class]listviewitem[/class] objects: simply allocating them with $new will add the items to the listview and simply deleting them will remove them. Allocating a [class]listviewitem[/class] item2 as a child of item1 will insert it to the same listview creating a subtree of items spannig from item1. The subtree can be opened or closed by a simple click either - on the parent item or on the little plus sign on the side of it (when [classfnc:listview]$setRootIsDecorated[/classfnc] + on the tqparent item or on the little plus sign on the side of it (when [classfnc:listview]$setRootIsDecorated[/classfnc] is set to $true. The listview can be in Single, Multi, Extended or NoSelection selection mode. In single selection mode there can be only one selected item at a time and the selected item is also the current item (this mode is the default). In Multi and Extended selection mode there can be multiple selected items @@ -132,11 +132,11 @@ The default implementation emits the [classfnc]$onItem[/classfnc]() signal. !fn: $itemExpandedEvent(<item:object>) - This event is called when an item has been expanded, i.e. when the children of item are shown. + This event is called when an item has been expanded, i.e. when the tqchildren of item are shown. The default implementation emits the [classfnc]$expanded[/classfnc]() signal. !fn: $itemCollapsedEvent(<item:object>) - This event is called when an item has been collapsed, i.e. when the children of item are hidden. + This event is called when an item has been collapsed, i.e. when the tqchildren of item are hidden. The default implementation emits the [classfnc]$collapsed[/classfnc]() signal. !fn: $itemRenamedEvent(<item:object>,<col:integer>,<text:string>) @@ -217,24 +217,24 @@ KVSO_END_CONSTRUCTOR(KviKvsObject_listview) bool KviKvsObject_listview::init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams) { - setObject(new KviKvsMdmListView(parentScriptWidget(),name(),this),true); - connect(widget(),SIGNAL(clicked(KviTalListViewItem *)),this,SLOT(slotClicked(KviTalListViewItem *))); - connect(widget(),SIGNAL(selectionChanged(KviTalListViewItem *)),this,SLOT(slotSelectionChanged(KviTalListViewItem *))); - connect(widget(),SIGNAL(selectionChanged()),this,SLOT(slotMultipleSelectionChanged())); - connect(widget(),SIGNAL(currentChanged(KviTalListViewItem *)),this,SLOT(slotCurrentChanged(KviTalListViewItem *))); - connect(widget(),SIGNAL(returnPressed(KviTalListViewItem *)),this,SLOT(slotReturnPressed(KviTalListViewItem *))); - connect(widget(),SIGNAL(spacePressed(KviTalListViewItem *)),this,SLOT(slotSpacePressed(KviTalListViewItem *))); - connect(widget(),SIGNAL(onItem(KviTalListViewItem *)),this,SLOT(slotOnItem(KviTalListViewItem *))); - connect(widget(),SIGNAL(expanded(KviTalListViewItem *)),this,SLOT(slotItemExpanded(KviTalListViewItem *))); - connect(widget(),SIGNAL(collapsed(KviTalListViewItem *)),this,SLOT(slotItemCollapsed(KviTalListViewItem *))); - connect(widget(),SIGNAL(rightButtonClicked(KviTalListViewItem *,const QPoint &,int)),this,SLOT(slotRightButtonClicked(KviTalListViewItem *,const QPoint &,int))); - connect(widget(),SIGNAL(itemRenamed(KviTalListViewItem *,int,const QString &)),this,SLOT(slotItemRenamed(KviTalListViewItem *,int,const QString &))); + setObject(TQT_TQOBJECT(new KviKvsMdmListView(tqparentScriptWidget(),name(),this)),true); + connect(widget(),TQT_SIGNAL(clicked(KviTalListViewItem *)),this,TQT_SLOT(slotClicked(KviTalListViewItem *))); + connect(widget(),TQT_SIGNAL(selectionChanged(KviTalListViewItem *)),this,TQT_SLOT(slotSelectionChanged(KviTalListViewItem *))); + connect(widget(),TQT_SIGNAL(selectionChanged()),this,TQT_SLOT(slotMultipleSelectionChanged())); + connect(widget(),TQT_SIGNAL(currentChanged(KviTalListViewItem *)),this,TQT_SLOT(slotCurrentChanged(KviTalListViewItem *))); + connect(widget(),TQT_SIGNAL(returnPressed(KviTalListViewItem *)),this,TQT_SLOT(slotReturnPressed(KviTalListViewItem *))); + connect(widget(),TQT_SIGNAL(spacePressed(KviTalListViewItem *)),this,TQT_SLOT(slotSpacePressed(KviTalListViewItem *))); + connect(widget(),TQT_SIGNAL(onItem(KviTalListViewItem *)),this,TQT_SLOT(slotOnItem(KviTalListViewItem *))); + connect(widget(),TQT_SIGNAL(expanded(KviTalListViewItem *)),this,TQT_SLOT(slotItemExpanded(KviTalListViewItem *))); + connect(widget(),TQT_SIGNAL(collapsed(KviTalListViewItem *)),this,TQT_SLOT(slotItemCollapsed(KviTalListViewItem *))); + connect(widget(),TQT_SIGNAL(rightButtonClicked(KviTalListViewItem *,const TQPoint &,int)),this,TQT_SLOT(slotRightButtonClicked(KviTalListViewItem *,const TQPoint &,int))); + connect(widget(),TQT_SIGNAL(itemRenamed(KviTalListViewItem *,int,const TQString &)),this,TQT_SLOT(slotItemRenamed(KviTalListViewItem *,int,const TQString &))); return true; } bool KviKvsObject_listview::function_addColumn(KviKvsObjectFunctionCall *c) { - QString szLabel; + TQString szLabel; kvs_int_t iW; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("label",KVS_PT_STRING,0,szLabel) @@ -293,7 +293,7 @@ bool KviKvsObject_listview::function_currentItem(KviKvsObjectFunctionCall *c) bool KviKvsObject_listview::function_setColumnText(KviKvsObjectFunctionCall *c) { kvs_int_t uCol; - QString szText; + TQString szText; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("column",KVS_PT_UNSIGNEDINTEGER,0,uCol) KVSO_PARAMETER("text",KVS_PT_STRING,0,szText) @@ -304,18 +304,18 @@ bool KviKvsObject_listview::function_setColumnText(KviKvsObjectFunctionCall *c) bool KviKvsObject_listview::function_setSelectionMode(KviKvsObjectFunctionCall *c) { - QString szMode; + TQString szMode; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("mode",KVS_PT_NONEMPTYSTRING,0,szMode) KVSO_PARAMETERS_END(c) if(!widget())return true; - if(KviQString::equalCI(szMode,"NoSelection")) + if(KviTQString::equalCI(szMode,"NoSelection")) ((KviTalListView *)widget())->setSelectionMode(KviTalListView::NoSelection); - else if(KviQString::equalCI(szMode,"Multi")) + else if(KviTQString::equalCI(szMode,"Multi")) ((KviTalListView *)widget())->setSelectionMode(KviTalListView::Multi); - else if(KviQString::equalCI(szMode,"Extended")) + else if(KviTQString::equalCI(szMode,"Extended")) ((KviTalListView *)widget())->setSelectionMode(KviTalListView::Extended); - else if(KviQString::equalCI(szMode,"Single")) + else if(KviTQString::equalCI(szMode,"Single")) ((KviTalListView *)widget())->setSelectionMode(KviTalListView::Single); else c->warning(__tr2qs("Invalid selection mode '%Q'"),&szMode); return true; @@ -481,7 +481,7 @@ bool KviKvsObject_listview::function_rightButtonClickedEvent(KviKvsObjectFunctio return true; } -void KviKvsObject_listview::slotRightButtonClicked(KviTalListViewItem * i,const QPoint &coor, int col) +void KviKvsObject_listview::slotRightButtonClicked(KviTalListViewItem * i,const TQPoint &coor, int col) { KviKvsVariant *xpos=new KviKvsVariant((kvs_int_t)coor.x()); KviKvsVariant *ypos=new KviKvsVariant((kvs_int_t)coor.y()); @@ -496,24 +496,24 @@ bool KviKvsObject_listview::function_itemRenamedEvent(KviKvsObjectFunctionCall * return true; } -void KviKvsObject_listview::slotItemRenamed(KviTalListViewItem *item,int col,const QString & szText) +void KviKvsObject_listview::slotItemRenamed(KviTalListViewItem *item,int col,const TQString & szText) { KviKvsVariant *column=new KviKvsVariant((kvs_int_t)col); KviKvsVariant *txt=new KviKvsVariant(szText); KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(item)),column,txt); callFunction(this,"itemRenamedEvent",0,¶ms); } -void KviKvsObject_listview::fileDropped(QString &szFile,KviTalListViewItem *item) +void KviKvsObject_listview::fileDropped(TQString &szFile,KviTalListViewItem *item) { KviKvsVariant *file=new KviKvsVariant(szFile); KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(item)),file); callFunction(this,"fileDroppedEvent",0,¶ms); } -KviKvsMdmListView::KviKvsMdmListView(QWidget * par,const char * name,KviKvsObject_listview *parent) +KviKvsMdmListView::KviKvsMdmListView(TQWidget * par,const char * name,KviKvsObject_listview *tqparent) :KviTalListView(par) { - m_pParentScript=parent; + m_pParentScript=tqparent; setAcceptDrops(true); viewport()->setAcceptDrops( TRUE ); @@ -522,7 +522,7 @@ KviKvsMdmListView::~KviKvsMdmListView() { } -void KviKvsMdmListView::contentsDragEnterEvent( QDragEnterEvent *e ) +void KviKvsMdmListView::contentsDragEnterEvent( TQDragEnterEvent *e ) { if ( !KviUriDrag::canDecode(e)) { @@ -533,19 +533,19 @@ void KviKvsMdmListView::contentsDragEnterEvent( QDragEnterEvent *e ) } -void KviKvsMdmListView::contentsDropEvent(QDropEvent *e) +void KviKvsMdmListView::contentsDropEvent(TQDropEvent *e) { - QStringList list; + TQStringList list; if(KviUriDrag::decodeLocalFiles(e,list)) { if(!list.isEmpty()) { - QStringList::ConstIterator it = list.begin(); //kewl ! :) + TQStringList::ConstIterator it = list.begin(); //kewl ! :) for( ; it != list.end(); ++it ) { - QString tmp = *it; //wow :) + TQString tmp = *it; //wow :) #ifndef COMPILE_ON_WINDOWS - if(tmp[0] != '/')tmp.prepend("/"); //HACK HACK HACK for Qt bug (?!?) + if(tmp[0] != '/')tmp.prepend("/"); //HACK HACK HACK for TQt bug (?!?) #endif KviTalListViewItem *i = itemAt( contentsToViewport(e->pos()) ); m_pParentScript->fileDropped(tmp,i); |