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.