aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Guminiak <michal.guminiak@teleca.com>2010-12-09 10:05:27 +0100
committerMichal Guminiak <michal.guminiak@teleca.com>2010-12-09 10:33:32 +0100
commitd19d5e161a186b020d6c3915e12d81af2dec075a (patch)
tree693750780156eec1e323f31855b6a06fc395e12a
parent53fe6cab0f759e7276769a3835952eecebf3751d (diff)
Changes: rename MWidget::grabGesture method to grabGestureWithCancelPolicy
RevBy: Stanislav Details: To avoid confusion and possible problems, this patch gets rid of grabGesture redefinition in MWidget and introduces a method called grabGestureWithCancelPolicy.
-rw-r--r--src/corelib/widgets/core/mwidget.cpp2
-rw-r--r--src/corelib/widgets/core/mwidget.h4
-rw-r--r--src/corelib/widgets/mcontentitem.cpp2
-rw-r--r--src/corelib/widgets/mcontentitem.h6
-rw-r--r--src/corelib/widgets/mlabel.cpp4
-rw-r--r--src/corelib/widgets/mlistitem.cpp2
-rw-r--r--src/corelib/widgets/mpannablewidget.cpp2
7 files changed, 13 insertions, 9 deletions
diff --git a/src/corelib/widgets/core/mwidget.cpp b/src/corelib/widgets/core/mwidget.cpp
index ab7f2928..a6d6a463 100644
--- a/src/corelib/widgets/core/mwidget.cpp
+++ b/src/corelib/widgets/core/mwidget.cpp
@@ -341,7 +341,7 @@ void MWidget::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
}
}
-void MWidget::grabGesture(Qt::GestureType type, Qt::GestureFlags flags, MouseEventCancelPolicy cancelPolicy)
+void MWidget::grabGestureWithCancelPolicy(Qt::GestureType type, Qt::GestureFlags flags, MouseEventCancelPolicy cancelPolicy)
{
Q_D(MWidget);
QGraphicsWidget::grabGesture(type, flags);
diff --git a/src/corelib/widgets/core/mwidget.h b/src/corelib/widgets/core/mwidget.h
index c3bea238..2e8a3f61 100644
--- a/src/corelib/widgets/core/mwidget.h
+++ b/src/corelib/widgets/core/mwidget.h
@@ -124,7 +124,7 @@ public:
* \li MouseEventCancelOnGestureFinished - the cancel event will be sent when
* a gesture is being finished and was accepted by this widget.
*
- * \sa grabGesture.
+ * \sa grabGestureWithCancelPolicy.
*/
enum MouseEventCancelPolicy {
MouseEventNoCancel,
@@ -151,7 +151,7 @@ public:
\sa MouseEventCancelPolicy
*/
- void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags(), MouseEventCancelPolicy cancelPolicy = MouseEventNoCancel);
+ void grabGestureWithCancelPolicy(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags(), MouseEventCancelPolicy cancelPolicy = MouseEventNoCancel);
/*! \reimp
* We reimplement these to distinguish between the user hiding items
diff --git a/src/corelib/widgets/mcontentitem.cpp b/src/corelib/widgets/mcontentitem.cpp
index 2dfa2e6d..64fc27f9 100644
--- a/src/corelib/widgets/mcontentitem.cpp
+++ b/src/corelib/widgets/mcontentitem.cpp
@@ -46,7 +46,7 @@ void MContentItemPrivate::updateLongTapConnections()
Q_Q(MContentItem);
if (q->receivers(SIGNAL(longTapped(QPointF))) > 0)
- q->grabGesture(Qt::TapAndHoldGesture, Qt::GestureFlags(), MWidget::MouseEventCancelOnGestureFinished);
+ q->grabGestureWithCancelPolicy(Qt::TapAndHoldGesture, Qt::GestureFlags(), MWidget::MouseEventCancelOnGestureFinished);
else
q->ungrabGesture(Qt::TapAndHoldGesture);
}
diff --git a/src/corelib/widgets/mcontentitem.h b/src/corelib/widgets/mcontentitem.h
index ddde4818..5553e352 100644
--- a/src/corelib/widgets/mcontentitem.h
+++ b/src/corelib/widgets/mcontentitem.h
@@ -327,7 +327,11 @@ public Q_SLOTS:
If the MContentItem is used outside MList, the user needs to
invoke item->grabGesture(Qt::TapAndHoldGesture) to start
- receiving longTapped() signal.
+ receiving longTapped() signal. You might also be interested in
+ using cancel event with that gesture, please see also
+ MWidget::grabGestureWithCancelPolicy() method.
+
+ \sa MWidget::grabGestureWithCancelPolicy.
*/
void longTap(const QPointF &pos);
diff --git a/src/corelib/widgets/mlabel.cpp b/src/corelib/widgets/mlabel.cpp
index 8b80b106..514c9d6a 100644
--- a/src/corelib/widgets/mlabel.cpp
+++ b/src/corelib/widgets/mlabel.cpp
@@ -32,13 +32,13 @@ M_REGISTER_WIDGET(MLabel)
MLabel::MLabel(QGraphicsItem *parent, MLabelModel *model) :
MWidgetController(new MLabelPrivate, model == NULL ? new MLabelModel : model, parent)
{
- grabGesture(Qt::TapAndHoldGesture, Qt::GestureFlags(), MWidget::MouseEventCancelOnGestureFinished);
+ grabGestureWithCancelPolicy(Qt::TapAndHoldGesture, Qt::GestureFlags(), MWidget::MouseEventCancelOnGestureFinished);
}
MLabel::MLabel(QString const &text, QGraphicsItem *parent) :
MWidgetController(new MLabelPrivate, new MLabelModel, parent)
{
- grabGesture(Qt::TapAndHoldGesture, Qt::GestureFlags(), MWidget::MouseEventCancelOnGestureFinished);
+ grabGestureWithCancelPolicy(Qt::TapAndHoldGesture, Qt::GestureFlags(), MWidget::MouseEventCancelOnGestureFinished);
setText(text);
}
diff --git a/src/corelib/widgets/mlistitem.cpp b/src/corelib/widgets/mlistitem.cpp
index 5283ec77..c3935734 100644
--- a/src/corelib/widgets/mlistitem.cpp
+++ b/src/corelib/widgets/mlistitem.cpp
@@ -37,7 +37,7 @@ void MListItemPrivate::updateLongTapConnections()
{
Q_Q(MListItem);
if (q->receivers(SIGNAL(longTapped(QPointF))) > 0)
- q->grabGesture(Qt::TapAndHoldGesture, Qt::GestureFlags(), MWidget::MouseEventCancelOnGestureFinished);
+ q->grabGestureWithCancelPolicy(Qt::TapAndHoldGesture, Qt::GestureFlags(), MWidget::MouseEventCancelOnGestureFinished);
else
q->ungrabGesture(Qt::TapAndHoldGesture);
}
diff --git a/src/corelib/widgets/mpannablewidget.cpp b/src/corelib/widgets/mpannablewidget.cpp
index a2e889a8..e6e27371 100644
--- a/src/corelib/widgets/mpannablewidget.cpp
+++ b/src/corelib/widgets/mpannablewidget.cpp
@@ -83,7 +83,7 @@ void MPannableWidgetPrivate::init()
glass->setObjectName("glass");
glass->grabGesture(Qt::TapAndHoldGesture);
- q->grabGesture(Qt::PanGesture, Qt::GestureFlags(), MWidget::MouseEventCancelOnGestureStarted);
+ q->grabGestureWithCancelPolicy(Qt::PanGesture, Qt::GestureFlags(), MWidget::MouseEventCancelOnGestureStarted);
q->setPosition(QPointF());
q->setRange(QRectF());