diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-11-23 15:46:41 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-11-23 14:53:50 +0000 |
commit | 77fc9a38a271e589a228ac9d9a6644d47c6744e8 (patch) | |
tree | 6f8743ceb1f5f282c20284ced359c442c5446c5e /plugins/qmlprofiler/inputeventsmodel.cpp | |
parent | 8183d81c3e04234beb0e200897ad4dbe5d5c0ec6 (diff) |
Avoid using API introduced in Qt 5.5
Especially, QMetaEnum::fromType() and friends. Tracking which kinds of
messages were actually generated is better anyway, as we don't get
empty rows like this.
Change-Id: I23c560d9071c0ff5a33dff660e4dbb1552890df8
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'plugins/qmlprofiler/inputeventsmodel.cpp')
-rw-r--r-- | plugins/qmlprofiler/inputeventsmodel.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/plugins/qmlprofiler/inputeventsmodel.cpp b/plugins/qmlprofiler/inputeventsmodel.cpp index be610ee8b6..c788fd9893 100644 --- a/plugins/qmlprofiler/inputeventsmodel.cpp +++ b/plugins/qmlprofiler/inputeventsmodel.cpp @@ -63,6 +63,11 @@ QVariantList InputEventsModel::labels() const return result; } +QMetaEnum InputEventsModel::metaEnum(const char *name) +{ + return staticQtMetaObject.enumerator(staticQtMetaObject.indexOfEnumerator(name)); +} + QVariantMap InputEventsModel::details(int index) const { QVariantMap result; @@ -76,12 +81,11 @@ QVariantMap InputEventsModel::details(int index) const if (type.isEmpty()) type = tr("Key Release"); if (event.a != 0) { - result.insert(tr("Key"), QLatin1String( - QMetaEnum::fromType<Qt::Key>().valueToKey(event.a))); + result.insert(tr("Key"), QLatin1String(metaEnum("Key").valueToKey(event.a))); } if (event.b != 0) { - result.insert(tr("Modifiers"), QLatin1String( - QMetaEnum::fromType<Qt::KeyboardModifiers>().valueToKeys(event.b))); + result.insert(tr("Modifiers"), + QLatin1String(metaEnum("KeyboardModifiers").valueToKeys(event.b))); } break; case QmlDebug::InputMouseDoubleClick: @@ -92,10 +96,8 @@ QVariantMap InputEventsModel::details(int index) const case QmlDebug::InputMouseRelease: if (type.isEmpty()) type = tr("Mouse Release"); - result.insert(tr("Button"), QLatin1String( - QMetaEnum::fromType<Qt::MouseButtons>().valueToKey(event.a))); - result.insert(tr("Result"), QLatin1String( - QMetaEnum::fromType<Qt::MouseButtons>().valueToKeys(event.b))); + result.insert(tr("Button"), QLatin1String(metaEnum("MouseButtons").valueToKey(event.a))); + result.insert(tr("Result"), QLatin1String(metaEnum("MouseButtons").valueToKeys(event.b))); break; case QmlDebug::InputMouseMove: type = tr("Mouse Move"); |