Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QQmlPropertyMap update from c++ not reflected in gui



  • Dear Specialists,

    I have:

    defined static var:
    QQmlPropertyMap MasterParameter::theMasterParameterMap;

    set up and registered:
    theMasterParameterMap["AutoLogoffText"] = "";
    theEngine->rootContext()->setContextProperty(APPLICATION_NAME,&theMasterParameterMap);

    used:
    Label
    {
    text: KompliKat.AutoLogoffText
    color: KompliKat.FontHighLightColor
    anchors.centerIn: parent
    }

    And:
    This works perfectly!

    But:
    But when I update the value from a QTimer callback in c++:

    MasterParameter::theMasterParameterMap["AutoLogoffText"] = <<< QString from SQL query >>>;

    the qml front end does not display the new value.

    The documentation states, that:
    The binding is dynamic - whenever a key's value is updated, anything bound to that key will be updated as well.

    Am I missing something here? How can I get this to work?
    I cannot for the life of me figure out what the Problem is here :-(
    Any hints are greatly appreciated! Thank you for your time!

    Marc


Log in to reply