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 wrapped
QtWS25 Last Chance

QSpinbox wrapped

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 351 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.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by Perdrix
    #1

    Is there an easy way to detect that a spin box value has wrapped and in which direction it has wrapped?

    Can valueChanged() be pressed into service to detect this?

    S JonBJ 2 Replies Last reply
    0
    • PerdrixP Perdrix

      Is there an easy way to detect that a spin box value has wrapped and in which direction it has wrapped?

      Can valueChanged() be pressed into service to detect this?

      S Offline
      S Offline
      SamiV123
      wrote on last edited by
      #2

      @Perdrix

      Keep the previous value and compare the new value when change is signalled?

      If prev value == max() and new value is less then it went from max to min,
      if prev value == min and new value is greater then it went from min t o max

      or am I incorrect?

      PerdrixP 1 Reply Last reply
      0
      • S SamiV123

        @Perdrix

        Keep the previous value and compare the new value when change is signalled?

        If prev value == max() and new value is less then it went from max to min,
        if prev value == min and new value is greater then it went from min t o max

        or am I incorrect?

        PerdrixP Offline
        PerdrixP Offline
        Perdrix
        wrote on last edited by
        #3

        @SamiV123 Yes, that would work I guess - was hoping for a signal or event that was already implemented.

        Christian EhrlicherC 1 Reply Last reply
        0
        • PerdrixP Perdrix

          @SamiV123 Yes, that would work I guess - was hoping for a signal or event that was already implemented.

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Perdrix said in QSpinbox wrapped:

          was hoping for a signal or event that was already implemented.

          So why not simply looking in the documentation then?

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          PerdrixP 1 Reply Last reply
          0
          • PerdrixP Perdrix

            Is there an easy way to detect that a spin box value has wrapped and in which direction it has wrapped?

            Can valueChanged() be pressed into service to detect this?

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #5

            @Perdrix said in QSpinbox wrapped:

            Is there an easy way to detect that a spin box value has wrapped and in which direction it has wrapped?

            I think I would actually most likely do this by subclassing and overriding void QAbstractSpinBox::stepBy(int steps). That feels like the correct level to recognise the situation from all the applicable inputs, and not mistakenly act on setValue() from code.

            PerdrixP 1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              @Perdrix said in QSpinbox wrapped:

              was hoping for a signal or event that was already implemented.

              So why not simply looking in the documentation then?

              PerdrixP Offline
              PerdrixP Offline
              Perdrix
              wrote on last edited by
              #6

              @Christian-Ehrlicher I did look but didn't see an easy way to do that - which is why I asked.

              1 Reply Last reply
              0
              • JonBJ JonB

                @Perdrix said in QSpinbox wrapped:

                Is there an easy way to detect that a spin box value has wrapped and in which direction it has wrapped?

                I think I would actually most likely do this by subclassing and overriding void QAbstractSpinBox::stepBy(int steps). That feels like the correct level to recognise the situation from all the applicable inputs, and not mistakenly act on setValue() from code.

                PerdrixP Offline
                PerdrixP Offline
                Perdrix
                wrote on last edited by
                #7

                @JonB Thank you I can see that could work well.

                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