summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-09-19 14:31:56 +0200
committerLiang Qi <liang.qi@qt.io>2016-09-19 14:31:56 +0200
commit3b093789b07c670e29d3275e26c4e7122db042ae (patch)
tree46d11026341721183560a4168550987b7633f40b
parent94c511b63af10a5507936ab7fbdd517144cde872 (diff)
parentd9aae9ff99d20b58487b0a48801864d13115363b (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts: src/controls/controls.pro Change-Id: I0150ca08d83f292a5c8587ec886e206124757df4
-rw-r--r--dist/changes-5.6.230
-rw-r--r--src/controls/Private/qquickrangemodel.cpp33
-rw-r--r--src/controls/Private/qquickrangemodel_p.h7
-rw-r--r--src/controls/Private/qquickrangemodel_p_p.h3
-rw-r--r--src/controls/Slider.qml6
-rw-r--r--src/controls/SplitView.qml6
-rw-r--r--src/controls/Styles/Base/CheckBoxStyle.qml2
-rw-r--r--src/controls/TableViewColumn.qml2
-rw-r--r--src/controls/controls.pro2
-rw-r--r--tests/auto/controls/data/layout/Container.qml55
-rw-r--r--tests/auto/controls/data/layout/ContainerUser.qml53
-rw-r--r--tests/auto/controls/data/rangemodel/init.qml56
-rw-r--r--tests/auto/controls/data/tst_layout.qml11
-rw-r--r--tests/auto/controls/data/tst_rangemodel.qml8
-rw-r--r--tests/auto/controls/data/tst_scrollview.qml2
-rw-r--r--tests/auto/controls/data/tst_slider.qml40
16 files changed, 303 insertions, 13 deletions
diff --git a/dist/changes-5.6.2 b/dist/changes-5.6.2
new file mode 100644
index 000000000..ac1d5f92a
--- /dev/null
+++ b/dist/changes-5.6.2
@@ -0,0 +1,30 @@
+Qt 5.6.2 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.6.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+ http://doc.qt.io/qt-5/index.html
+
+The Qt version 5.6 series is binary compatible with the 5.5.x series.
+Applications compiled for 5.5 will continue to run with 5.6.
+
+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-50795] ScrollView: fixed to update the position of the scroll
+ bars on content size change.
+ - [QTBUG-47523] TreeView: fixed moving of items
+ - RangeModel: fixed to emit min/max and value changes after component is
+ complete
+ - Menu: fixed native menu on macOS to to get dismissed when its parent
+ window is destroyed
diff --git a/src/controls/Private/qquickrangemodel.cpp b/src/controls/Private/qquickrangemodel.cpp
index d881e3c88..ca393c838 100644
--- a/src/controls/Private/qquickrangemodel.cpp
+++ b/src/controls/Private/qquickrangemodel.cpp
@@ -72,6 +72,9 @@ void QQuickRangeModel1Private::init()
posatmin = 0;
posatmax = 0;
inverted = false;
+ isComplete = false;
+ positionChanged = false;
+ valueChanged = false;
}
/*!
@@ -158,10 +161,16 @@ void QQuickRangeModel1Private::emitValueAndPositionIfChanged(const qreal oldValu
// unchanged. This will be the case when operating with values outside range:
const qreal newValue = q->value();
const qreal newPosition = q->position();
- if (!qFuzzyCompare(newValue, oldValue))
- emit q->valueChanged(newValue);
- if (!qFuzzyCompare(newPosition, oldPosition))
- emit q->positionChanged(newPosition);
+
+ if (isComplete) {
+ if (!qFuzzyCompare(newValue, oldValue))
+ emit q->valueChanged(newValue);
+ if (!qFuzzyCompare(newPosition, oldPosition))
+ emit q->positionChanged(newPosition);
+ } else {
+ positionChanged |= qFuzzyCompare(oldPosition, newPosition);
+ valueChanged |= !qFuzzyCompare(oldValue, newValue);
+ }
}
/*!
@@ -349,6 +358,22 @@ qreal QQuickRangeModel1::positionForValue(qreal value) const
return d->publicPosition(unconstrainedPosition);
}
+void QQuickRangeModel1::classBegin()
+{
+}
+
+void QQuickRangeModel1::componentComplete()
+{
+ Q_D(QQuickRangeModel1);
+ d->isComplete = true;
+ emit minimumChanged(minimum());
+ emit maximumChanged(maximum());
+ if (d->valueChanged)
+ emit valueChanged(value());
+ if (d->positionChanged)
+ emit positionChanged(position());
+}
+
/*!
\property QQuickRangeModel1::position
\brief the current position of the model
diff --git a/src/controls/Private/qquickrangemodel_p.h b/src/controls/Private/qquickrangemodel_p.h
index 0c93bed30..e57967250 100644
--- a/src/controls/Private/qquickrangemodel_p.h
+++ b/src/controls/Private/qquickrangemodel_p.h
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
class QQuickRangeModel1Private;
-class QQuickRangeModel1 : public QObject
+class QQuickRangeModel1 : public QObject, public QQmlParserStatus
{
Q_OBJECT
Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged USER true)
@@ -59,6 +59,8 @@ class QQuickRangeModel1 : public QObject
Q_PROPERTY(qreal positionAtMaximum READ positionAtMaximum WRITE setPositionAtMaximum NOTIFY positionAtMaximumChanged)
Q_PROPERTY(bool inverted READ inverted WRITE setInverted NOTIFY invertedChanged)
+ Q_INTERFACES(QQmlParserStatus)
+
public:
QQuickRangeModel1(QObject *parent = 0);
virtual ~QQuickRangeModel1();
@@ -90,6 +92,9 @@ public:
Q_INVOKABLE qreal valueForPosition(qreal position) const;
Q_INVOKABLE qreal positionForValue(qreal value) const;
+ void classBegin();
+ void componentComplete();
+
public Q_SLOTS:
void toMinimum();
void toMaximum();
diff --git a/src/controls/Private/qquickrangemodel_p_p.h b/src/controls/Private/qquickrangemodel_p_p.h
index 5c56814ef..ab0627d32 100644
--- a/src/controls/Private/qquickrangemodel_p_p.h
+++ b/src/controls/Private/qquickrangemodel_p_p.h
@@ -70,6 +70,9 @@ public:
uint inverted : 1;
QQuickRangeModel1 *q_ptr;
+ bool isComplete;
+ bool positionChanged;
+ bool valueChanged;
inline qreal effectivePosAtMin() const {
return inverted ? posatmax : posatmin;
diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml
index f38db0e42..4023929a5 100644
--- a/src/controls/Slider.qml
+++ b/src/controls/Slider.qml
@@ -176,9 +176,11 @@ Control {
/*! \internal
The extra arguments positionAtMinimum and positionAtMaximum are there to force
- re-evaluation of the handle position when the constraints change (QTBUG-41255).
+ re-evaluation of the handle position when the constraints change (QTBUG-41255),
+ and the same for range.minimumValue (QTBUG-51765).
*/
- property real __handlePos: range.valueForPosition(__horizontal ? fakeHandle.x : fakeHandle.y, range.positionAtMinimum, range.positionAtMaximum)
+ property real __handlePos: range.valueForPosition(__horizontal ? fakeHandle.x : fakeHandle.y,
+ range.positionAtMinimum, range.positionAtMaximum, range.minimumValue)
activeFocusOnTab: true
diff --git a/src/controls/SplitView.qml b/src/controls/SplitView.qml
index 6ad785ba2..b95704d3f 100644
--- a/src/controls/SplitView.qml
+++ b/src/controls/SplitView.qml
@@ -61,9 +61,13 @@ import QtQuick.Window 2.1
item will get all leftover space when other items have been laid out.
By default, the last visible child of the SplitView will have this set, but
it can be changed by explicitly setting fillWidth to \c true on another item.
+
As the fillWidth item will automatically be resized to fit the extra space, explicit assignments
- to width and height will be ignored (but \l{Layout::minimumWidth}{Layout.minimumWidth} and
+ to its width and height properties will be ignored (but \l{Layout::minimumWidth}{Layout.minimumWidth} and
\l{Layout::maximumWidth}{Layout.maximumWidth} will still be respected).
+ The initial sizes of other items should be set via their width and height properties.
+ Any binding assignment to an item's width or height will be broken as soon as the user
+ drags that item's splitter handle.
A handle can belong to the item either on the left or top side, or on the right or bottom side:
\list
diff --git a/src/controls/Styles/Base/CheckBoxStyle.qml b/src/controls/Styles/Base/CheckBoxStyle.qml
index 0baf244bd..30057ca1f 100644
--- a/src/controls/Styles/Base/CheckBoxStyle.qml
+++ b/src/controls/Styles/Base/CheckBoxStyle.qml
@@ -114,7 +114,7 @@ Style {
/*! This defines the indicator button. */
property Component indicator: Item {
implicitWidth: Math.round(TextSingleton.implicitHeight)
- height: width
+ implicitHeight: implicitWidth
Rectangle {
anchors.fill: parent
anchors.bottomMargin: -1
diff --git a/src/controls/TableViewColumn.qml b/src/controls/TableViewColumn.qml
index d1fd0c002..64e685152 100644
--- a/src/controls/TableViewColumn.qml
+++ b/src/controls/TableViewColumn.qml
@@ -77,7 +77,7 @@ QtObject {
/*! The model \c role of the column. */
property string role
- /*! The current width of the column
+ /*! The current width of the column.
The default value depends on platform. If only one
column is defined, the width expands to the viewport.
*/
diff --git a/src/controls/controls.pro b/src/controls/controls.pro
index 8efc22713..63d055d6b 100644
--- a/src/controls/controls.pro
+++ b/src/controls/controls.pro
@@ -88,6 +88,8 @@ osx: LIBS_PRIVATE += -framework Carbon
$$PRIVATE_QML_FILES \
$$STYLES_QML_FILES \
$$SHADER_FILES
+ OTHER_FILES += $$QML_FILES
}
+
CONFIG += no_cxx_module
load(qml_plugin)
diff --git a/tests/auto/controls/data/layout/Container.qml b/tests/auto/controls/data/layout/Container.qml
new file mode 100644
index 000000000..db3d68c48
--- /dev/null
+++ b/tests/auto/controls/data/layout/Container.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtQuick.Layouts 1.2
+
+Item {
+ objectName: "qtbug51927-window"
+ visible: true
+
+ default property alias _contents: customContent.data
+
+ ColumnLayout {
+ id: customContent
+ objectName: "qtbug51927-columnLayout"
+ anchors.fill: parent
+ }
+}
diff --git a/tests/auto/controls/data/layout/ContainerUser.qml b/tests/auto/controls/data/layout/ContainerUser.qml
new file mode 100644
index 000000000..ff7ce6221
--- /dev/null
+++ b/tests/auto/controls/data/layout/ContainerUser.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Window 2.2
+
+Container {
+ visible: true
+
+ Text {
+ objectName: "qtbug51927-text"
+ text: qsTr("Hello World")
+ anchors.centerIn: parent
+ renderType: Text.QtRendering
+ }
+}
diff --git a/tests/auto/controls/data/rangemodel/init.qml b/tests/auto/controls/data/rangemodel/init.qml
new file mode 100644
index 000000000..9d0501430
--- /dev/null
+++ b/tests/auto/controls/data/rangemodel/init.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
+import QtTest 1.0
+
+RangeModel {
+ id: rangemodel
+ positionAtMinimum: 0
+ positionAtMaximum: 100
+ stepSize: 1
+
+ property QtObject spy: SignalSpy {
+ target: rangemodel
+ signalName: "valueChanged"
+ }
+}
diff --git a/tests/auto/controls/data/tst_layout.qml b/tests/auto/controls/data/tst_layout.qml
index f2a690478..e5ac7728c 100644
--- a/tests/auto/controls/data/tst_layout.qml
+++ b/tests/auto/controls/data/tst_layout.qml
@@ -63,5 +63,16 @@ TestCase {
var object = Qt.createQmlObject('import QtQuick 2.2; import QtQuick.Layouts 1.0; QtObject { Layout.fillWidth: true }', testCase, '');
object.destroy()
}
+
+ function test_defaultPropertyAliasCrash() {
+ var containerUserComponent = Qt.createComponent("layout/ContainerUser.qml");
+ compare(containerUserComponent.status, Component.Ready);
+
+ var containerUser = containerUserComponent.createObject(testCase);
+ verify(containerUser);
+
+ // Shouldn't crash.
+ containerUser.destroy();
+ }
}
diff --git a/tests/auto/controls/data/tst_rangemodel.qml b/tests/auto/controls/data/tst_rangemodel.qml
index f489e4b5d..fd0a8dbee 100644
--- a/tests/auto/controls/data/tst_rangemodel.qml
+++ b/tests/auto/controls/data/tst_rangemodel.qml
@@ -78,6 +78,14 @@ TestCase {
spy.clear()
}
+ function test_delayedinit() {
+ var component = Qt.createComponent("rangemodel/init.qml");
+ compare(component.status, Component.Ready)
+ var r = component.createObject(testCase, {minimumValue: 40, maximumValue: 90, value: 80});
+ compare(r.value, 80)
+ compare(r.spy.count, 1)
+ }
+
function test_setminimumvalue() {
spy.signalName = "minimumChanged"
compare(spy.count, 0)
diff --git a/tests/auto/controls/data/tst_scrollview.qml b/tests/auto/controls/data/tst_scrollview.qml
index 07d6525e1..842fd6dcd 100644
--- a/tests/auto/controls/data/tst_scrollview.qml
+++ b/tests/auto/controls/data/tst_scrollview.qml
@@ -143,7 +143,7 @@ TestCase {
var scrollView = dragFetchAppendComponent.createObject(container)
verify(scrollView !== null, "view created is null")
waitForRendering(scrollView)
- verify(scrollView.flickableItem.contentHeight === 60 * 20)
+ tryCompare(scrollView.flickableItem, "contentHeight", 60 * 20)
// After scrolling to the end, view should ask the model to fetch more
// data, content height should increase and scrollbar handle should move
diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml
index 48612215b..1d7e92d26 100644
--- a/tests/auto/controls/data/tst_slider.qml
+++ b/tests/auto/controls/data/tst_slider.qml
@@ -48,11 +48,12 @@
**
****************************************************************************/
-import QtQuick 2.2
+import QtQuick 2.6
import QtTest 1.0
import QtQuickControlsTests 1.0
-import QtQuick.Controls 1.2
+import QtQuick.Controls 1.4
import QtQuick.Controls.Private 1.0
+import QtQuick.Controls.Styles 1.4
Item {
id: container
@@ -74,6 +75,12 @@ Item {
id: util
}
+ Component {
+ id: sliderComponent
+
+ Slider {}
+ }
+
function test_vertical() {
var slider = Qt.createQmlObject('import QtQuick.Controls 1.2; Slider {}', testCase, '');
verify(slider.height < slider.width)
@@ -371,5 +378,34 @@ Item {
control.destroy()
component.destroy()
}
+
+ Component {
+ id: namedHandleStyle
+
+ SliderStyle {
+ handle: Rectangle {
+ objectName: "sliderHandle"
+ implicitWidth: 20
+ implicitHeight: 20
+ color: "salmon"
+ }
+ }
+ }
+
+ function test_minimumValueLargerThanValue() {
+ var control = sliderComponent.createObject(container, { "style": namedHandleStyle, "minimumValue": 0, "maximumValue": 2, value: "minimumValue" });
+ verify(control);
+
+ var handle = findChild(control, "sliderHandle");
+ verify(handle);
+
+ // The handle should stay within the bounds of the slider when
+ // minimumValue is set to a value larger than "value".
+ control.minimumValue = 1;
+ compare(control.value, control.minimumValue);
+ compare(handle.mapToItem(null, 0, 0).x, 0)
+
+ control.destroy();
+ }
}
}