diff options
author | Jan Arve Saether <jan-arve.saether@theqtcompany.com> | 2014-10-28 09:59:23 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2014-10-28 10:08:39 +0100 |
commit | 94297b4ca50439d27dd5c3de6ff225185647cc46 (patch) | |
tree | 677601ce9023810bc62171901b70d8a7ca113d0e /src/quick/items | |
parent | df7f3141bddfd84590091612b271521a5d721a37 (diff) |
Do not crash QML apps on startup
This started crashing because of 8f6436f125faae91eb472ddddbbae06dba5da671
Task-number: QTBUG-42227
Change-Id: I9e4862f6008c6ad6ec54469f2b39dd6be583e422
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Diffstat (limited to 'src/quick/items')
-rw-r--r-- | src/quick/items/qquickaccessibleattached.cpp | 17 | ||||
-rw-r--r-- | src/quick/items/qquickaccessibleattached_p.h | 8 |
2 files changed, 16 insertions, 9 deletions
diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp index 38b26a53d0..abb763c2eb 100644 --- a/src/quick/items/qquickaccessibleattached.cpp +++ b/src/quick/items/qquickaccessibleattached.cpp @@ -292,10 +292,10 @@ QT_BEGIN_NAMESPACE The corresponding handler is \c onDecreaseAction. */ -const QMetaMethod QQuickAccessibleAttached::sigPress = QMetaMethod::fromSignal(&QQuickAccessibleAttached::pressAction); -const QMetaMethod QQuickAccessibleAttached::sigToggle = QMetaMethod::fromSignal(&QQuickAccessibleAttached::toggleAction); -const QMetaMethod QQuickAccessibleAttached::sigIncrease = QMetaMethod::fromSignal(&QQuickAccessibleAttached::increaseAction); -const QMetaMethod QQuickAccessibleAttached::sigDecrease = QMetaMethod::fromSignal(&QQuickAccessibleAttached::decreaseAction); +QMetaMethod QQuickAccessibleAttached::sigPress; +QMetaMethod QQuickAccessibleAttached::sigToggle; +QMetaMethod QQuickAccessibleAttached::sigIncrease; +QMetaMethod QQuickAccessibleAttached::sigDecrease; QQuickAccessibleAttached::QQuickAccessibleAttached(QObject *parent) : QObject(parent), m_role(QAccessible::NoRole) @@ -317,6 +317,13 @@ QQuickAccessibleAttached::QQuickAccessibleAttached(QObject *parent) if (!parent->property("cursorPosition").isNull()) { connect(parent, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged())); } + + if (!sigPress.isValid()) { + sigPress = QMetaMethod::fromSignal(&QQuickAccessibleAttached::pressAction); + sigToggle = QMetaMethod::fromSignal(&QQuickAccessibleAttached::toggleAction); + sigIncrease = QMetaMethod::fromSignal(&QQuickAccessibleAttached::increaseAction); + sigDecrease = QMetaMethod::fromSignal(&QQuickAccessibleAttached::decreaseAction); + } } QQuickAccessibleAttached::~QQuickAccessibleAttached() @@ -343,7 +350,7 @@ void QQuickAccessibleAttached::setIgnored(bool ignored) bool QQuickAccessibleAttached::doAction(const QString &actionName) { - const QMetaMethod *sig = 0; + QMetaMethod *sig = 0; if (actionName == QAccessibleActionInterface::pressAction()) sig = &sigPress; else if (actionName == QAccessibleActionInterface::toggleAction()) diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h index 53b1d2954d..ad6165f936 100644 --- a/src/quick/items/qquickaccessibleattached_p.h +++ b/src/quick/items/qquickaccessibleattached_p.h @@ -221,10 +221,10 @@ private: QString m_name; QString m_description; - static const QMetaMethod sigPress; - static const QMetaMethod sigToggle; - static const QMetaMethod sigIncrease; - static const QMetaMethod sigDecrease; + static QMetaMethod sigPress; + static QMetaMethod sigToggle; + static QMetaMethod sigIncrease; + static QMetaMethod sigDecrease; public: using QObject::property; |