Showing the changes to libraries/script-engine/src/TabletScriptingInterface.cpp (1 of 4 files). Show all
Unified · Split
| @@ -121,6 +121,21 @@ void TabletButtonProxy::setQmlButton(QQuickItem* qmlButton) { · 120 unmodified lines | ||
| 121 | 121 | _qmlButton = qmlButton; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | −// TABLET_UI_HACK TODO: add property accessors, and forward property changes to the _qmlButton if present. | |
| 124 | +QVariantMap TabletButtonProxy::getProperties() const { | |
| 125 | + std::lock_guard<std::mutex> guard(_mutex); | |
| 126 | + return _properties; | |
| 127 | +} | |
| 128 | + | |
| 129 | +void TabletButtonProxy::editProperties(QVariantMap properties) { | |
| 130 | + std::lock_guard<std::mutex> guard(_mutex); | |
| 131 | + QVariantMap::const_iterator iter = properties.constBegin(); | |
| 132 | + while (iter != properties.constEnd()) { | |
| 133 | + _properties[iter.key()] = iter.value(); | |
| 134 | + if (_qmlButton) { | |
| 135 | + QMetaObject::invokeMethod(_qmlButton, "changeProperty", Qt::AutoConnection, Q_ARG(QVariant, QVariant(iter.key())), Q_ARG(QVariant, iter.value())); | |
| 136 | + } | |
| 137 | + ++iter; | |
| 138 | + } | |
| 139 | +} | |
| 125 | 140 | |
| 126 | 141 | #include "TabletScriptingInterface.moc" |