Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.13.2
-
None
-
Windows 10 on 4K monitor
-
-
2614347ab8aa0ec0b1ea8f383ae795cfdb6ae2ac (qt/qtbase/5.15)
Description
The sizeHint() for a QDoubleSpinBox is way too wide after construction of an instance.
Once an instance of the QDoubleSpinBox is shown and the 'setMinimum()' (or 'setRange()') method is called, the correct width is used. This is demonstrated by the code below.
The first spinbox is too wide for the range ([0..99]) and precision (2 decimals). The second spinbox is the same, but its minimum value is set again (to the same value) after it is shown. This causes the second spinbox to have the correct width.
code to reproduce this bug:
#include <QtWidgets> int main(int argc, char **argv) { QApplication app(argc,argv); // spin boxes with range: [0..99] and 2 decimal places QDoubleSpinBox *spinbox1 = new QDoubleSpinBox(); QDoubleSpinBox *spinbox2 = new QDoubleSpinBox(); QHBoxLayout *testlayout = new QHBoxLayout(); testlayout->addWidget(spinbox1); testlayout->addWidget(spinbox2); testlayout->addStretch(); QWidget testwidget; testwidget.setLayout(testlayout); testwidget.show(); spinbox2->setMinimum(spinbox2->minimum()); // <- ensures correct size hint return app.exec(); }
Attachments
Issue Links
- is duplicated by
-
QTBUG-80614 QSpinBox minimum size is very large if constructor is called with null parent
-
- Closed
-
- resulted from
-
QTBUG-75303 QSpinBox: don't use hard-coded constant for the up/down button width
-
- Open
-
For Gerrit Dashboard: QTBUG-79806 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
284929,2 | Fix QSpinbox default width | 5.15 | qt/qtbase | Status: MERGED | +2 | 0 |