PDA

View Full Version : alter minimum size of a QSpinBox



mortoray
21st October 2010, 15:47
I've switched some controls from a QLineEdit to a QSpinBox and the minimum size is too wide: they stretch out the gridlayout needlessly. I played around a bit and see that the minimum size is based on the formatting of the min/max values (I use custom strings as well).

Now, my max/min are quite extreme since occasionally such values may be entered. Under normal situations the range is a lot smaller. I would like somehow to have the min width be based on the normal circumstances rather than the extremes.

Is this easily possible? I looked first a minimumSizeHint but I see no way to determine the size of the borders and up/down buttons.

mortoray
21st October 2010, 15:50
My quick hack is to return a special string when the min/max are passed as values to textFromValue. It then uses these strings to get the width.