summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qevent.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-04-04 15:36:21 -0300
committerQt by Nokia <qt-info@nokia.com>2012-04-05 05:21:42 +0200
commite915d310107878a12652dc77a2a1f8dbb9c98972 (patch)
tree6316ba1dae8b5f546d3f67f9f7f9cd1490fe456f /src/gui/kernel/qevent.h
parent8c4a17aace015964674d93046776abcb75ef2342 (diff)
Get rid of QKeyEventEx
This class was added when we needed more information in QKeyEvent but couldn't extend it. And we couldn't use the d pointer because the copy constructor and copy assignment operators in QEvent were implicit. That is now fixed. But since this is Qt 5, we can change QKeyEvent to include the extra information. Task-number: QTBUG-25070 Change-Id: Iba4ac3378ca70583fcaa8caf96bca8ef75e30701 Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
Diffstat (limited to 'src/gui/kernel/qevent.h')
-rw-r--r--src/gui/kernel/qevent.h30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 1642cd006b..7761bab944 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -243,6 +243,9 @@ class Q_GUI_EXPORT QKeyEvent : public QInputEvent
public:
QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text = QString(),
bool autorep = false, ushort count = 1);
+ QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
+ quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers,
+ const QString &text = QString(), bool autorep = false, ushort count = 1);
~QKeyEvent();
int key() const { return k; }
@@ -254,22 +257,35 @@ public:
inline bool isAutoRepeat() const { return autor; }
inline int count() const { return int(c); }
+ inline quint32 nativeScanCode() const { return nScanCode; }
+ inline quint32 nativeVirtualKey() const { return nVirtualKey; }
+ inline quint32 nativeModifiers() const { return nModifiers; }
+
// Functions for the extended key event information
- static QKeyEvent *createExtendedKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
+#if QT_DEPRECATED_SINCE(5, 0)
+ static inline QKeyEvent *createExtendedKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
quint32 nativeScanCode, quint32 nativeVirtualKey,
quint32 nativeModifiers,
const QString& text = QString(), bool autorep = false,
- ushort count = 1);
- inline bool hasExtendedInfo() const { return reinterpret_cast<const QKeyEvent*>(d) == this; }
- quint32 nativeScanCode() const;
- quint32 nativeVirtualKey() const;
- quint32 nativeModifiers() const;
+ ushort count = 1)
+ {
+ return new QKeyEvent(type, key, modifiers,
+ nativeScanCode, nativeVirtualKey, nativeModifiers,
+ text, autorep, count);
+ }
+
+ inline bool hasExtendedInfo() const { return true; }
+#endif
protected:
QString txt;
int k;
+ quint32 nScanCode;
+ quint32 nVirtualKey;
+ quint32 nModifiers;
ushort c;
- uint autor:1;
+ ushort autor:1;
+ // ushort reserved:15;
};