PDA

View Full Version : Remove QSpinbox up/down arrows



SailinShoes
8th March 2008, 18:00
I would like to remove the up/down arrows in a spinbox. I develop for Qt 4.2.0, and did not find a simple way to remove the up/down arrows. How do I solve it? And one more thing, is it possible to remove the cursor to?

...and no, I am not able to use QAbstractSpinBox::NoButtons (added for Qt 4.2.2). The company I work for has a commercial licens for 4.2.0 so I can't just download the latest version.

Cheers!

wysota
8th March 2008, 18:23
Why don't you use QLineEdit with a QIntValidator instead? You can probably also subclass the spin box and reimplement its paintevent to make sure no arrows are drawn.

Are you sure the company can't download 4.2.2? The licence is not tied to a concrete version of Qt...

SailinShoes
9th March 2008, 13:14
Why don't you use QLineEdit with a QIntValidator instead? You can probably also subclass the spin box and reimplement its paintevent to make sure no arrows are drawn.

Subclassing the spinbox and reimplement the paintevent sounds like a good solution.


Are you sure the company can't download 4.2.2? The licence is not tied to a concrete version of Qt...

It's not tied to a version? I have got the impression from my superiors that it is? I'll see if I can get some clarification in the matter.

Thanks for your answer wysota!

wysota
9th March 2008, 13:37
It's not tied to a version?
No, it's not. It's only tied to a time period, as far as I know.

pherthyl
10th March 2008, 20:37
Perhaps their license expired at 4.2.0 and they haven't renewed it.

SailinShoes
12th March 2008, 20:29
I followed wysota:s advice to reimplement the spinbox paintevent to make sure no arrows are drawn.

But the cursor is still present? How can I get rid of it?

wysota
12th March 2008, 20:31
You want to get rid of the cursor as well? Why not put a readonly line edit there then?

SailinShoes
12th March 2008, 20:40
Simple...yet effective? It works...
Thank you wysota.