QSpinbox not allowing mouse presses to repeat
-
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.
-
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.
@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) -
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.
@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()orSetMaximum()or whatever on that SpinBox "A" or only on other SpinBoxes "B", "C" etc.?[EDIT: Try @mchinand's reply first.]
-
@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()orSetMaximum()or whatever on that SpinBox "A" or only on other SpinBoxes "B", "C" etc.?[EDIT: Try @mchinand's reply first.]
@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.
-
@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.
@Dummie1138 said in QSpinbox not allowing mouse presses to repeat:
Is setAutoRepeat not a function for QAbstractButton?
Look at my EDIT above.
-
@Dummie1138 said in QSpinbox not allowing mouse presses to repeat:
Is setAutoRepeat not a function for QAbstractButton?
Look at my EDIT above.
@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.
-
@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.
@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?