From 8018b4370223105f6ef2cffa67979609fcd77a09 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Mon, 25 Jul 2011 09:42:47 +0000 Subject: fixed popupmenu's highlightedEvent parameter value git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@5915 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/modules/objects/KvsObject_popupMenu.cpp | 14 ++++++++++---- src/modules/objects/KvsObject_popupMenu.h | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src/modules/objects') diff --git a/src/modules/objects/KvsObject_popupMenu.cpp b/src/modules/objects/KvsObject_popupMenu.cpp index 39e6ebeea..668caad35 100644 --- a/src/modules/objects/KvsObject_popupMenu.cpp +++ b/src/modules/objects/KvsObject_popupMenu.cpp @@ -76,7 +76,7 @@ This function is called when a menu item and return the the item id.[br] The default implementation emits the [classfnc]$activated[/classfnc]() signal. !fn: $highligthtedEvent() - This function is called when a menu item is highlighted and return the item id.[br] + This function is called when a menu item is highlighted (hovered) and return the item id.[br] The default implementation emits the [classfnc]$highlighted[/classfnc]() signal. @signals: !sg: $activated() @@ -225,7 +225,7 @@ bool KvsObject_popupMenu::init(KviKvsRunTimeContext *,KviKvsVariantList *) SET_OBJECT(QMenu) connect(widget(),SIGNAL(triggered(QAction *)),this,SLOT(slottriggered(QAction *))); connect(widget(),SIGNAL(destroyed(QObject *)),this,SLOT(aboutToDie(QObject *))); - connect(widget(),SIGNAL(highlighted(int)),this,SLOT(slothighlighted(int))); + connect(widget(),SIGNAL(hovered(QAction *)),this,SLOT(slothovered(QAction *))); return true; } @@ -362,9 +362,15 @@ KVSO_CLASS_FUNCTION(popupMenu,insertSeparator) return true; } -void KvsObject_popupMenu::slothighlighted(int i) +void KvsObject_popupMenu::slothovered(QAction *a) { - KviKvsVariantList params(new KviKvsVariant((kvs_int_t)i)); + QHashIterator i(actionsDict); + while (i.hasNext()) + { + i.next(); + if (i.value()== a) break; + } + KviKvsVariantList params(new KviKvsVariant((kvs_int_t)i.key())); callFunction(this,"highlightedEvent",¶ms); } void KvsObject_popupMenu::aboutToDie(QObject *pObject) diff --git a/src/modules/objects/KvsObject_popupMenu.h b/src/modules/objects/KvsObject_popupMenu.h index af6c9336c..ad0fc37c7 100644 --- a/src/modules/objects/KvsObject_popupMenu.h +++ b/src/modules/objects/KvsObject_popupMenu.h @@ -56,7 +56,7 @@ protected: protected slots: void slottriggered(QAction *); - void slothighlighted(int); + void slothovered(QAction *); void aboutToDie(QObject *); }; -- cgit v1.3.1-10-gc9f91