summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-09-17 23:08:00 +0200
committerLiang Qi <liang.qi@qt.io>2016-09-18 22:11:24 +0200
commitd9aae9ff99d20b58487b0a48801864d13115363b (patch)
treee98089900164f7a1008e6fb59d1815dc9eab8d2c /src
parent49bd4b76d08ec11d08105ca71e8dda4f8d459b5c (diff)
parentc2356328f88b044c8956fe7860c4c04fca4f2c30 (diff)
downloadqtquickcontrols-d9aae9ff99d20b58487b0a48801864d13115363b.tar.gz
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: src/controls/Private/qquickrangemodel.cpp src/controls/Private/qquickrangemodel_p.h src/controls/Private/qquickrangemodel_p_p.h src/layouts/qquicklayout.cpp tests/auto/controls/data/tst_rangemodel.qml Change-Id: I9c8f6326c6edf9ebb18dd538f76830e1b439ba8e
Diffstat (limited to 'src')
-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
7 files changed, 49 insertions, 10 deletions
diff --git a/src/controls/Private/qquickrangemodel.cpp b/src/controls/Private/qquickrangemodel.cpp
index d881e3c8..ca393c83 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 0c93bed3..e5796725 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 5c56814e..ab0627d3 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 f38db0e4..4023929a 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 6ad785ba..b95704d3 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 0baf244b..30057ca1 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 d1fd0c00..64e68515 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.
*/