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. [SOLVED] Is there a way to detect changes in fields at application runtime?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Is there a way to detect changes in fields at application runtime?

Scheduled Pinned Locked Moved General and Desktop
10 Posts 4 Posters 2.7k 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.
  • S Offline
    S Offline
    sharon_obl82
    wrote on last edited by
    #1

    Hi, is there a way to detect changes to widgets such as lineedit,radiobutton,combobox etc during runtime?
    Thanks

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      What kind of changes ?

      157

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sharon_obl82
        wrote on last edited by
        #3

        detect changes just as change in a lineedit field or radio button, then prompt a dialog box asking if user wants to save changes

        1 Reply Last reply
        0
        • p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          AFAIK, No, you need to do that explicitly.

          157

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sharon_obl82
            wrote on last edited by
            #5

            ermm like how? could you please help to elaborate more?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              You can use a dirty flag that you'll check e.g. when the user closes your UI. You'll need to create a slot for that that and connect your various input widget to it. The signal you'll need to use will depend on the widget.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • B Offline
                B Offline
                butterface
                wrote on last edited by
                #7

                You can directly get notified about changes through the signal/slot mechanism. You can listen to a focus lost event of components as well which does not directly indicate a change but you can check that yourself.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  sharon_obl82
                  wrote on last edited by
                  #8

                  hi SGaist, could you help to explain more on the 'dirty flag'? Is there an example I can take a look at? Thank you.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Have a boolean member in you class called e.g. _dirty that is originally set to false and that you set to true when one of your input changes. Don't forget to reset it when appropriate.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      sharon_obl82
                      wrote on last edited by
                      #10

                      thanks very much!

                      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