Unsolved Displaying a QString in a QSpinBox
-
Hi
I have a QSpinBox.
I would like to display a QString while clicking the arrows, instead displaying value.
I also need the value to call a slot.
I tried setSpecialValueText but it obviously only runs when value equals minimum.
Thanks -
@mulfycrowh said in Displaying a QString in a QSpinBox:
QSpinBox
Hi!
Your question is really unclear. What QString do you want to show?
If you want to show some strings instead of numbers then you need to subclass QSpinBox and override valueFromText and textFromValue as explained in the documentation.
"I also need the value to call a slot." - what does this mean? Do you want to call a slot each time the value is changed? If so then just connect one of the valueChanged(...) signals to your slot (http://doc.qt.io/qt-5/qspinbox.html). -
@mulfycrowh said in Displaying a QString in a QSpinBox:
I have a QSpinBox.
I would like to display a QString while clicking the arrows, instead displaying value.
I also need the value to call a slot.
I tried setSpecialValueText but it obviously only runs when value equals minimum.
ThanksIf you re-implement your own spinbox class, I guess this is possible as @jsulm said. But simpler than that might be to use QComboBox.