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 not allowing mouse presses to repeat
Forum Updated to NodeBB v4.3 + New Features

QSpinbox not allowing mouse presses to repeat

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 680 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.
  • Dummie1138D Offline
    Dummie1138D Offline
    Dummie1138
    wrote on last edited by
    #1

    Hi. Thank you for your patience with the relatively vague title, this is an issue that I can't quite explain in a sentence.

    I have a few QSpinBoxes. I have implemented the "setRange" functions within the QSpinBoxes' "on_valueChanged" slots, like so:

    #define VALIDTEMPRANGE 8
    void NewConfig::on_StartTemp_Input_valueChanged(int arg1){
        int startTemp = ui->StartTemp_Input->value();
        int endTemp = ui->FinalTemp_Input->value();
        int expectedFlashpt = ui->expFlashpt_Input->value();
        ui->StartTemp_Input->setMaximum(expectedFlashpt - 18);      //The sequence at which the parameters are changed is CRITICAL. Take a second to think about the sequence before change. -22K
        ui->expFlashpt_Input->setRange(startTemp+18, endTemp-VALIDTEMPRANGE);
        redraw_Barchart();
    }
    
    void NewConfig::on_FinalTemp_Input_valueChanged(int arg1){
        int startTemp = ui->StartTemp_Input->value();
        int endTemp = ui->FinalTemp_Input->value();
        int highFlashpt = ui->expFlashpt_Input->value()+VALIDTEMPRANGE;
        ui->FinalTemp_Input->setMinimum(highFlashpt);
        ui->expFlashpt_Input->setRange(startTemp+18, endTemp-VALIDTEMPRANGE);
        redraw_Barchart();
    }
    
    void NewConfig::on_expFlashpt_Input_valueChanged(int arg1){
        int startTemp = ui->StartTemp_Input->value();
        int endTemp = ui->FinalTemp_Input->value();
        int expectedFlashpt = ui->expFlashpt_Input->value();
        ui->expFlashpt_Input->setRange(startTemp+18, endTemp-VALIDTEMPRANGE);
        ui->StartTemp_Input->setMaximum(expectedFlashpt - 18);
        redraw_Barchart();
    }
    

    Since implementing the aforementioned code, I have not been able to hold down my mouse on the spinbox buttons to change the values within the QSpinboxes, but have had to manually mouseclick on the buttons every time if I wish to change it via spinbox buttons.

    I have tested it with other inputs such as with the keyboard arrow keys and the keyboard "page up/page down" button. I am not sure why this issue only affects mouse inputs.

    This code was implemented as the maximum and minimum values of the inputs would vary based on the value of the other QSpinboxes. Please let me know if more clarity or detail is required.

    M JonBJ 2 Replies Last reply
    0
    • Dummie1138D Dummie1138

      Hi. Thank you for your patience with the relatively vague title, this is an issue that I can't quite explain in a sentence.

      I have a few QSpinBoxes. I have implemented the "setRange" functions within the QSpinBoxes' "on_valueChanged" slots, like so:

      #define VALIDTEMPRANGE 8
      void NewConfig::on_StartTemp_Input_valueChanged(int arg1){
          int startTemp = ui->StartTemp_Input->value();
          int endTemp = ui->FinalTemp_Input->value();
          int expectedFlashpt = ui->expFlashpt_Input->value();
          ui->StartTemp_Input->setMaximum(expectedFlashpt - 18);      //The sequence at which the parameters are changed is CRITICAL. Take a second to think about the sequence before change. -22K
          ui->expFlashpt_Input->setRange(startTemp+18, endTemp-VALIDTEMPRANGE);
          redraw_Barchart();
      }
      
      void NewConfig::on_FinalTemp_Input_valueChanged(int arg1){
          int startTemp = ui->StartTemp_Input->value();
          int endTemp = ui->FinalTemp_Input->value();
          int highFlashpt = ui->expFlashpt_Input->value()+VALIDTEMPRANGE;
          ui->FinalTemp_Input->setMinimum(highFlashpt);
          ui->expFlashpt_Input->setRange(startTemp+18, endTemp-VALIDTEMPRANGE);
          redraw_Barchart();
      }
      
      void NewConfig::on_expFlashpt_Input_valueChanged(int arg1){
          int startTemp = ui->StartTemp_Input->value();
          int endTemp = ui->FinalTemp_Input->value();
          int expectedFlashpt = ui->expFlashpt_Input->value();
          ui->expFlashpt_Input->setRange(startTemp+18, endTemp-VALIDTEMPRANGE);
          ui->StartTemp_Input->setMaximum(expectedFlashpt - 18);
          redraw_Barchart();
      }
      

      Since implementing the aforementioned code, I have not been able to hold down my mouse on the spinbox buttons to change the values within the QSpinboxes, but have had to manually mouseclick on the buttons every time if I wish to change it via spinbox buttons.

      I have tested it with other inputs such as with the keyboard arrow keys and the keyboard "page up/page down" button. I am not sure why this issue only affects mouse inputs.

      This code was implemented as the maximum and minimum values of the inputs would vary based on the value of the other QSpinboxes. Please let me know if more clarity or detail is required.

      M Offline
      M Offline
      mpergand
      wrote on last edited by mpergand
      #2

      @Dummie1138
      Have a try with setAutoRepeat(true) (QAbstractButton)

      [EDIT]
      QSpinBox doesn't inherit of QAbstractButton, but has setAccelerated(bool on) :

      This property holds whether the spin box will accelerate the frequency of the steps when pressing the step Up/Down buttons.
      If enabled the spin box will increase/decrease the value faster the longer you hold the button down.
      This property was introduced in Qt 4.2.
      Access functions:

      bool
      isAccelerated() const
      void
      setAccelerated(bool on)

      1 Reply Last reply
      0
      • Dummie1138D Dummie1138

        Hi. Thank you for your patience with the relatively vague title, this is an issue that I can't quite explain in a sentence.

        I have a few QSpinBoxes. I have implemented the "setRange" functions within the QSpinBoxes' "on_valueChanged" slots, like so:

        #define VALIDTEMPRANGE 8
        void NewConfig::on_StartTemp_Input_valueChanged(int arg1){
            int startTemp = ui->StartTemp_Input->value();
            int endTemp = ui->FinalTemp_Input->value();
            int expectedFlashpt = ui->expFlashpt_Input->value();
            ui->StartTemp_Input->setMaximum(expectedFlashpt - 18);      //The sequence at which the parameters are changed is CRITICAL. Take a second to think about the sequence before change. -22K
            ui->expFlashpt_Input->setRange(startTemp+18, endTemp-VALIDTEMPRANGE);
            redraw_Barchart();
        }
        
        void NewConfig::on_FinalTemp_Input_valueChanged(int arg1){
            int startTemp = ui->StartTemp_Input->value();
            int endTemp = ui->FinalTemp_Input->value();
            int highFlashpt = ui->expFlashpt_Input->value()+VALIDTEMPRANGE;
            ui->FinalTemp_Input->setMinimum(highFlashpt);
            ui->expFlashpt_Input->setRange(startTemp+18, endTemp-VALIDTEMPRANGE);
            redraw_Barchart();
        }
        
        void NewConfig::on_expFlashpt_Input_valueChanged(int arg1){
            int startTemp = ui->StartTemp_Input->value();
            int endTemp = ui->FinalTemp_Input->value();
            int expectedFlashpt = ui->expFlashpt_Input->value();
            ui->expFlashpt_Input->setRange(startTemp+18, endTemp-VALIDTEMPRANGE);
            ui->StartTemp_Input->setMaximum(expectedFlashpt - 18);
            redraw_Barchart();
        }
        

        Since implementing the aforementioned code, I have not been able to hold down my mouse on the spinbox buttons to change the values within the QSpinboxes, but have had to manually mouseclick on the buttons every time if I wish to change it via spinbox buttons.

        I have tested it with other inputs such as with the keyboard arrow keys and the keyboard "page up/page down" button. I am not sure why this issue only affects mouse inputs.

        This code was implemented as the maximum and minimum values of the inputs would vary based on the value of the other QSpinboxes. Please let me know if more clarity or detail is required.

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

        @Dummie1138 said in QSpinbox not allowing mouse presses to repeat:

        I have implemented the "setRange" functions within the QSpinBoxes' "on_valueChanged" slots, like so:

        This code was implemented as the maximum and minimum values of the inputs would vary based on the value of the other QSpinboxes.

        If you are handling the value changed on, say, SpinBox A, are you doing a setRange() or SetMaximum() or whatever on that SpinBox "A" or only on other SpinBoxes "B", "C" etc.?

        [EDIT: Try @mchinand's reply first.]

        Dummie1138D 1 Reply Last reply
        0
        • JonBJ JonB

          @Dummie1138 said in QSpinbox not allowing mouse presses to repeat:

          I have implemented the "setRange" functions within the QSpinBoxes' "on_valueChanged" slots, like so:

          This code was implemented as the maximum and minimum values of the inputs would vary based on the value of the other QSpinboxes.

          If you are handling the value changed on, say, SpinBox A, are you doing a setRange() or SetMaximum() or whatever on that SpinBox "A" or only on other SpinBoxes "B", "C" etc.?

          [EDIT: Try @mchinand's reply first.]

          Dummie1138D Offline
          Dummie1138D Offline
          Dummie1138
          wrote on last edited by Dummie1138
          #4

          @JonB When handling the value changed on Spinbox A, I would setRange on Spinbox A (and sometimes Spinbox B). I hope this helps. I will try mpergand's suggestions too.

          Edit: Is setAutoRepeat not a function for QAbstractButton? I am unsure how to implement it in the QSpinBox context, as I was unable to find how QSpinBox inherits from QAbstractButton.

          M JonBJ 2 Replies Last reply
          0
          • Dummie1138D Dummie1138

            @JonB When handling the value changed on Spinbox A, I would setRange on Spinbox A (and sometimes Spinbox B). I hope this helps. I will try mpergand's suggestions too.

            Edit: Is setAutoRepeat not a function for QAbstractButton? I am unsure how to implement it in the QSpinBox context, as I was unable to find how QSpinBox inherits from QAbstractButton.

            M Offline
            M Offline
            mpergand
            wrote on last edited by
            #5

            @Dummie1138 said in QSpinbox not allowing mouse presses to repeat:

            Is setAutoRepeat not a function for QAbstractButton?

            Look at my EDIT above.

            Dummie1138D 1 Reply Last reply
            0
            • M mpergand

              @Dummie1138 said in QSpinbox not allowing mouse presses to repeat:

              Is setAutoRepeat not a function for QAbstractButton?

              Look at my EDIT above.

              Dummie1138D Offline
              Dummie1138D Offline
              Dummie1138
              wrote on last edited by
              #6

              @mpergand Sorry, your edit wasn't active when I was searching and typing my question up. I can confirm that setAccelerated did not resolve the issue.

              1 Reply Last reply
              0
              • Dummie1138D Dummie1138

                @JonB When handling the value changed on Spinbox A, I would setRange on Spinbox A (and sometimes Spinbox B). I hope this helps. I will try mpergand's suggestions too.

                Edit: Is setAutoRepeat not a function for QAbstractButton? I am unsure how to implement it in the QSpinBox context, as I was unable to find how QSpinBox inherits from QAbstractButton.

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

                @Dummie1138 said in QSpinbox not allowing mouse presses to repeat:

                @JonB When handling the value changed on Spinbox A, I would setRange on Spinbox A (and sometimes Spinbox B).

                That might be a problem. Why would you want to change A's range/maximum when the user is pressing "A"?? Try doing only other spin boxes, does that change behaviour?

                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