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. QSpinBox repeated characters
Forum Updated to NodeBB v4.3 + New Features

QSpinBox repeated characters

Scheduled Pinned Locked Moved General and Desktop
10 Posts 2 Posters 2.1k 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.
  • R Offline
    R Offline
    RogueWarrior
    wrote on last edited by
    #1

    I'm working with QSpinBoxes (or QDoubleSpinBoxes) and I'm finding that I often get keyboard inputs repeated. E.g. I type 5 and I get 55 in the box. At first I thought it was because I'm not calling processEvents in other parts of the program but that doesn't appear to help. Any ideas?

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

      Hi,

      What do you mean by "At first I thought it was because I’m not calling processEvents in other parts of the program" ?

      What is your software doing ?

      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
      • R Offline
        R Offline
        RogueWarrior
        wrote on last edited by
        #3

        Originally, my main() had a fairly tight loop and I had this problem. I've since subclassed QApplication and I'm calling this loop off a one-shot timer. (I read about this method somewhere) Inside the slot called by the timer I call processEvents inside this tight loop. That doesn't seem to solve it though.

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

          What does that loop do ?

          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
          • R Offline
            R Offline
            RogueWarrior
            wrote on last edited by
            #5

            Polls a joystick. Runs a PID controller. Talks to a motor controller. Repeat.

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

              Sounds like it should rather run in its own thread

              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
              • R Offline
                R Offline
                RogueWarrior
                wrote on last edited by
                #7

                Well, everything else runs well except for edit boxes.

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

                  Do you mean that it also happen with other widgets containing QLineEdit ?

                  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
                  • R Offline
                    R Offline
                    RogueWarrior
                    wrote on last edited by
                    #9

                    Yes. I put the joystick code in its own thread and that seems to have fixed it but I'm not sure. I thought I had fixed it once before too.

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

                      Depending on your loop size and speed, processEvents might not get called enough to be really helpful.

                      Using a secondary thread in this case is a better solution.

                      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

                      • Login

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