QSpinBox not shrinking to content
I recently updated form Qt 5.7 to Qt 5.13 on Windows using MSVC 2017. The QSpinBoxes now take too much space. This behaviour can be observed for the example qtbase/widgets/widgets/sliders shipped with Qt (just compile and run the example to see that QSpinBox scales ugly compared to previous Qt versions).
It is possible to restore the old behaviour by adding a (completely nonsense) call to setStyleSheet in main.cpp:
Code:
int main(int argc, char *argv[])
{
app.setStyleSheet("QFoo { }"); // nonsense call to setStyleSheet
Window window;
window.show();
return app.exec();
}
Is there a more elegant way to stimulate the desired behaviour of QSpinBox as before in Qt5.7?
Best regards, Lin
Re: QSpinBox not shrinking to content
Quote:
The QSpinBoxes now take too much space.
Your test implies that this is a function of the default style, not the spin box itself. How is it too big? Horizontally, vertically? Both? Try using spacers or stretch factors in your layout to compress things rather than allowing them to fill the available space.
Re: QSpinBox not shrinking to content
I would guess it's a regression in 5.13 - see https://bugreports.qt.io/browse/QTBUG-79806
Re: QSpinBox not shrinking to content
Quote:
Originally Posted by
ChristianEhrlicher
yes, this seems to be the same regression bug. However, re-setting the minimum of each spinbox in the GUI seems impracticable. Fortunately, calling setStyleSheet (even in an void way) solved the problem for me. As for many applications setStyleSheet is called in a early stage anyway, most programmers won't see the bug.
Lin