QDateTimeEdit: Unify height of QDateTimeEdit
After 0a1c1711453697a88eee7fdb6f4cf082bfd433e2 a QDateTimeEdit with and without a popup has different heights in some styles. Fixing the styles may break existing layouts so we only get the needed width when the popup is enable from CT_ComboBox and let the height being calculated by CT_SpinBox to make sure both variants have the same height. Pick-to: 6.9 6.8 Fixes: QTBUG-135029 Task-number: QTBUG-11967 Change-Id: I01c6f598d34a0b73125e60650c61a84b27d79ac8 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
3208ad494c
commit
105ddadffe
@ -1092,15 +1092,15 @@ QSize QDateTimeEdit::sizeHint() const
|
||||
w += 2; // cursor blinking space
|
||||
|
||||
QSize hint(w, h);
|
||||
QStyleOptionSpinBox opt;
|
||||
initStyleOption(&opt);
|
||||
d->cachedSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this);
|
||||
if (d->calendarPopupEnabled()) {
|
||||
QStyleOptionComboBox opt;
|
||||
opt.initFrom(this);
|
||||
opt.frame = d->frame;
|
||||
d->cachedSizeHint = style()->sizeFromContents(QStyle::CT_ComboBox, &opt, hint, this);
|
||||
} else {
|
||||
QStyleOptionSpinBox opt;
|
||||
initStyleOption(&opt);
|
||||
d->cachedSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this);
|
||||
QStyleOptionComboBox optCbx;
|
||||
optCbx.initFrom(this);
|
||||
optCbx.frame = d->frame;
|
||||
d->cachedSizeHint.rwidth() =
|
||||
style()->sizeFromContents(QStyle::CT_ComboBox, &optCbx, hint, this).width();
|
||||
}
|
||||
|
||||
d->cachedMinimumSizeHint = d->cachedSizeHint;
|
||||
|
Loading…
x
Reference in New Issue
Block a user