QDateTimeEdit: use correct size hint when calendarPopup is enabled
When calendarPopup is enabled, a QComboBox instead a QSpinBox is drawn but the size hint for QSpinBox was used which resulted in a too small width for the widget (depending on the underlying style). Therefore use the size hint for CT_ComboBox in this case as it was already done for mac. Fixes: QTBUG-11967 Change-Id: I817bdc99ae5d1189b9f0451a857022abe64b3bf8 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 0a1c1711453697a88eee7fdb6f4cf082bfd433e2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>bb10
parent
590ac5b4a1
commit
fc96ce3a2b
|
|
@ -1092,14 +1092,12 @@ QSize QDateTimeEdit::sizeHint() const
|
|||
w += 2; // cursor blinking space
|
||||
|
||||
QSize hint(w, h);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
if (d->calendarPopupEnabled()) {
|
||||
QStyleOptionComboBox opt;
|
||||
opt.initFrom(this);
|
||||
opt.frame = d->frame;
|
||||
d->cachedSizeHint = style()->sizeFromContents(QStyle::CT_ComboBox, &opt, hint, this);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
} else {
|
||||
QStyleOptionSpinBox opt;
|
||||
initStyleOption(&opt);
|
||||
d->cachedSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this);
|
||||
|
|
|
|||
Loading…
Reference in New Issue