History

Support for the ablity to change button properties from js.

Anthony J. Thibault committed 9 years ago

Commit 5441d331 parent 0add5274 files · +45 −2Browse files

Showing the changes to libraries/script-engine/src/TabletScriptingInterface.cpp (1 of 4 files). Show all

Unified · Split

libraries/script-engine/src/TabletScriptingInterface.cpp+16−1
@@ -121,6 +121,21 @@ void TabletButtonProxy::setQmlButton(QQuickItem* qmlButton) { · 120 unmodified lines
121 _qmlButton = qmlButton;121 _qmlButton = qmlButton;
122}122}
123 123
124// TABLET_UI_HACK TODO: add property accessors, and forward property changes to the _qmlButton if present.124QVariantMap TabletButtonProxy::getProperties() const {
125 std::lock_guard<std::mutex> guard(_mutex);
126 return _properties;
127}
128
129void 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#include "TabletScriptingInterface.moc"141#include "TabletScriptingInterface.moc"