Questions tagged [qspinbox]

The QSpinBox class, part of the Qt framework, provides a spin box widget.

QSpinBox allows the user to choose a value by clicking the up/down buttons or pressing up/down on the keyboard to increase/decrease the value currently displayed.

147 questions
4
votes
4 answers

increases/decreases QSpinBox value when click drag mouse - python / pyside

How can I make it so when a user clicks on, the up or down arrow of a QSpinBox, the value will increase as the cursor is dragging up and the value will decrease if dragging down. I fond this function very useful for users to be able to just click…
JokerMartini
  • 5,674
  • 9
  • 83
  • 193
4
votes
3 answers

QSpinBox ValueChanged is fired many times

Let's suppose I have a QSpinBox with a value 123.45 in it. If I manually edit it and start erasing the five, valueChanged is fired for the value 123.4. Happens again if I go on erasing the four. And it's also fired if I press enter after finishing…
Roman Rdgz
  • 12,836
  • 41
  • 131
  • 207
3
votes
1 answer

Deactivate QSpinBox if a certain value from QComboBox is selected

Is it possible to deactivate a QSpinBox if a certain value is chosen in a QComboBox. I've tried several things, but either the QSpinbox is deactived all the time or it wont deactivate at all.
buddy
  • 821
  • 2
  • 12
  • 30
3
votes
1 answer

Qt QSpinBox: How to display uppercase hexadecimal number

To use a QSpinBox to input and display hex numbers, simply set displayIntegerBase to 16. However, I couldn't find a property or method to set the display to uppercase (e.g. 1A rather than 1a). I'm aware that I can override the textFromValue()…
chunjiw
  • 1,093
  • 9
  • 20
3
votes
1 answer

Qt QSpinBox with a set of predefined values

I have a QSpinBox which should only accept a set of discrete values (let's say 2, 5, 10). I can setMinimum(2) and setMaximum(10), but I cannot setSingleStep because I have a step of 3 and one of 5. Is there a different widget which I can use, but…
Andrei Cioara
  • 3,404
  • 5
  • 34
  • 62
3
votes
1 answer

PySide get width of arrow button in QSpinBox

Is there a way to determine the width of the arrow buttons in the qspinbox? I'm trying to overwrite the context menu event, and i only want my custom event to take place if the user right-clicks over the arrow button, otherwise i want the normal…
JokerMartini
  • 5,674
  • 9
  • 83
  • 193
3
votes
0 answers

QDoubleSpinBox thousand separator while user is typing

I want to make a QDoubleSpinBox that would format the value into currency so it would be readable by users. Example. So far I've accomplished these things: set showGroupSeparator to true - but it will only work when focus is released. used the…
Binsoi
  • 383
  • 5
  • 13
3
votes
1 answer

How to implement a validator for a spin box to check if (n mod k == 0)?

I have a QSpinBox that takes ints, with a certain minimum and maximum values set. I need to set a filter on the spin box to allow only numbers divisible by a certain other integer number. This seems to be the right task for a QIntValidator. But I…
iksemyonov
  • 4,106
  • 1
  • 22
  • 42
3
votes
1 answer

How to check if QSpinBox value changed by keyboard or buttons(mouse wheel)

I need to set spinbox value to one of 1, 10, 100, 1000, 10000 if value changed by spinbox buttons or mouse wheel or up or down keys. But if value changed by keyboard I need other behavior. Here is my code for buttons, mouse wheel, up and down…
Ufx
  • 2,595
  • 12
  • 44
  • 83
3
votes
1 answer

restrict Input QSpinBox

I have a QSpinBox and I want it to only accept positive natural numbers. This works fine, until I enter a dot . If I enter 234235.23456and change the focus to some other spinbox, the value is changed to 23423523456. So I am looking for a way to…
liquid.pizza
  • 505
  • 1
  • 10
  • 26
3
votes
2 answers

adding multiple qslider and qspinner

I add QSlider and QSpinBox with this code QSpinBox *spinner2 = new QSpinBox; QSlider *slider2 = new QSlider(Qt::Vertical); spinner2->setRange(2,100); slider2->setRange(2,100); QObject::connect(spinner2, SIGNAL(valueChanged(int)), slider2,…
sven
  • 1,101
  • 7
  • 21
  • 44
3
votes
3 answers

QSpinBox enter NaN as a valid value

I am trying to extend the QSpinBox to be able to enter "NaN" or "nan" as a valid value. According to the documentation i should use the textFromValue, valueFromText, and validate functions to accomplish this but i cant get it to work since its still…
MBU
  • 4,998
  • 12
  • 59
  • 98
2
votes
1 answer

QSpinbox in QWizardPage gets initial focus even if its focus-policy is set to NoFocus

I create a QSpinBox in a QWizardPage. It get focus at the start of the wizardpage even when I set the focusPolicy to Qt.Nofocus. What I set in Qt creator is: But When the wizardpage start, I got: Then, if I press Tab for several times, the focus…
hellohawaii
  • 3,074
  • 6
  • 21
2
votes
2 answers

QSpinBox arrow buttons not disabling at maximum values

I am attempting to make the arrow buttons on a spinbox appear disabled when the value in the spin box is at either the maximum or minimum. I am using a QStyleSheet which contains: QAbstractSpinBox::up-arrow:off, QAbstractSpinBox::up-arrow:disabled…
Ryan S.
  • 21
  • 3
2
votes
3 answers

How to reverse spinbox selection in PyQt5?

I have a spinbox in PyQt5 like below. How can I make the selection reversed? i.e. If I click down arrow, the value goes up, vice versa.
Gaz Zhao
  • 204
  • 1
  • 10
1
2
3
9 10