Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Recommended solution to recover the value if user click on cancel
Forum Updated to NodeBB v4.3 + New Features

Recommended solution to recover the value if user click on cancel

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 1.9k Views 2 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.
  • thamT Offline
    thamT Offline
    tham
    wrote on last edited by
    #1

    Assume I have a dialog for users to setup their settings, if the users click ok button, the dialog should close and keep the value, if the users click cancel button, the value should revert to the value before users change the value.

    This is not difficult to do, but quite verbose, I have to save every value manually. Do Qt provide us some tools to make things easier to handle?Thanks

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      Do you use QSettings?

      Have a look at this example
      It uses QSettings and slots that do what you want.

      Eddy

      Qt Certified Specialist
      www.edalsolutions.be

      thamT 1 Reply Last reply
      3
      • EddyE Eddy

        Do you use QSettings?

        Have a look at this example
        It uses QSettings and slots that do what you want.

        Eddy

        thamT Offline
        thamT Offline
        tham
        wrote on last edited by
        #3

        @Eddy said in Recommended solution to recover the value if user click on cancel:

        Do you use QSettings?

        Have a look at this example
        It uses QSettings and slots that do what you want.

        Eddy

        Yap, I use it to mange lots of options before(github), wonder are there exist better way to manage the value of this kind of task.

        options pics

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi
          Just so I understand. When user click Cancel, the dialog stays open and the widgets resets the state ?

          Normally I wait until Ok is pressed to save, so when user press Cancel, i simply just close dialog.

          Sounds like your use case is different ?

          thamT 1 Reply Last reply
          3
          • mrjjM mrjj

            Hi
            Just so I understand. When user click Cancel, the dialog stays open and the widgets resets the state ?

            Normally I wait until Ok is pressed to save, so when user press Cancel, i simply just close dialog.

            Sounds like your use case is different ?

            thamT Offline
            thamT Offline
            tham
            wrote on last edited by
            #5

            @mrjj Same as your use cases

            1 Reply Last reply
            0
            • EddyE Offline
              EddyE Offline
              Eddy
              wrote on last edited by
              #6
              Same as your use cases
              

              Then you're on the right track!

              Please mark this topic as solved if you have no other doubts.

              Qt Certified Specialist
              www.edalsolutions.be

              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