aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-03-16 03:02:08 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-03-16 03:02:08 +0100
commit4a434b19c347a6014f42cbcf0f1493d689e579fc (patch)
treeb33cb6f0a59f01336d66b73bc30f822aa24e61aa
parente78843a23e1485abddf81e10c34048b7e0bd9eaa (diff)
parent8b78d9cea3091b0bd94d1ae0c71a000f8e7e1903 (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
-rw-r--r--dist/changes-5.12.260
-rw-r--r--src/imports/controls/DialogButtonBox.qml5
-rw-r--r--src/imports/controls/universal/DialogButtonBox.qml5
-rw-r--r--src/quicktemplates2/qquickcontainer.cpp2
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox.cpp7
-rw-r--r--tests/auto/controls/data/tst_dialogbuttonbox.qml136
6 files changed, 204 insertions, 11 deletions
diff --git a/dist/changes-5.12.2 b/dist/changes-5.12.2
new file mode 100644
index 00000000..420ded77
--- /dev/null
+++ b/dist/changes-5.12.2
@@ -0,0 +1,60 @@
+Qt 5.12.2 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.12.0 through 5.12.1.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.12 series is binary compatible with the 5.11.x series.
+Applications compiled for 5.11 will continue to run with 5.12.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Controls *
+****************************************************************************
+
+ - [QTBUG-73849] Fixed incorrect documentation link to
+ Number.toLocaleString().
+ - [QTBUG-72536] Fixed bug with long text in ScrollView.
+ - [QTBUG-73447] Fixed Menu's appearance not changing when enabled state
+ changes
+ - [QTBUG-70181] Fixed disabled menu items getting focus.
+ - [QTBUG-69540] Fixed disabled sub-menu items being highlighted.
+ - [QTBUG-72023] Fixed font and palette settings in .conf files not being
+ respected.
+ - [QTBUG-69682] Fixed Menu not being dismissed when the triggered item
+ disables itself.
+ - [QTBUG-73412] Fixed Dial's new properties not being detected by Creator.
+ - [QTBUG-73202] Documented how to move active focus out of TextArea with
+ tab.
+ - [QTBUG-72786] Fixed palette colors not propagating to ComboBox's popup.
+ - [QTBUG-73179] Fixed Qt.labs.platform.FileDialog not honoring folder
+ property.
+ - [QTBUG-72811] Fixed AbstractButton's clicked() signal not being emitted
+ after long press.
+ - [QTBUG-72746] Fixed crash on exit when using popups.
+ - [QTBUG-72372] Fixed issue where a button would go outside of
+ DialogButtonBox.
+ - [QTBUG-71902] Fixed incorrect font size in certain styles on Windows.
+ - [QTBUG-72750] Fixed Slider's wheel event propagation.
+
+****************************************************************************
+* Controls *
+****************************************************************************
+
+Fusion
+------
+
+ - [QTBUG-70819] Made Active and Disabled button colors closer to Widgets'
+ Fusion style.
+ - [QTBUG-70819] Use white ButtonText when a dark system theme is in use.
+ - [QTBUG-70652] Use system palette for highlightedText instead of a fixed
+ white color.
diff --git a/src/imports/controls/DialogButtonBox.qml b/src/imports/controls/DialogButtonBox.qml
index 1b783b3b..3c9d5b48 100644
--- a/src/imports/controls/DialogButtonBox.qml
+++ b/src/imports/controls/DialogButtonBox.qml
@@ -41,9 +41,10 @@ T.DialogButtonBox {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
- (control.count === 1 ? contentWidth * 2 : contentWidth) + leftPadding + rightPadding)
+ (control.count === 1 ? implicitContentWidth * 2 : implicitContentWidth) + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
- contentHeight + topPadding + bottomPadding)
+ implicitContentHeight + topPadding + bottomPadding)
+ contentWidth: contentItem.contentWidth
spacing: 1
padding: 12
diff --git a/src/imports/controls/universal/DialogButtonBox.qml b/src/imports/controls/universal/DialogButtonBox.qml
index ac2dc541..0458c39d 100644
--- a/src/imports/controls/universal/DialogButtonBox.qml
+++ b/src/imports/controls/universal/DialogButtonBox.qml
@@ -43,9 +43,10 @@ T.DialogButtonBox {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
- (control.count === 1 ? contentWidth * 2 : contentWidth) + leftPadding + rightPadding)
+ (control.count === 1 ? implicitContentWidth * 2 : implicitContentWidth) + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
- contentHeight + topPadding + bottomPadding)
+ implicitContentHeight + topPadding + bottomPadding)
+ contentWidth: contentItem.contentWidth
spacing: 4
padding: 24
diff --git a/src/quicktemplates2/qquickcontainer.cpp b/src/quicktemplates2/qquickcontainer.cpp
index c4af6151..2c357f82 100644
--- a/src/quicktemplates2/qquickcontainer.cpp
+++ b/src/quicktemplates2/qquickcontainer.cpp
@@ -793,6 +793,7 @@ void QQuickContainer::setContentWidth(qreal width)
return;
d->contentWidth = width;
+ d->resizeContent();
emit contentWidthChanged();
}
@@ -832,6 +833,7 @@ void QQuickContainer::setContentHeight(qreal height)
return;
d->contentHeight = height;
+ d->resizeContent();
emit contentHeightChanged();
}
diff --git a/src/quicktemplates2/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp
index 8559ad15..03f5f8e8 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox.cpp
+++ b/src/quicktemplates2/qquickdialogbuttonbox.cpp
@@ -241,11 +241,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);
contentItem->setPosition(geometry.topLeft());
contentItem->setSize(geometry.size());
diff --git a/tests/auto/controls/data/tst_dialogbuttonbox.qml b/tests/auto/controls/data/tst_dialogbuttonbox.qml
index 62789a47..6eca8569 100644
--- a/tests/auto/controls/data/tst_dialogbuttonbox.qml
+++ b/tests/auto/controls/data/tst_dialogbuttonbox.qml
@@ -54,8 +54,8 @@ import QtQuick.Controls 2.12
TestCase {
id: testCase
- width: 200
- height: 200
+ width: 600
+ height: 400
visible: true
when: windowShown
name: "DialogButtonBox"
@@ -292,4 +292,136 @@ TestCase {
verify(buttonPosInBox.x >= 0)
verify(buttonPosInBox.x + button.width < control.width)
}
+
+ Component {
+ id: dialogComponent
+ // Based on the Default style, where a single button fills
+ // half the dialog's width and is aligned to the right.
+ Dialog {
+ id: control
+ standardButtons: Dialog.Ok
+ visible: true
+
+ footer: DialogButtonBox {
+ id: box
+ visible: count > 0
+ alignment: count === 1 ? Qt.AlignRight : undefined
+
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ (count === 1 ? implicitContentWidth * 2 : implicitContentWidth) + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
+ contentWidth: contentItem.contentWidth
+
+ delegate: Button {
+ width: box.count === 1 ? box.availableWidth / 2 : undefined
+ }
+ }
+ }
+ }
+
+ // QTBUG-73860
+ function test_oneButtonAlignedRightInImplicitWidthBox() {
+ var dialog = createTemporaryObject(dialogComponent, testCase)
+ verify(dialog)
+
+ var box = dialog.footer
+ var listView = box.contentItem
+ waitForRendering(listView)
+
+ var button = box.itemAt(0)
+ verify(button)
+
+ // The button should never go outside of the box.
+ var buttonPosInBox = button.mapToItem(box, 0, 0)
+ verify(buttonPosInBox.x >= 0, "Expected button to be inside left edge "
+ + "of DialogButtonBox, but it's " + buttonPosInBox.x)
+ verify(buttonPosInBox.x + button.width <= box.width, "Expected button to be inside right edge "
+ + "of DialogButtonBox (" + box.width + "), but it's " + (buttonPosInBox.x + button.width))
+ compare(box.width, dialog.width)
+ // There's a single button and we align it to the right.
+ compare(box.contentItem.width, button.width)
+ compare(box.contentItem.x, box.width - box.rightPadding - box.contentItem.width)
+ }
+
+ Component {
+ id: customButtonBox
+
+ DialogButtonBox {
+ objectName: "customButtonBox"
+ alignment: Qt.AlignRight
+
+ property alias okButton: okButton
+
+ Button {
+ id: okButton
+ text: "OK"
+
+ DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
+ }
+ }
+ }
+
+ // QTBUG-72886
+ function test_oneCustomButtonChangeText() {
+ var control = createTemporaryObject(customButtonBox, testCase, {})
+ verify(control)
+
+ var listView = control.contentItem
+ waitForRendering(listView)
+
+ var button = control.okButton
+ verify(button)
+ button.text = "some longer text";
+
+ // The button should never go outside of the box.
+ tryVerify(function() { return button.mapToItem(control, 0, 0).x >= 0 },
+ 1000, "Expected left edge of button to be within left edge of DialogButtonBox (i.e. greater than or equal to 0)" +
+ ", but it's " + button.mapToItem(control, 0, 0).x)
+ tryVerify(function() { return button.mapToItem(control, 0, 0).x + button.width <= control.width },
+ 1000, "Expected right edge of button to be within right edge of DialogButtonBox (i.e. less than or equal to " +
+ control.width + "), but it's " + (button.mapToItem(control, 0, 0).x + button.width))
+ }
+
+ Component {
+ id: customButtonBoxTwoButtons
+
+ DialogButtonBox {
+ objectName: "customButtonBoxTwoButtons"
+ alignment: Qt.AlignRight
+
+ property alias okButton: okButton
+
+ Button {
+ id: okButton
+ text: "OK"
+
+ DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
+ }
+ Button {
+ text: "Cancel"
+
+ DialogButtonBox.buttonRole: DialogButtonBox.RejectRole
+ }
+ }
+ }
+
+ // QTBUG-72886
+ function test_twoCustomButtonsChangeText() {
+ var control = createTemporaryObject(customButtonBoxTwoButtons, testCase, {})
+ verify(control)
+
+ var listView = control.contentItem
+ waitForRendering(listView)
+
+ var button = control.okButton
+ button.text = "some longer text";
+ // The button should never go outside of the box.
+ tryVerify(function() { return button.mapToItem(control, 0, 0).x >= 0 },
+ 1000, "Expected left edge of button to be within left edge of DialogButtonBox (i.e. greater than or equal to 0)" +
+ ", but it's " + button.mapToItem(control, 0, 0).x)
+ tryVerify(function() { return button.mapToItem(control, 0, 0).x + button.width <= control.width },
+ 1000, "Expected right edge of button to be within right edge of DialogButtonBox (i.e. less than or equal to " +
+ control.width + "), but it's " + (button.mapToItem(control, 0, 0).x + button.width))
+ }
}