aboutsummaryrefslogtreecommitdiff
path: root/src/corelib/widgets/mpannablewidget_p.h
diff options
context:
space:
mode:
authorMichal Guminiak <michal.guminiak@teleca.com>2010-10-19 15:52:24 +0200
committerDominik Kapusta <dominik.kapusta@teleca.com>2010-12-08 16:05:04 +0100
commit46fea17d494761ec6b40b424c2f3be88781df31a (patch)
tree23913c1121adc34548b2d99012dd05faa238f0df /src/corelib/widgets/mpannablewidget_p.h
parentadac4f3fb70f524c4cf3df842db1317b4d2d3ea1 (diff)
Fixes: NB#182815 - Pannable widget is not transparent wrt. passing focus to child widgets
RevBy: Jarno Malmari, Michael Hasselmann, Dominik Kapusta Details: This patch completely removes mouse event replaying functionality in the pannable widget and moves necessary pieces to mscene. This should allow better focus handling in the scene and also should remove all crashes related to mouse event being bounced between pannable widgets when two of them are placed on the scene. It also introduces one new method, an overloaded version of grabGesture, which can be used to control the cancel event handling in libmeegotouch applications. See documentation of MWidget::grabGesture for details.
Diffstat (limited to 'src/corelib/widgets/mpannablewidget_p.h')
-rw-r--r--src/corelib/widgets/mpannablewidget_p.h74
1 files changed, 11 insertions, 63 deletions
diff --git a/src/corelib/widgets/mpannablewidget_p.h b/src/corelib/widgets/mpannablewidget_p.h
index 6129623b..b853783a 100644
--- a/src/corelib/widgets/mpannablewidget_p.h
+++ b/src/corelib/widgets/mpannablewidget_p.h
@@ -37,16 +37,11 @@ class MPannableWidgetGlass;
class MPannableWidgetGlass : public MWidget
{
public:
- MPannableWidgetGlass(QGraphicsItem *parent = 0);
- virtual ~MPannableWidgetGlass();
+ MPannableWidgetGlass(MPannableWidget *pannableWidget = 0);
virtual QRectF boundingRect() const;
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
- virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
- virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
- virtual void timerEvent(QTimerEvent* event);
- virtual void cancelEvent(MCancelEvent *event);
virtual void tapAndHoldGestureEvent(QGestureEvent *event, QTapAndHoldGesture *gesture);
protected:
@@ -61,67 +56,20 @@ public:
explicit MPannableWidgetPrivate();
virtual ~MPannableWidgetPrivate();
- QGraphicsSceneMouseEvent pressEvent;
- MPhysics2DPanning *physics;
- MPannableWidgetGlass *glass;
- QGraphicsItem *mouseGrabber;
-
- struct resentItem {
- QEvent::Type type;
- QPoint screenPos;
- Qt::MouseButton button;
- };
-
- QList<struct resentItem> resentList;
-
- int pressDeliveryTimerId;
- bool panGestureCausedCancelEvent;
-public:
+ void init();
+ void resetPhysics();
+ void glassMousePressEvent(QGraphicsSceneMouseEvent *event);
- /*!
- * \brief Internal method necessary to correctly handle event positions.
- */
- void translateEventToItemCoordinates(const QGraphicsItem *srcItem,
- const QGraphicsItem *destItem,
- QGraphicsSceneMouseEvent *event);
+private:
- /*!
- * \brief Method used for resetting state of the physics engine.
- */
- void resetPhysics();
+ MPhysics2DPanning *physics;
+ MPannableWidgetGlass *glass;
- /*!
- * \brief Method used for resetting glass and mouse grabber.
- */
- void resetMouseGrabber();
-
- /*!
- * \brief Method used for delivering event to interested widget.
- */
- void deliverMouseEvent(QGraphicsSceneMouseEvent *event);
-
- /*!
- * \brief Method used for delivering initial mouse press. It will set
- * the mouseGrabber if it is necessary at this point.
- */
- void deliverPressEvent();
-
- /*!
- * \brief Method used to start a timer which will trigger the delivery
- * of initial mouse press event.
- */
- void initialPressStartTimer();
-
- /*!
- * \brief Method used for cancelling the mouse press delivery timer.
- */
- void initialPressStopTimer();
-
- /*!
- * \brief Method used for getting an enabled parent pannable widget.
- */
- MPannableWidget* parentPannableWidget();
+#ifdef UNIT_TEST
+ // Test unit is defined as a friend of production code to access private members
+ friend class Ut_MPannableWidget;
+#endif
};
#endif