aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/objects
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/objects')
-rw-r--r--src/modules/objects/class_treewidget.cpp19
-rw-r--r--src/modules/objects/class_treewidget.h1
2 files changed, 17 insertions, 3 deletions
diff --git a/src/modules/objects/class_treewidget.cpp b/src/modules/objects/class_treewidget.cpp
index 2ef32f6c8..6c924eb7e 100644
--- a/src/modules/objects/class_treewidget.cpp
+++ b/src/modules/objects/class_treewidget.cpp
@@ -100,6 +100,12 @@
!fn: <listviewitem> $firstChild()
Returns the first child [class]listviewitem[/class] of this listview or $null if there are no items at all.
+ !fn: <listviewitem> $topLevelItem(<index:int>)
+ Returns the <index> child [class]listviewitem[/class] of this listview or $null if it does not exists.
+
+ !fn: <int> $topLevelItemCount()
+ Returns the number of top level items of this listview.
+
!fn: setAcceptDrops(<benabled:boolean>)
If <bEnabled> is true, user can drop files for this listview. The default value is true.
@@ -201,7 +207,7 @@ KVSO_BEGIN_REGISTERCLASS(KviKvsObject_treewidget,"listview","widget")
KVSO_REGISTER_HANDLER_BY_NAME(KviKvsObject_treewidget,showListViewHeader)
KVSO_REGISTER_HANDLER_BY_NAME(KviKvsObject_treewidget,firstChild)
KVSO_REGISTER_HANDLER_BY_NAME(KviKvsObject_treewidget,topLevelItem)
-
+ KVSO_REGISTER_HANDLER_BY_NAME(KviKvsObject_treewidget,topLevelItemCount)
@@ -280,9 +286,9 @@ KVSO_CLASS_FUNCTION(treewidget,setColumnText)
KVSO_CLASS_FUNCTION(treewidget,topLevelItem)
{
if (!widget()) return true;
- kvs_int_t iIdx;
+ kvs_int_t iIdx;
KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("column",KVS_PT_INT,0,iIdx)
+ KVSO_PARAMETER("index",KVS_PT_INT,0,iIdx)
KVSO_PARAMETERS_END(c)
QTreeWidgetItem *pItem=((QTreeWidget *)widget())->topLevelItem(iIdx);
if (!pItem) c->returnValue()->setHObject((kvs_hobject_t)0);
@@ -290,6 +296,13 @@ KVSO_CLASS_FUNCTION(treewidget,topLevelItem)
return true;
}
+KVSO_CLASS_FUNCTION(treewidget,topLevelItemCount)
+{
+ if (!widget()) return true;
+ c->returnValue()->setInteger(((QTreeWidget *)widget())->topLevelItemCount());
+ return true;
+}
+
KVSO_CLASS_FUNCTION(treewidget,addColumn)
{
if (!widget()) return true;
diff --git a/src/modules/objects/class_treewidget.h b/src/modules/objects/class_treewidget.h
index d7b199edc..aaccd43cf 100644
--- a/src/modules/objects/class_treewidget.h
+++ b/src/modules/objects/class_treewidget.h
@@ -71,6 +71,7 @@ protected:
bool setHeaderLabels(KviKvsObjectFunctionCall *c);
bool setColumnCount(KviKvsObjectFunctionCall *c);
bool topLevelItem(KviKvsObjectFunctionCall *c);
+ bool topLevelItemCount(KviKvsObjectFunctionCall *c);
protected slots:
void slotClicked(QTreeWidgetItem *,int);
void slotCustomContextMenuRequested(const QPoint &pnt);