Saving/Loading properties to/from settings file



  • Hi,

    I have following problem:
    I have Settings View which is made in QML. I want to set colours used in my application. Colour information and all settings are implemented as Q_PROPERTIES in C++ class. Settings are saved to a file.

    Is there any QML specific way to:
    Load data from file - set data in C++ object and in QML element
    Set data in QML element and C++ object.
    Save data to a file.

    I know about property binding and QML Binding element, but this probably
    not the solution.

    Maybe I should use normal functions instead of property binding??



  • My approach is following and it should work:
    appSettings is C++ object, representing application settings

    @
    id:minColorSelector
    ...
    property bool constructing: false

            onSelectedSchemaChanged: {
                console.log("constr " + constructing);
            }
    
            Component.onCompleted: {
                constructing = true
                minColorSelector.selectedSchema = appSettings.minMaxSelectedSchema()
                constructing = false
            }
    

    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.