diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2018-12-10 14:04:53 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2019-01-08 15:10:54 +0000 |
commit | 6476de0b669162cf08c11f5c8d5ad0b42419f365 (patch) | |
tree | 8963f12221b3eaf25fa5bd9f8d1c76f5f96e46c2 /src/imports/controls/fusion/MenuItem.qml | |
parent | 0ca69961a2bd544cd417d849018427ae0c8cda05 (diff) |
DialogButtonBox: fix issue where single button would go outside box
c2fd8f7d made the following changes to the geometry calculation of
QQuickDialogButtonBox's contentItem:
@@ -244,11 +252,8 @@ void QQuickDialogButtonBoxPrivate::resizeContent()
return;
QRectF geometry = q->boundingRect().adjusted(q->leftPadding(), q->topPadding(), -q->rightPadding(), -q->bottomPadding());
- if (alignment != 0) {
- qreal cw = (alignment & Qt::AlignHorizontal_Mask) == 0 ? q->availableWidth() : contentItem->property("contentWidth").toReal();
- qreal ch = (alignment & Qt::AlignVertical_Mask) == 0 ? q->availableHeight() : contentItem->property("contentHeight").toReal();
- geometry = alignedRect(q->isMirrored() ? Qt::RightToLeft : Qt::LeftToRight, alignment, QSizeF(cw, ch), geometry);
- }
+ if (alignment != 0)
+ geometry = alignedRect(q->isMirrored() ? Qt::RightToLeft : Qt::LeftToRight, alignment, QSizeF(contentWidth, contentHeight), geometry);
It turns out that this breaks the use case of a fixed width box (e.g.
where a Dialog is assigned a width of 400 and the box assumes that
width) with a single button.
For example, in the case of the Default style,
QQuickDialogButtonBox::contentWidth is 100 because Button's
implicitWidth is 100. Since contentWidth is "used for calculating the
total implicit width" of the box, it's not useful for positioning
items which have an explicit width. The result is that
QQuickDialogButtonBox thinks the contentItem is smaller than it really
is, and therefore the ListView is positioned too far to the right.
Only the Default and Universal styles are affected, as they are the
only styles that resize the button to cover half of the button box.
This patch fixes the issue by reverting the code above to its original
state, where the content size of the contentItem is used instead
of the contentWidth of the box.
Change-Id: Idd2f94f3b4d3413fc2057c0ade2efdd66d701c08
Fixes: QTBUG-72372
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/imports/controls/fusion/MenuItem.qml')
0 files changed, 0 insertions, 0 deletions