aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobin Burchell <robin+qt@viroteck.net>2012-12-14 18:19:07 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-08 03:17:37 +0100
commitfd4c5b6e1c4ef488e827a1610fd62e1105373a13 (patch)
treea9abe03a704b749b7b6aa72960a221fb421296ac /src
parentc280d67864dbef12c490380c29e03d5b18c102f1 (diff)
Deinline QQuickKeysAttached::keyToSignal.
This also means we don't need to expose the SigMap struct or value - it can be made file-local. This isn't performance-critical, so it shouldn't really matter. Change-Id: I08d48df4f903df49a6ea58e6f10f3f53a97d89de Reviewed-by: Martin Jones <martin.jones@jollamobile.com>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquickitem.cpp22
-rw-r--r--src/quick/items/qquickitem_p.h21
2 files changed, 22 insertions, 21 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 6668cb72c5..3af378dd84 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -739,7 +739,12 @@ void QQuickKeyNavigationAttached::setFocusNavigation(QQuickItem *currentItem, co
while (currentItem != initialItem && isNextItem);
}
-const QQuickKeysAttached::SigMap QQuickKeysAttached::sigMap[] = {
+struct SigMap {
+ int key;
+ const char *sig;
+};
+
+const SigMap sigMap[] = {
{ Qt::Key_Left, "leftPressed" },
{ Qt::Key_Right, "rightPressed" },
{ Qt::Key_Up, "upPressed" },
@@ -771,6 +776,21 @@ const QQuickKeysAttached::SigMap QQuickKeysAttached::sigMap[] = {
{ 0, 0 }
};
+const QByteArray QQuickKeysAttached::keyToSignal(int key)
+{
+ QByteArray keySignal;
+ if (key >= Qt::Key_0 && key <= Qt::Key_9) {
+ keySignal = "digit0Pressed";
+ keySignal[5] = '0' + (key - Qt::Key_0);
+ } else {
+ int i = 0;
+ while (sigMap[i].key && sigMap[i].key != key)
+ ++i;
+ keySignal = sigMap[i].sig;
+ }
+ return keySignal;
+}
+
bool QQuickKeysAttached::isConnected(const char *signalName)
{
Q_D(QQuickKeysAttached);
diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h
index 804b10deac..10c7798ff6 100644
--- a/src/quick/items/qquickitem_p.h
+++ b/src/quick/items/qquickitem_p.h
@@ -819,28 +819,9 @@ private:
virtual void inputMethodEvent(QInputMethodEvent *, bool post);
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
#endif
- const QByteArray keyToSignal(int key) {
- QByteArray keySignal;
- if (key >= Qt::Key_0 && key <= Qt::Key_9) {
- keySignal = "digit0Pressed";
- keySignal[5] = '0' + (key - Qt::Key_0);
- } else {
- int i = 0;
- while (sigMap[i].key && sigMap[i].key != key)
- ++i;
- keySignal = sigMap[i].sig;
- }
- return keySignal;
- }
+ const QByteArray keyToSignal(int key);
bool isConnected(const char *signalName);
-
- struct SigMap {
- int key;
- const char *sig;
- };
-
- static const SigMap sigMap[];
};
Qt::MouseButtons QQuickItemPrivate::acceptedMouseButtons() const