From e763a6af46e29844df8abb6d6de92d363a5db858 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Sat, 2 Jun 2012 14:29:11 +0100 Subject: [PATCH] Handle mouse in mythuibuttontree. --- mythtv/libs/libmythui/mythuibuttontree.cpp | 24 ++++++++++++++++++++++ mythtv/libs/libmythui/mythuibuttontree.h | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/mythtv/libs/libmythui/mythuibuttontree.cpp b/mythtv/libs/libmythui/mythuibuttontree.cpp index 7b190bcd0ab..b71ccb8d8fc 100644 --- a/mythtv/libs/libmythui/mythuibuttontree.cpp +++ b/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(type); + + if (list) + handled = list->gestureEvent(event); + } + + return handled; +} + /*! * \copydoc MythUIType::ParseElement() */ diff --git a/mythtv/libs/libmythui/mythuibuttontree.h b/mythtv/libs/libmythui/mythuibuttontree.h index 3b63a7e4c77..04e69eb032a 100644 --- a/mythtv/libs/libmythui/mythuibuttontree.h +++ b/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);