[Interest] Force property's binding to be executed from C++

Xavier Bigand flamaros.xavier at gmail.com
Tue Aug 23 19:12:01 CEST 2016


Hi,

To 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();


        // General

        skinManager->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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160823/7d87c32e/attachment.html>


More information about the Interest mailing list