Important: Please read the Qt Code of Conduct -

QML Persist user preferences

  • I see QML Settings is a lab / experimental. Can I assume that so would any solution for user control preference / persistence?

    I'd like my application to remember if someone turned something on or off, activated a ListView item, colors etc. I have this all working however it needs re configuring each startup.

    Do we have to roll our own. I'd thing QSettings is the way to go but how do I identify a unique instance for a dynamic control. I suppose I'd have to persist the metadata on how to recreate the control also?

    I'd like to in the very near future also enable drag-gable controls so they can be re-positioned at least within an gridview / layout by index but ideally snap and resizing and then persist between application or engine starts.

    I might be thinking aloud a bit - I have a feeling I'm on my own but hey, if anyone has had experience persisting preferences I'd love to have ideas outside of my own.

  • Maybe a better way to explain my situation would be:
    I'm using QML ChartView(s), that's what I'd like. So let's say a basic structure of:

    • Main.qml
      • SomePage.qml
        • ChartFile.qml
      • AllCharts.qml
        • ChartFile.qml
        • ADifferentChartFile.qml

    How would you uniquely identify the control / have it aware so that it will only persist it's instances' legend/series selections? I think I know what I have to do (roll my own for my situation( but ... if I don't have to that'd be great.

Log in to reply