summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-04-19 21:16:47 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-23 23:26:44 +0200
commitf02e1d6d8e0ee560667b445e8fa43bde85e31f41 (patch)
tree4b2e41ee46545434e13cc32fc8e87d0be6cd64e8 /src/widgets
parentd631c31235dc3ab682ba5d4cbb466680d47b36f2 (diff)
Move QGestureEventPrivate's content to the main class
QEvent now checks that the d pointer is unused. Change-Id: Ib0aa97d1692ea55324c4c6f133ffdd5a221f1680 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kernel/qapplication.cpp4
-rw-r--r--src/widgets/kernel/qgesture.cpp42
-rw-r--r--src/widgets/kernel/qgesture.h6
-rw-r--r--src/widgets/kernel/qgesture_p.h13
-rw-r--r--src/widgets/kernel/qgesturemanager.cpp4
5 files changed, 20 insertions, 49 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index ee4f9bd6bb..f672aef0eb 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -3523,7 +3523,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
ge.t = gestureEvent->t;
ge.spont = gestureEvent->spont;
ge.m_accept = wasAccepted;
- ge.d_func()->accepted = gestureEvent->d_func()->accepted;
+ ge.m_accepted = gestureEvent->m_accepted;
res = d->notify_helper(w, &ge);
gestureEvent->spont = false;
eventAccepted = ge.isAccepted();
@@ -3533,7 +3533,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
// packed into a single QEvent depends on not consuming the event
if (eventAccepted || ge.isAccepted(g)) {
// if the gesture was accepted, mark the target widget for it
- gestureEvent->d_func()->targetWidgets[g->gestureType()] = w;
+ gestureEvent->m_targetWidgets[g->gestureType()] = w;
gestureEvent->setAccepted(g, true);
} else {
// if the gesture was explicitly ignored by the application,
diff --git a/src/widgets/kernel/qgesture.cpp b/src/widgets/kernel/qgesture.cpp
index 070af65c70..4f899e5644 100644
--- a/src/widgets/kernel/qgesture.cpp
+++ b/src/widgets/kernel/qgesture.cpp
@@ -846,9 +846,9 @@ int QTapAndHoldGesturePrivate::Timeout = 700; // in ms
Creates new QGestureEvent containing a list of \a gestures.
*/
QGestureEvent::QGestureEvent(const QList<QGesture *> &gestures)
- : QEvent(QEvent::Gesture)
+ : QEvent(QEvent::Gesture), m_gestures(gestures), m_widget(0)
+
{
- d = reinterpret_cast<QEventPrivate *>(new QGestureEventPrivate(gestures));
}
/*!
@@ -856,7 +856,6 @@ QGestureEvent::QGestureEvent(const QList<QGesture *> &gestures)
*/
QGestureEvent::~QGestureEvent()
{
- delete reinterpret_cast<QGestureEventPrivate *>(d);
}
/*!
@@ -864,7 +863,7 @@ QGestureEvent::~QGestureEvent()
*/
QList<QGesture *> QGestureEvent::gestures() const
{
- return d_func()->gestures;
+ return m_gestures;
}
/*!
@@ -872,10 +871,9 @@ QList<QGesture *> QGestureEvent::gestures() const
*/
QGesture *QGestureEvent::gesture(Qt::GestureType type) const
{
- const QGestureEventPrivate *d = d_func();
- for(int i = 0; i < d->gestures.size(); ++i)
- if (d->gestures.at(i)->gestureType() == type)
- return d->gestures.at(i);
+ for (int i = 0; i < m_gestures.size(); ++i)
+ if (m_gestures.at(i)->gestureType() == type)
+ return m_gestures.at(i);
return 0;
}
@@ -885,7 +883,7 @@ QGesture *QGestureEvent::gesture(Qt::GestureType type) const
QList<QGesture *> QGestureEvent::activeGestures() const
{
QList<QGesture *> gestures;
- foreach (QGesture *gesture, d_func()->gestures) {
+ foreach (QGesture *gesture, m_gestures) {
if (gesture->state() != Qt::GestureCanceled)
gestures.append(gesture);
}
@@ -898,7 +896,7 @@ QList<QGesture *> QGestureEvent::activeGestures() const
QList<QGesture *> QGestureEvent::canceledGestures() const
{
QList<QGesture *> gestures;
- foreach (QGesture *gesture, d_func()->gestures) {
+ foreach (QGesture *gesture, m_gestures) {
if (gesture->state() == Qt::GestureCanceled)
gestures.append(gesture);
}
@@ -980,7 +978,7 @@ bool QGestureEvent::isAccepted(QGesture *gesture) const
void QGestureEvent::setAccepted(Qt::GestureType gestureType, bool value)
{
setAccepted(false);
- d_func()->accepted[gestureType] = value;
+ m_accepted[gestureType] = value;
}
/*!
@@ -1017,7 +1015,7 @@ void QGestureEvent::ignore(Qt::GestureType gestureType)
*/
bool QGestureEvent::isAccepted(Qt::GestureType gestureType) const
{
- return d_func()->accepted.value(gestureType, true);
+ return m_accepted.value(gestureType, true);
}
/*!
@@ -1027,7 +1025,7 @@ bool QGestureEvent::isAccepted(Qt::GestureType gestureType) const
*/
void QGestureEvent::setWidget(QWidget *widget)
{
- d_func()->widget = widget;
+ m_widget = widget;
}
/*!
@@ -1035,7 +1033,7 @@ void QGestureEvent::setWidget(QWidget *widget)
*/
QWidget *QGestureEvent::widget() const
{
- return d_func()->widget;
+ return m_widget;
}
#ifndef QT_NO_GRAPHICSVIEW
@@ -1062,22 +1060,6 @@ QPointF QGestureEvent::mapToGraphicsScene(const QPointF &gesturePoint) const
}
#endif //QT_NO_GRAPHICSVIEW
-/*!
- \internal
-*/
-QGestureEventPrivate *QGestureEvent::d_func()
-{
- return reinterpret_cast<QGestureEventPrivate *>(d);
-}
-
-/*!
- \internal
-*/
-const QGestureEventPrivate *QGestureEvent::d_func() const
-{
- return reinterpret_cast<const QGestureEventPrivate *>(d);
-}
-
#ifdef Q_NO_USING_KEYWORD
/*!
\fn void QGestureEvent::setAccepted(bool accepted)
diff --git a/src/widgets/kernel/qgesture.h b/src/widgets/kernel/qgesture.h
index 5e121def41..ec5048089d 100644
--- a/src/widgets/kernel/qgesture.h
+++ b/src/widgets/kernel/qgesture.h
@@ -310,8 +310,10 @@ public:
#endif
private:
- QGestureEventPrivate *d_func();
- const QGestureEventPrivate *d_func() const;
+ QList<QGesture *> m_gestures;
+ QWidget *m_widget;
+ QMap<Qt::GestureType, bool> m_accepted;
+ QMap<Qt::GestureType, QWidget *> m_targetWidgets;
friend class QApplication;
friend class QGestureManager;
diff --git a/src/widgets/kernel/qgesture_p.h b/src/widgets/kernel/qgesture_p.h
index ceccf17a6c..85793f6f7f 100644
--- a/src/widgets/kernel/qgesture_p.h
+++ b/src/widgets/kernel/qgesture_p.h
@@ -222,19 +222,6 @@ public:
#endif
};
-class QGestureEventPrivate
-{
-public:
- inline QGestureEventPrivate(const QList<QGesture *> &list)
- : gestures(list), widget(0)
- {
- }
-
- QList<QGesture *> gestures;
- QWidget *widget;
- QMap<Qt::GestureType, bool> accepted;
- QMap<Qt::GestureType, QWidget *> targetWidgets;
-};
#endif // QT_NO_GESTURES
diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp
index f4bf667ef8..8ba8904684 100644
--- a/src/widgets/kernel/qgesturemanager.cpp
+++ b/src/widgets/kernel/qgesturemanager.cpp
@@ -660,7 +660,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
bool eventAccepted = event.isAccepted();
foreach(QGesture *gesture, event.gestures()) {
if (eventAccepted || event.isAccepted(gesture)) {
- QWidget *w = event.d_func()->targetWidgets.value(gesture->gestureType(), 0);
+ QWidget *w = event.m_targetWidgets.value(gesture->gestureType(), 0);
Q_ASSERT(w);
DEBUG() << "override event: gesture was accepted:" << gesture << w;
QList<QGesture *> &gestures = normalStartedGestures[w];
@@ -687,7 +687,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
foreach (QGesture *gesture, event.gestures()) {
if (gesture->state() == Qt::GestureStarted &&
(eventAccepted || event.isAccepted(gesture))) {
- QWidget *w = event.d_func()->targetWidgets.value(gesture->gestureType(), 0);
+ QWidget *w = event.m_targetWidgets.value(gesture->gestureType(), 0);
Q_ASSERT(w);
DEBUG() << "started gesture was delivered and accepted by" << w;
m_gestureTargets[gesture] = w;