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. How to clear Settings (QtCore) from inside QML?
Forum Updated to NodeBB v4.3 + New Features

How to clear Settings (QtCore) from inside QML?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 369 Views
  • 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.
  • N Offline
    N Offline
    Ntachy
    wrote on last edited by Ntachy
    #1

    Each time I open my app, the Settings component reads saved values from the registry (or so I think). How can I reset all the values that are saved there? So it would work like "Revert to default" in other applications.

    It's based on QSettings which has clear() method though I can't call it from inside QML (such method is just not defined)

    N 1 Reply Last reply
    0
    • N Ntachy

      Each time I open my app, the Settings component reads saved values from the registry (or so I think). How can I reset all the values that are saved there? So it would work like "Revert to default" in other applications.

      It's based on QSettings which has clear() method though I can't call it from inside QML (such method is just not defined)

      N Offline
      N Offline
      Ntachy
      wrote on last edited by
      #2

      @Ntachy I forgot its a dead forum but anyway... I temporarily fixed it by accessing QSettings in the Python backend and clearing it there.

      johngodJ 1 Reply Last reply
      0
      • N Ntachy

        @Ntachy I forgot its a dead forum but anyway... I temporarily fixed it by accessing QSettings in the Python backend and clearing it there.

        johngodJ Offline
        johngodJ Offline
        johngod
        wrote on last edited by
        #3

        @Ntachy I did this by creating my own clear function (I name it reset() ), where I set all the properties to their default values. In my case I had a button where the user would click to reset the values, dont know your use case, where you would called it is up to you.
        If you want to clear the values "outside" the running app, check here for where the values are stored:
        https://doc.qt.io/qt-6/qsettings.html#platform-specific-notes

        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