Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Saving/Loading properties to/from settings file

Saving/Loading properties to/from settings file

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MichK
    wrote on last edited by
    #1

    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??

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MichK
      wrote on last edited by
      #2

      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
              }
      

      @

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved