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
39
votes
9 answers

How do I set the background color of a widget like combobox or double spin box?

I am trying to set the background color for a double spin box, and I am not sure what function I should use. I saw some function called SetBackgroundRole which accepts a Qt::ColorRole, but I am not sure how to use this one as well. Kindly let me…
AMM
  • 17,130
  • 24
  • 65
  • 77
24
votes
7 answers

QSpinBox inside a QScrollArea: How to prevent Spin Box from stealing focus when scrolling?

I have a control with several QSpinBox objects inside a QScrollArea. All works fine when scrolling in the scroll area unless the mouse happens to be over one of the QSpinBoxes. Then the QSpinBox steals focus and the wheel events manipulate the…
Grant Limberg
  • 20,913
  • 11
  • 63
  • 84
11
votes
1 answer

How to subclass QSpinBox so it could have int64 values as maxium and minimum

I need to implement a QSpinBox control which should be able to process int64 values as it's minimum & maximum values. Current implementation only supports int32 values. End of the day my QSpinBox should accept any value between 9223372036854775807…
warunanc
  • 2,221
  • 1
  • 23
  • 40
10
votes
5 answers

QSpinBox with Unsigned Int for Hex Input

There are a variety of questions written here about QSpinBox's limitation of using an int as its datatype. Often people want to display larger numbers. In my case, I want to be able to show an unsigned 32bit integer in hexadecimal. This means I'd…
user1074897
9
votes
3 answers

disable editing in QSpinbox but enable arrows

I have a QSpinBox in which I want to enable the arrows (for up and down values) but disable inserting data by the user. I've tried using this: QtGui.QSpinBox.setReadOnly(True) But it doesn't work. All is disabled and the arrows are 'stuck'.
roy.me
  • 421
  • 2
  • 7
  • 19
8
votes
2 answers

How to prevent QSpinBox from automatically highlighting contents

QSpinBox makes its contents selected (highlighted) upon using up/down buttons. Is there any way to disable this? Is there any way to clear selection, other than use my own subclass of QSpinBox to access the underlying QLineEdit?
Violet Giraffe
  • 32,368
  • 48
  • 194
  • 335
7
votes
1 answer

Qt find out if QSpinBox was changed by user

Let's suppose I have a QSpinBox, how I can find out if the value was changed manually from user or from a other function? EDIT: I want to do some actions only when user change values but if your program does it (setValue) I don't want do this…
Matthias
  • 461
  • 7
  • 24
7
votes
2 answers

Set specific values in a QSpinBox

I have a widget containing a QSpinBox. This widget also has a QVector Values. What I would like to do is get the QSpinBox to display values issued from Values only. At first I thought that a new slot and signal in my widget would do the trick,…
CTZStef
  • 1,675
  • 2
  • 18
  • 47
6
votes
3 answers

Set string to QDoubleSpinBox

Regarding some task I must do the following. Consider I have a QDoubleSpinBox with positive values from 0 to 1000. And every time when user tries to lower the value of spinbox, f.e. to click the down button when value is 0, the value of spinbox…
Eduard Rostomyan
  • 7,050
  • 2
  • 37
  • 76
6
votes
2 answers

QDoubleSpinBox with leading zeros (always 4 digits)

I have a QDoubleSpinBox in range 0-7000, but want the value always displayed as 4 digits (0-> 0000, 1 -> 0001 , 30 -> 0030, 3333 -> 3333). I understand I can add a prefix, but a prefix is always added. What are my options?
Horst Walter
  • 13,663
  • 32
  • 126
  • 228
5
votes
2 answers

QSpinBox thousand separator

With a QSpinBox is it possible to display the thousand separator of a number while user enter it like 10,000 Which is the best way to do that ?
5
votes
1 answer

Custom spinbox with "classic" spinbox display

I need to use a double spinbox for my QML view and in this case, I based my spinbox on this example . SpinBox { id: spinbox from: 0 value: 110 to: 100 * 100 stepSize: 100 anchors.centerIn: parent property int…
Ed Nio
  • 593
  • 2
  • 11
  • 27
5
votes
4 answers

How to use float in a QML spinbox

I use a QML Spinbox but I have trouble to use floats in it. If I write something like value: 5.0 , it will be displayed as 5 , so as an int instead of a float. Do you have any idea of how to proceed ? Thanks a lot and have a good day !
Ed Nio
  • 593
  • 2
  • 11
  • 27
4
votes
1 answer

QSpinBox arrows place outside line edit (css)

(source: metrotek.spb.ru) How to do it with Qt CSS help ? I have try to use subcontrol-origin: margin; position: absolute; but no success. Thank for any help Edit Thank you for help and final CSS for my problem is: QSpinBox#spin { margin-left:…
Dmitry
  • 906
  • 1
  • 13
  • 32
4
votes
1 answer

Editing behavior of “backspace” key of QDoubleSpinBox

I’ve got a problem with QDoubleSpinBox. Editing behavior of “backspace” key somehow depends on the size of the suffix. If I set “m” as suffix, then set the cursor at the end of the spinbox and press “backspace”, the cursor jumps over the “m” suffix…
den
  • 141
  • 1
  • 1
  • 6
1
2 3
9 10