If I understand you correctly, and I probably don't, the skin component
Skin {
signal skinPropertyChanged();
property color accentucationColor: "red"
onAccentucationColorChanged: skinPropertyChanged()
}
SkinManager {// exposed C++ class
id:skinManager
property var currentSkin: null;
onCurrrentSkinChanged: updateSkin(); // handle when the skin switches
}
Connections {
target: currentSkin
onSkinPropertyChanged: id:skinManager.updateSkin() // handle when propterties of the skin change.
}
Will that work?
Sent: Tuesday, August 23, 2016 at 1:12 PM
From: "Xavier Bigand" <flamaros.xav...@gmail.com>
To: interest@qt-project.org
Subject: [Interest] Force property's binding to be executed from C++
From: "Xavier Bigand" <flamaros.xav...@gmail.com>
To: interest@qt-project.org
Subject: [Interest] Force property's binding to be executed from C++
Hi,
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interestTo skin our GUI we have a dedicated qml component instanced once that contains all necessary values under properties.
I am able to access to those properties from C++ code but they aren't correctly synchronized with the selected skin.
Here is my cpp code :
void SkinManagerWrapper::updateSkin() const
{QObject* skinItem = mRootObject->findChild<QObject*>("hdGUI", Qt::FindDirectChildrenOnly);
core::SkinManager* skinManager = core::SkinManager::singleton();// GeneralskinManager->accentuationColor = convert(skinItem->property("accentuationColor").value<QColor>()); // skinManager->accentuationColor is actually a cpp property ;-)
}
The property method return the previous value before the execution of the binding, because in the qml binding the value is depending of the selected skin.
As workaround I am trying to create a qml property that depend of all properties of our skin component ("HomeDesignSkins"), but If it is possible to retrieve dynamically properties names of the component, I can't figure out retrieving values of properties by string names.
The Idea is to be able to use the onChanged signal of this property to invoke my cpp updateSkin method, this should resolve dependency order issue.
Maybe their is an other way to do it, else I am searching to way to retrieve property values in qml from their names.
--
Xavier
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest