Browse files

Handle mouse in mythuibuttontree.

  • Loading branch information...
1 parent 6e490cd commit e763a6af46e29844df8abb6d6de92d363a5db858 @stuartm stuartm committed Jun 2, 2012
Showing with 25 additions and 1 deletion.
  1. +24 −0 mythtv/libs/libmythui/mythuibuttontree.cpp
  2. +1 −1 mythtv/libs/libmythui/mythuibuttontree.h
View
24 mythtv/libs/libmythui/mythuibuttontree.cpp
@@ -633,6 +633,30 @@ bool MythUIButtonTree::keyPressEvent(QKeyEvent *event)
return handled;
}
+bool MythUIButtonTree::gestureEvent(MythGestureEvent *event)
+{
+ bool handled = false;
+
+ if (event->gesture() == MythGestureEvent::Click)
+ {
+ // We want the relative position of the click
+ QPoint position = event->GetPosition() -
+ m_Parent->GetArea().topLeft();
+
+ MythUIType *type = GetChildAt(position, false, false);
+
+ if (!type)
+ return false;
+
+ MythUIButtonList *list = dynamic_cast<MythUIButtonList *>(type);
+
+ if (list)
+ handled = list->gestureEvent(event);
+ }
+
+ return handled;
+}
+
/*!
* \copydoc MythUIType::ParseElement()
*/
View
2 mythtv/libs/libmythui/mythuibuttontree.h
@@ -21,7 +21,7 @@ class MUI_PUBLIC MythUIButtonTree : public MythUIType
~MythUIButtonTree();
virtual bool keyPressEvent(QKeyEvent *);
- //virtual void gestureEvent(MythUIType *uitype, MythGestureEvent *event);
+ virtual bool gestureEvent(MythGestureEvent *event);
bool AssignTree(MythGenericTree *tree);
void Reset(void);

0 comments on commit e763a6a

Please sign in to comment.