summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>2012-05-22 10:44:48 +0300
committerQt by Nokia <qt-info@nokia.com>2012-05-22 20:56:38 +0200
commit0390b02a7fdf96dc8b403e4634f62bf0a08ab94d (patch)
tree3534105b09ebcdefbd4b828e0060ea8c8eb74484 /src/gui/kernel
parentb1f12913a6acc48dc566ae5cf06ba640765d7ba5 (diff)
Add mouse event internal members needed by declarative
In order to remove QQuickMouseEventEx we have to be able to store touch-related data, like capabilities and velocity, also in mouse events. However they should not be exposed through the public API in any way. (at least not in 5.0) Change-Id: I7774b9ea00074950208559463249fbdcaeeaefbf Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qevent.cpp6
-rw-r--r--src/gui/kernel/qevent.h4
-rw-r--r--src/gui/kernel/qguiapplication.cpp23
-rw-r--r--src/gui/kernel/qguiapplication_p.h5
4 files changed, 35 insertions, 3 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index beb75308b3..2181d06734 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -161,7 +161,7 @@ QInputEvent::~QInputEvent()
*/
QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, Qt::MouseButton button,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
- : QInputEvent(type, modifiers), l(localPos), w(localPos), b(button), mouseState(buttons)
+ : QInputEvent(type, modifiers), l(localPos), w(localPos), b(button), mouseState(buttons), caps(0)
{
s = QCursor::pos();
}
@@ -188,7 +188,7 @@ QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, Qt::MouseButton but
QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, const QPointF &screenPos,
Qt::MouseButton button, Qt::MouseButtons buttons,
Qt::KeyboardModifiers modifiers)
- : QInputEvent(type, modifiers), l(localPos), w(localPos), s(screenPos), b(button), mouseState(buttons)
+ : QInputEvent(type, modifiers), l(localPos), w(localPos), s(screenPos), b(button), mouseState(buttons), caps(0)
{}
/*!
@@ -211,7 +211,7 @@ QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, const QPointF &scre
QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos,
Qt::MouseButton button, Qt::MouseButtons buttons,
Qt::KeyboardModifiers modifiers)
- : QInputEvent(type, modifiers), l(localPos), w(windowPos), s(screenPos), b(button), mouseState(buttons)
+ : QInputEvent(type, modifiers), l(localPos), w(windowPos), s(screenPos), b(button), mouseState(buttons), caps(0)
{}
/*!
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 96e630ed0a..de80d19fe6 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -119,6 +119,10 @@ protected:
QPointF l, w, s;
Qt::MouseButton b;
Qt::MouseButtons mouseState;
+ int caps;
+ QVector2D velocity;
+
+ friend class QGuiApplicationPrivate;
};
class Q_GUI_EXPORT QHoverEvent : public QInputEvent
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 570f3f7f3f..4e4bc13f12 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2387,6 +2387,29 @@ void QGuiApplicationPrivate::q_updateFocusObject(QObject *object)
emit q->focusObjectChanged(object);
}
+int QGuiApplicationPrivate::mouseEventCaps(QMouseEvent *event)
+{
+ return event->caps;
+}
+
+QVector2D QGuiApplicationPrivate::mouseEventVelocity(QMouseEvent *event)
+{
+ return event->velocity;
+}
+
+void QGuiApplicationPrivate::setMouseEventCapsAndVelocity(QMouseEvent *event, int caps, const QVector2D &velocity)
+{
+ event->caps = caps;
+ event->velocity = velocity;
+}
+
+void QGuiApplicationPrivate::setMouseEventCapsAndVelocity(QMouseEvent *event, QMouseEvent *other)
+{
+ event->caps = other->caps;
+ event->velocity = other->velocity;
+}
+
+
#include "moc_qguiapplication.cpp"
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index bab3ecc997..d40f61d13b 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -212,6 +212,11 @@ public:
};
QHash<QWindow *, SynthesizedMouseData> synthesizedMousePoints;
+ static int mouseEventCaps(QMouseEvent *event);
+ static QVector2D mouseEventVelocity(QMouseEvent *event);
+ static void setMouseEventCapsAndVelocity(QMouseEvent *event, int caps, const QVector2D &velocity);
+ static void setMouseEventCapsAndVelocity(QMouseEvent *event, QMouseEvent *other);
+
const QDrawHelperGammaTables *gammaTables();
// hook reimplemented in QApplication to apply the QStyle function on the QIcon