From 3acae0f4508d3ca9bdac82eb619490c41ee99ff3 Mon Sep 17 00:00:00 2001 From: Marco Benelli Date: Tue, 15 Sep 2015 11:36:15 +0200 Subject: Manually updated corrected meta object revision for QQuickWindow Change-Id: I0f2b1f2b963b2e07adcf241543de9510536dadca Reviewed-by: Erik Verbruggen --- src/controls/plugins.qmltypes | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/controls/plugins.qmltypes b/src/controls/plugins.qmltypes index 866ef043..89b9260a 100644 --- a/src/controls/plugins.qmltypes +++ b/src/controls/plugins.qmltypes @@ -2339,8 +2339,12 @@ Module { name: "QQuickWindow" defaultProperty: "data" prototype: "QWindow" - exports: ["QtQuick.Window/Window 2.0"] - exportMetaObjectRevisions: [0] + exports: [ + "QtQuick.Window/Window 2.0", + "QtQuick.Window/Window 2.1", + "QtQuick.Window/Window 2.2" + ] + exportMetaObjectRevisions: [0, 1, 2] Enum { name: "SceneGraphError" values: { -- cgit v1.2.1 From 61889f06fa828b483513b8315b4f0870532ece66 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 8 Oct 2015 06:34:11 +0000 Subject: Fix compile error when building Qt in a namespace on OS X Change-Id: I1c9e3edf401b4a6b02bafe4086a57679b4ada79c Reviewed-by: Mitch Curtis Reviewed-by: Liang Qi --- src/extras/Styles/Flat/flatstyleplugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/extras/Styles/Flat/flatstyleplugin.cpp b/src/extras/Styles/Flat/flatstyleplugin.cpp index db464c38..a207f0a0 100644 --- a/src/extras/Styles/Flat/flatstyleplugin.cpp +++ b/src/extras/Styles/Flat/flatstyleplugin.cpp @@ -69,7 +69,7 @@ QtQuickExtrasStylesPlugin::QtQuickExtrasStylesPlugin(QObject *parent) : void QtQuickExtrasStylesPlugin::registerTypes(const char *uri) { - Q_INIT_RESOURCE(flatstyle); + initResources(); const QString prefix = "qrc:/ExtrasImports/QtQuick/Controls/Styles/Flat/"; // register version 1.0 -- cgit v1.2.1 From 6914e6e7c55ef450e923c5afe550f080f51a7b77 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 20 Oct 2015 13:11:27 +0200 Subject: Tidy up Layout documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ibbf6237b36d3713b478720addd4ea86a875bd88e Reviewed-by: Topi Reiniö --- src/layouts/qquicklayout.cpp | 49 ++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/layouts/qquicklayout.cpp b/src/layouts/qquicklayout.cpp index d812c112..ddf44b7b 100644 --- a/src/layouts/qquicklayout.cpp +++ b/src/layouts/qquicklayout.cpp @@ -51,7 +51,7 @@ An object of type Layout is attached to children of the layout to provide layout specific information about the item. - The properties of the attached object influences how the layout will arrange the items. + The properties of the attached object influence how the layout will arrange the items. For instance, you can specify \l minimumWidth, \l preferredWidth, and \l maximumWidth if the default values are not satisfactory. @@ -60,18 +60,18 @@ \l{Layout::minimumWidth}{minimum size}, \l{Layout::preferredWidth}{preferred size} and a \l{Layout::maximumWidth}{maximum size}. - If minimum size have not been explicitly specified on an item, the size is set to \c 0. - If maximum size have not been explicitly specified on an item, the size is set to + If minimum size has not been explicitly specified on an item, the size is set to \c 0. + If maximum size has not been explicitly specified on an item, the size is set to \c Number.POSITIVE_INFINITY. - For layouts, the implicit minimum and maximum size depends on the content of the layouts. + For layouts, the implicit minimum and maximum sizes depend on the content of the layouts. - The \l fillWidth and \l fillHeight properties can either be \c true or \c false. If it is \c + The \l fillWidth and \l fillHeight properties can either be \c true or \c false. If they are \c false, the item's size will be fixed to its preferred size. Otherwise, it will grow or shrink between its minimum and maximum size as the layout is resized. \note It is not recommended to have bindings to the x, y, width, or height properties of items - in a layout, since this would conflict with the goal of the Layout, and also cause binding + in a layout, since this would conflict with the goals of Layout, and can also cause binding loops. @@ -117,10 +117,10 @@ QQuickLayoutAttached::QQuickLayoutAttached(QObject *parent) \qmlattachedproperty real Layout::minimumWidth This property holds the minimum width of an item in a layout. - The default value is the items implicit minimum width. + The default value is the item's implicit minimum width. If the item is a layout, the implicit minimum width will be the minimum width the layout can - have without any of its items shrink beyond their minimum width. + have without any of its items shrinking below their minimum width. The implicit minimum width for any other item is \c 0. Setting this value to -1 will reset the width back to its implicit minimum width. @@ -145,10 +145,11 @@ void QQuickLayoutAttached::setMinimumWidth(qreal width) /*! \qmlattachedproperty real Layout::minimumHeight - The default value is the items implicit minimum height. + This property holds the minimum height of an item in a layout. + The default value is the item's implicit minimum height. If the item is a layout, the implicit minimum height will be the minimum height the layout can - have without any of its items shrink beyond their minimum height. + have without any of its items shrinking below their minimum height. The implicit minimum height for any other item is \c 0. Setting this value to -1 will reset the height back to its implicit minimum height. @@ -173,7 +174,7 @@ void QQuickLayoutAttached::setMinimumHeight(qreal height) \qmlattachedproperty real Layout::preferredWidth This property holds the preferred width of an item in a layout. - If the preferred width is -1 it will be ignored, and the layout + If the preferred width is \c -1 it will be ignored, and the layout will use \l{Item::implicitWidth}{implicitWidth} instead. The default is \c -1. @@ -194,7 +195,7 @@ void QQuickLayoutAttached::setPreferredWidth(qreal width) \qmlattachedproperty real Layout::preferredHeight This property holds the preferred height of an item in a layout. - If the preferred height is -1 it will be ignored, and the layout + If the preferred height is \c -1 it will be ignored, and the layout will use \l{Item::implicitHeight}{implicitHeight} instead. The default is \c -1. @@ -215,13 +216,13 @@ void QQuickLayoutAttached::setPreferredHeight(qreal height) \qmlattachedproperty real Layout::maximumWidth This property holds the maximum width of an item in a layout. - The default value is the items implicit maximum width. + The default value is the item's implicit maximum width. If the item is a layout, the implicit maximum width will be the maximum width the layout can - have without any of its items grow beyond their maximum width. + have without any of its items growing beyond their maximum width. The implicit maximum width for any other item is \c Number.POSITIVE_INFINITY. - Setting this value to -1 will reset the width back to its implicit maximum width. + Setting this value to \c -1 will reset the width back to its implicit maximum width. \sa minimumWidth \sa preferredWidth @@ -242,13 +243,13 @@ void QQuickLayoutAttached::setMaximumWidth(qreal width) /*! \qmlattachedproperty real Layout::maximumHeight - The default value is the items implicit maximum height. + The default value is the item's implicit maximum height. If the item is a layout, the implicit maximum height will be the maximum height the layout can - have without any of its items grow beyond their maximum height. + have without any of its items growing beyond their maximum height. The implicit maximum height for any other item is \c Number.POSITIVE_INFINITY. - Setting this value to -1 will reset the height back to its implicit maximum height. + Setting this value to \c -1 will reset the height back to its implicit maximum height. \sa minimumHeight \sa preferredHeight @@ -430,7 +431,7 @@ void QQuickLayoutAttached::setAlignment(Qt::Alignment align) \qmlattachedproperty real Layout::margins Sets the margins outside of an item to all have the same value. The item - itself does not evaluate its own margins. It is the parents responsibility + itself does not evaluate its own margins. It is the parent's responsibility to decide if it wants to evaluate the margins. Specifically, margins are only evaluated by ColumnLayout, RowLayout, @@ -441,12 +442,12 @@ void QQuickLayoutAttached::setAlignment(Qt::Alignment align) Therefore, if an item with margins is a child of another \c Item, its position, size and implicit size will remain unchanged. - Combining margins with alignment will align the item *including* its - margins. For instance, a vertically-centered Item with top margin 1 and - bottom margin 9 will cause the Items effective alignment within the cell to - be 4 pixels above the center. + Combining margins with alignment will align the item \e including its + margins. For instance, a vertically-centered Item with a top margin of \c 1 + and a bottom margin of \c 9 will cause the Items effective alignment within + the cell to be 4 pixels above the center. - The default value is 0 + The default value is \c 0. \sa leftMargin \sa topMargin -- cgit v1.2.1 From 7ab104b60802e1d031f26232d108a65998dd40cd Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 13 Oct 2015 12:48:54 +0200 Subject: Doc: Update examplesinstallpath to include the repository name The examplesinstallpath variable in .qdocconf files defines the path under QT_INSTALL_EXAMPLES where examples are found. To match the way examples are packaged in Qt 5.6, prefix the install path with the repository name. Task-number: QTBUG-48736 Change-Id: I5630d8d7a566d57fea84447ca6099d8ab95bc681 Reviewed-by: Venugopal Shivashankar --- src/controls/doc/qtquickcontrols.qdocconf | 2 +- src/dialogs/doc/qtquickdialogs.qdocconf | 2 +- src/extras/doc/qtquickextras.qdocconf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/controls/doc/qtquickcontrols.qdocconf b/src/controls/doc/qtquickcontrols.qdocconf index 33df123f..6ea7e741 100644 --- a/src/controls/doc/qtquickcontrols.qdocconf +++ b/src/controls/doc/qtquickcontrols.qdocconf @@ -41,7 +41,7 @@ depends = qtcore qtdoc qtgui qtwidgets qtqml qtquick qtquicklayouts qtquickdialo # is given as part of \example commands exampledirs += ../../../examples/quick/controls \ snippets -examplesinstallpath = quick/controls +examplesinstallpath = qtquickcontrols/quick/controls headerdirs += .. diff --git a/src/dialogs/doc/qtquickdialogs.qdocconf b/src/dialogs/doc/qtquickdialogs.qdocconf index 2dd08ed6..30f3635a 100644 --- a/src/dialogs/doc/qtquickdialogs.qdocconf +++ b/src/dialogs/doc/qtquickdialogs.qdocconf @@ -26,7 +26,7 @@ depends = qtqml qtquick qtgui qtwidgets qtdoc qtcore exampledirs += ../../../examples/quick/dialogs -examplesinstallpath = quick/dialogs +examplesinstallpath = qtquickcontrols/quick/dialogs headerdirs += .. diff --git a/src/extras/doc/qtquickextras.qdocconf b/src/extras/doc/qtquickextras.qdocconf index a802d9fa..747465fc 100644 --- a/src/extras/doc/qtquickextras.qdocconf +++ b/src/extras/doc/qtquickextras.qdocconf @@ -30,7 +30,7 @@ qhp.QtQuickExtras.subprojects.qtquickextrasexamples.sortPages = true depends = qtqml qtquick qtdoc qtquickcontrols qtgui exampledirs += ../../../examples/quick/extras -examplesinstallpath = quick/extras +examplesinstallpath = qtquickcontrols/quick/extras headerdirs += ../ -- cgit v1.2.1 From 32d11f2d679b811c9af349fe9f0b0b29d4f598c0 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 13 Oct 2015 17:53:33 +0200 Subject: Avoid real-rounding glitches near ends of a slider's range. Floating point doesn't quite reliably satisfy certain standard identities of arithmetic ... Task-number: QTBUG-42358 Change-Id: I7417feedbfc1fd6f59510e0ee6d07d98ff7ddc46 Reviewed-by: Mitch Curtis --- src/controls/Private/qquickrangemodel_p_p.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/controls/Private/qquickrangemodel_p_p.h b/src/controls/Private/qquickrangemodel_p_p.h index 67f0745c..235ba069 100644 --- a/src/controls/Private/qquickrangemodel_p_p.h +++ b/src/controls/Private/qquickrangemodel_p_p.h @@ -93,7 +93,11 @@ public: return minimum; const qreal scale = (maximum - minimum) / posRange; - return (pos - effectivePosAtMin()) * scale + minimum; + // Avoid perverse rounding glitches when at an end: + const qreal mid = (effectivePosAtMax() + effectivePosAtMin()) * 0.5; + if (pos < mid) + return (pos - effectivePosAtMin()) * scale + minimum; + return maximum - scale * (effectivePosAtMax() - pos); } qreal publicPosition(qreal position) const; -- cgit v1.2.1 From d7f141944aee1e9d5a264168ea2d1d917a1e24b8 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 22 Oct 2015 09:31:23 +0200 Subject: GroupBoxStyle: work around Binding regression Change-Id: I1541593e3aed08a82a0041a68c93a3cb753236fc Task-number: QTBUG-48918 Reviewed-by: J-P Nurmi --- src/extras/Styles/Flat/GroupBoxStyle.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/extras/Styles/Flat/GroupBoxStyle.qml b/src/extras/Styles/Flat/GroupBoxStyle.qml index 65f8cf19..e72c6075 100644 --- a/src/extras/Styles/Flat/GroupBoxStyle.qml +++ b/src/extras/Styles/Flat/GroupBoxStyle.qml @@ -65,8 +65,8 @@ Private.GroupBoxStyle { // TODO: Binding { - target: root - property: "padding.top" + target: root.padding + property: "top" value: background.anchors.topMargin + root.spacing } -- cgit v1.2.1 From 34767778f6409f414add562eaad0eac11d88149d Mon Sep 17 00:00:00 2001 From: Karim Pinter Date: Thu, 15 Oct 2015 15:39:05 +0000 Subject: Adding animation interval for tumbler Extending the Tumblers setCurrentIndexAt method with timeinterval, which is set to the animation so while it changes it can move slower then default. Task-number: QTBUG-48680 Change-Id: Ic8e76c604bad928ae7b11cfbea76c11d5d295f80 Reviewed-by: Mitch Curtis --- src/extras/Tumbler.qml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/extras/Tumbler.qml b/src/extras/Tumbler.qml index 7cba6ed0..47cb043c 100644 --- a/src/extras/Tumbler.qml +++ b/src/extras/Tumbler.qml @@ -177,20 +177,19 @@ Control { } /*! - \qmlmethod void Tumbler::setCurrentIndexAt(int columnIndex, int itemIndex) - Sets the current index of the column at \a columnIndex to \a itemIndex. + \qmlmethod void Tumbler::setCurrentIndexAt(int columnIndex, int itemIndex, int interval) + Sets the current index of the column at \a columnIndex to \a itemIndex. The animation + length can be set with \a interval, which defaults to \c 0. Does nothing if \a columnIndex or \a itemIndex are invalid. */ - function setCurrentIndexAt(columnIndex, itemIndex) { + function setCurrentIndexAt(columnIndex, itemIndex, interval) { if (!__isValidColumnAndItemIndex(columnIndex, itemIndex)) return; var view = columnRepeater.itemAt(columnIndex).view; if (view.currentIndex !== itemIndex) { - // Hack to work around the pathview jumping when the index is changed. - // TODO: doesn't seem to be necessary anymore? - view.highlightMoveDuration = 0; + view.highlightMoveDuration = typeof interval !== 'undefined' ? interval : 0; view.currentIndex = itemIndex; view.highlightMoveDuration = Qt.binding(function(){ return __highlightMoveDuration; }); } -- cgit v1.2.1 From 4cfdab4a3317b09dab9c4000b6a004d2ea0560c1 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 14 Oct 2015 17:58:29 +0200 Subject: Avoid redundant relayout when adding or removing items MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QQuickLayout::itemChange() already takes care of this. Change-Id: I2f8e81f6797de7c533c36730e55a97bedfdddd92 Reviewed-by: Jan Arve Sæther --- src/layouts/qquicklinearlayout.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/layouts/qquicklinearlayout.cpp b/src/layouts/qquicklinearlayout.cpp index cbd32976..78cc635c 100644 --- a/src/layouts/qquicklinearlayout.cpp +++ b/src/layouts/qquicklinearlayout.cpp @@ -464,15 +464,11 @@ void QQuickGridLayoutBase::itemChange(ItemChange change, const ItemChangeData &v QQuickItem *item = value.item; QObject::connect(item, SIGNAL(destroyed()), this, SLOT(onItemDestroyed())); QObject::connect(item, SIGNAL(visibleChanged()), this, SLOT(onItemVisibleChanged())); - if (isReady()) - updateLayoutItems(); } else if (change == ItemChildRemovedChange) { quickLayoutDebug() << "ItemChildRemovedChange"; QQuickItem *item = value.item; QObject::disconnect(item, SIGNAL(destroyed()), this, SLOT(onItemDestroyed())); QObject::disconnect(item, SIGNAL(visibleChanged()), this, SLOT(onItemVisibleChanged())); - if (isReady()) - updateLayoutItems(); } QQuickLayout::itemChange(change, value); -- cgit v1.2.1 From d3dbbe4781c4a7137ada0324e6ec5b14fed5c859 Mon Sep 17 00:00:00 2001 From: Nikita Krupenko Date: Thu, 22 Oct 2015 18:44:20 +0300 Subject: Allow ComboBox to select items with empty text ComboBox checks selected text like a boolean value. This check is unnecessary and prevents from item with empty text could be selected. [ChangeLog][ComboBox] ComboBox is now able to select items with empty text. Task-number: QTBUG-42127 Change-Id: Ifaa0598d17c85cee099c88f4e03092137ba17c70 Reviewed-by: Mitch Curtis --- src/controls/ComboBox.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml index a2eff0b6..8a2908b5 100644 --- a/src/controls/ComboBox.qml +++ b/src/controls/ComboBox.qml @@ -518,7 +518,7 @@ Control { style: isPopup ? __style.__popupStyle : __style.__dropDownStyle property string currentText: selectedText - onSelectedTextChanged: if (selectedText) popup.currentText = selectedText + onSelectedTextChanged: popup.currentText = selectedText property string selectedText on__SelectedIndexChanged: { -- cgit v1.2.1 From afbf1fcb251c1f751758f62317f1cd9795b79310 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 2 Sep 2015 13:51:45 +0200 Subject: ScrollView: Don't depend on originY for the internal scrollbar While originY (and originX) are always zero for Flickable, other types, like ListView, can and will set its value as items are added or removed from the view. However, having the internal scrollbars depend on originY may cause extra updates and interfere with ListView transitions. This changes just hardcodes the scrollbar's minimum value to 0 and translates its value by originY. We also made the code in ScrollViewHelper a bit more readable, mostly by renaming the top-level item's id from 'wheelArea' to 'scrollHelper'. Change-Id: Iac0b4e1dc3ca50ff3cc50fbb85ccaf1eca88edba Task-number: QTBUG-48044 Reviewed-by: Mitch Curtis --- src/controls/Private/ScrollViewHelper.qml | 48 ++++++++++++++----------------- src/controls/ScrollView.qml | 27 ++++++++--------- 2 files changed, 35 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/controls/Private/ScrollViewHelper.qml b/src/controls/Private/ScrollViewHelper.qml index e63d33ff..d34aa555 100644 --- a/src/controls/Private/ScrollViewHelper.qml +++ b/src/controls/Private/ScrollViewHelper.qml @@ -44,7 +44,7 @@ import QtQuick.Controls.Private 1.0 \inqmlmodule QtQuick.Controls.Private */ Item { - id: wheelarea + id: scrollHelper property alias horizontalScrollBar: hscrollbar property alias verticalScrollBar: vscrollbar @@ -53,8 +53,6 @@ Item { property int availableWidth property int contentHeight property int contentWidth - property real originX - property real originY property bool active property int horizontalScrollBarPolicy: Qt.ScrollBarAsNeeded property int verticalScrollBarPolicy: Qt.ScrollBarAsNeeded @@ -72,12 +70,10 @@ Item { function doLayout() { if (!recursionGuard) { recursionGuard = true - wheelarea.availableWidth = viewport.width - wheelarea.availableHeight = viewport.height - wheelarea.contentWidth = flickableItem !== null ? flickableItem.contentWidth : 0 - wheelarea.contentHeight = flickableItem !== null ? flickableItem.contentHeight : 0 - wheelarea.originX = flickableItem !== null ? flickableItem.originX : 0 - wheelarea.originY = flickableItem !== null ? flickableItem.originY : 0 + scrollHelper.availableWidth = viewport.width + scrollHelper.availableHeight = viewport.height + scrollHelper.contentWidth = flickableItem !== null ? flickableItem.contentWidth : 0 + scrollHelper.contentHeight = flickableItem !== null ? flickableItem.contentHeight : 0 recursionGuard = false } } @@ -92,12 +88,6 @@ Item { target: flickableItem onContentWidthChanged: doLayout() onContentHeightChanged: doLayout() - onOriginXChanged: doLayout() - onOriginYChanged: doLayout() - } - - Connections { - target: flickableItem onContentXChanged: { hscrollbar.flash() vscrollbar.flash() @@ -123,15 +113,17 @@ Item { ScrollBar { id: hscrollbar + readonly property int scrollAmount: contentWidth - availableWidth + readonly property bool scrollable: scrollAmount > 0 isTransient: !!__panel && !!__panel.isTransient active: !!__panel && (__panel.sunken || __panel.activeControl !== "none") enabled: !isTransient || __panel.visible orientation: Qt.Horizontal - visible: horizontalScrollBarPolicy == Qt.ScrollBarAsNeeded ? (contentWidth > availableWidth) : horizontalScrollBarPolicy == Qt.ScrollBarAlwaysOn + visible: horizontalScrollBarPolicy == Qt.ScrollBarAsNeeded ? scrollable : horizontalScrollBarPolicy == Qt.ScrollBarAlwaysOn height: visible ? implicitHeight : 0 z: 1 - maximumValue: contentWidth > availableWidth ? originX + contentWidth - availableWidth : 0 - minimumValue: originX + maximumValue: scrollable ? scrollAmount : 0 + minimumValue: 0 anchors.bottom: parent.bottom anchors.left: parent.left anchors.right: cornerFill.left @@ -139,20 +131,20 @@ Item { anchors.bottomMargin: bottomMargin onValueChanged: { if (!blockUpdates) { - flickableItem.contentX = value + flickableItem.contentX = value + flickableItem.originX } } Binding { target: hscrollbar.__panel property: "raised" - value: vscrollbar.active || wheelarea.active + value: vscrollbar.active || scrollHelper.active when: hscrollbar.isTransient } Binding { target: hscrollbar.__panel property: "visible" value: true - when: !hscrollbar.isTransient || wheelarea.active + when: !hscrollbar.isTransient || scrollHelper.active } function flash() { if (hscrollbar.isTransient) { @@ -170,36 +162,38 @@ Item { ScrollBar { id: vscrollbar + readonly property int scrollAmount: contentHeight - availableHeight + readonly property bool scrollable: scrollAmount > 0 isTransient: !!__panel && !!__panel.isTransient active: !!__panel && (__panel.sunken || __panel.activeControl !== "none") enabled: !isTransient || __panel.visible orientation: Qt.Vertical - visible: verticalScrollBarPolicy == Qt.ScrollBarAsNeeded ? (contentHeight > availableHeight) : verticalScrollBarPolicy == Qt.ScrollBarAlwaysOn + visible: verticalScrollBarPolicy === Qt.ScrollBarAsNeeded ? scrollable : verticalScrollBarPolicy === Qt.ScrollBarAlwaysOn width: visible ? implicitWidth : 0 z: 1 anchors.bottom: cornerFill.top - maximumValue: contentHeight > availableHeight ? originY + contentHeight - availableHeight + __viewTopMargin : 0 - minimumValue: originY + maximumValue: scrollable ? scrollAmount + __viewTopMargin : 0 + minimumValue: 0 anchors.right: parent.right anchors.top: parent.top anchors.topMargin: __scrollBarTopMargin + topMargin anchors.rightMargin: rightMargin onValueChanged: { if (flickableItem && !blockUpdates && enabled) { - flickableItem.contentY = value + flickableItem.contentY = value + flickableItem.originY } } Binding { target: vscrollbar.__panel property: "raised" - value: hscrollbar.active || wheelarea.active + value: hscrollbar.active || scrollHelper.active when: vscrollbar.isTransient } Binding { target: vscrollbar.__panel property: "visible" value: true - when: !vscrollbar.isTransient || wheelarea.active + when: !vscrollbar.isTransient || scrollHelper.active } function flash() { if (vscrollbar.isTransient) { diff --git a/src/controls/ScrollView.qml b/src/controls/ScrollView.qml index 74d5ee7d..e6001b04 100644 --- a/src/controls/ScrollView.qml +++ b/src/controls/ScrollView.qml @@ -238,13 +238,13 @@ FocusScope { onContentYChanged: { scroller.blockUpdates = true - scroller.verticalScrollBar.value = flickableItem.contentY + scroller.verticalScrollBar.value = flickableItem.contentY - flickableItem.originY scroller.blockUpdates = false } onContentXChanged: { scroller.blockUpdates = true - scroller.horizontalScrollBar.value = flickableItem.contentX + scroller.horizontalScrollBar.value = flickableItem.contentX - flickableItem.originX scroller.blockUpdates = false } @@ -274,11 +274,11 @@ FocusScope { property bool horizontalRecursionGuard: false property bool verticalRecursionGuard: false - horizontalMinimumValue: flickableItem ? flickableItem.originX : 0 - horizontalMaximumValue: flickableItem ? flickableItem.originX + flickableItem.contentWidth - viewport.width : 0 + horizontalMinimumValue: 0 + horizontalMaximumValue: flickableItem ? flickableItem.contentWidth - viewport.width : 0 - verticalMinimumValue: flickableItem ? flickableItem.originY : 0 - verticalMaximumValue: flickableItem ? flickableItem.originY + flickableItem.contentHeight - viewport.height + __viewTopMargin : 0 + verticalMinimumValue: 0 + verticalMaximumValue: flickableItem ? flickableItem.contentHeight - viewport.height + __viewTopMargin : 0 // The default scroll speed for typical angle-based mouse wheels. The value // comes originally from QTextEdit, which sets 20px steps by default, as well as @@ -291,32 +291,33 @@ FocusScope { onContentYChanged: { wheelArea.verticalRecursionGuard = true - wheelArea.verticalValue = flickableItem.contentY + wheelArea.verticalValue = flickableItem.contentY - flickableItem.originY wheelArea.verticalRecursionGuard = false } onContentXChanged: { wheelArea.horizontalRecursionGuard = true - wheelArea.horizontalValue = flickableItem.contentX + wheelArea.horizontalValue = flickableItem.contentX - flickableItem.originX wheelArea.horizontalRecursionGuard = false } } onVerticalValueChanged: { if (!verticalRecursionGuard) { - if (flickableItem.contentY < flickThreshold && verticalDelta > speedThreshold) { + var effectiveContentY = flickableItem.contentY - flickableItem.originY + if (effectiveContentY < flickThreshold && verticalDelta > speedThreshold) { flickableItem.flick(ignored, Math.min(maxFlick, acceleration * verticalDelta)) - } else if (flickableItem.contentY > flickableItem.contentHeight - - flickThreshold - viewport.height && verticalDelta < -speedThreshold) { + } else if (effectiveContentY > flickableItem.contentHeight - flickThreshold - viewport.height + && verticalDelta < -speedThreshold) { flickableItem.flick(ignored, Math.max(-maxFlick, acceleration * verticalDelta)) } else { - flickableItem.contentY = verticalValue + flickableItem.contentY = verticalValue + flickableItem.originY } } } onHorizontalValueChanged: { if (!horizontalRecursionGuard) - flickableItem.contentX = horizontalValue + flickableItem.contentX = horizontalValue + flickableItem.originX } } -- cgit v1.2.1 From 42c04ed29c36eec70cdce58e5c2d19faec62d039 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Thu, 17 Sep 2015 14:24:03 +0200 Subject: Fix {Row|Grid}Layout to adhere to sibling order of its children In order to reduce the number of temporary calls to updateLayoutItems, I should postpone it until the item is completed. This will be a separate patch. This is a backport of change 59f7b30d41b06b1d9da81aea5784d57ecd91ab04 Change-Id: Iee495ee3d85a03407b06d06d8076c5c63d3d20cf Task-number: QTBUG-45152 Reviewed-by: Ulf Hermann --- src/layouts/qquicklayout.cpp | 8 ++++++++ src/layouts/qquicklayout_p.h | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/layouts/qquicklayout.cpp b/src/layouts/qquicklayout.cpp index ddf44b7b..f28a7d07 100644 --- a/src/layouts/qquicklayout.cpp +++ b/src/layouts/qquicklayout.cpp @@ -759,6 +759,7 @@ void QQuickLayout::itemChange(ItemChange change, const ItemChangeData &value) QObject::connect(item, SIGNAL(implicitWidthChanged()), this, SLOT(invalidateSenderItem())); QObject::connect(item, SIGNAL(implicitHeightChanged()), this, SLOT(invalidateSenderItem())); QObject::connect(item, SIGNAL(baselineOffsetChanged(qreal)), this, SLOT(invalidateSenderItem())); + QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickItemPrivate::SiblingOrder); if (isReady()) updateLayoutItems(); } else if (change == ItemChildRemovedChange) { @@ -766,6 +767,7 @@ void QQuickLayout::itemChange(ItemChange change, const ItemChangeData &value) QObject::disconnect(item, SIGNAL(implicitWidthChanged()), this, SLOT(invalidateSenderItem())); QObject::disconnect(item, SIGNAL(implicitHeightChanged()), this, SLOT(invalidateSenderItem())); QObject::disconnect(item, SIGNAL(baselineOffsetChanged(qreal)), this, SLOT(invalidateSenderItem())); + QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::SiblingOrder); if (isReady()) updateLayoutItems(); } @@ -797,6 +799,12 @@ bool QQuickLayout::isReady() const return d_func()->m_isReady; } +void QQuickLayout::itemSiblingOrderChanged(QQuickItem *item) +{ + Q_UNUSED(item); + updateLayoutItems(); +} + void QQuickLayout::rearrange(const QSizeF &/*size*/) { m_dirty = false; diff --git a/src/layouts/qquicklayout_p.h b/src/layouts/qquicklayout_p.h index d613f5bd..4379d7f8 100644 --- a/src/layouts/qquicklayout_p.h +++ b/src/layouts/qquicklayout_p.h @@ -40,6 +40,7 @@ #include #include #include +#include #include QT_BEGIN_NAMESPACE @@ -53,7 +54,8 @@ class QQuickLayoutAttached; #endif class QQuickLayoutPrivate; -class QQuickLayout : public QQuickItem +class QQuickLayout : public QQuickItem, public QQuickItemChangeListener + { Q_OBJECT public: @@ -92,6 +94,9 @@ public: bool isReady() const; + /* QQuickItemChangeListener */ + void itemSiblingOrderChanged(QQuickItem *item) Q_DECL_OVERRIDE; + protected: void updatePolish() Q_DECL_OVERRIDE; -- cgit v1.2.1 From 1adb58bb6d31234dc9e05ce95b60aa1be7c75373 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 2 Nov 2015 13:08:25 +0100 Subject: TextField: hide placeholder text when h-centered & focused The same was done to QLineEdit in qtbase commit a2666d3. A quote from the commit message: A blinking cursor in the middle over horizontally centered placeholder text looks bad. Thus, horizontally centered content is now considered as an exception and the placeholder text is hidden when the line edit is focused. Change-Id: I2230b9a2254c79676f9fdc308927092e1af4db49 Task-number: QTBUG-49147 Reviewed-by: Mitch Curtis --- src/controls/TextField.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/controls/TextField.qml b/src/controls/TextField.qml index 0c8a0df6..c5d5d2b5 100644 --- a/src/controls/TextField.qml +++ b/src/controls/TextField.qml @@ -625,7 +625,7 @@ Control { font: textInput.font horizontalAlignment: textInput.horizontalAlignment verticalAlignment: textInput.verticalAlignment - opacity: textInput.displayText.length ? 0.0 : 1.0 + opacity: !textInput.displayText && (!textInput.activeFocus || textInput.horizontalAlignment !== Qt.AlignHCenter) ? 1.0 : 0.0 color: __panel ? __panel.placeholderTextColor : "darkgray" clip: contentWidth > width; elide: Text.ElideRight -- cgit v1.2.1 From c8337d9779b87bc427842a9617179aca3b869d0a Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 3 Nov 2015 12:31:08 +0100 Subject: Rename QQuickExclusiveGroup to QQuickExclusiveGroup1 This avoids clashes between Qt Quick Controls and Qt Labs Controls. No other classes have this problem, as this is the only class with the same name as that of one in Qt Labs Controls. Change-Id: I6223e6b42654330abda7942dc5c7a2b3ad942b70 Task-number: QTBUG-48240 Reviewed-by: J-P Nurmi --- src/controls/plugin.cpp | 2 +- src/controls/qquickaction.cpp | 4 ++-- src/controls/qquickaction_p.h | 10 +++++----- src/controls/qquickexclusivegroup.cpp | 22 +++++++++++----------- src/controls/qquickexclusivegroup_p.h | 10 +++++----- src/controls/qquickmenuitem.cpp | 4 ++-- src/controls/qquickmenuitem_p.h | 8 ++++---- 7 files changed, 30 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/controls/plugin.cpp b/src/controls/plugin.cpp index e1afeef2..b4a4963d 100644 --- a/src/controls/plugin.cpp +++ b/src/controls/plugin.cpp @@ -122,7 +122,7 @@ void QtQuickControlsPlugin::registerTypes(const char *uri) { initResources(); qmlRegisterType(uri, 1, 0, "Action"); - qmlRegisterType(uri, 1, 0, "ExclusiveGroup"); + qmlRegisterType(uri, 1, 0, "ExclusiveGroup"); qmlRegisterType(uri, 1, 0, "MenuItem"); qmlRegisterUncreatableType(uri, 1, 0, "MenuItemType", QLatin1String("Do not create objects of type MenuItemType")); diff --git a/src/controls/qquickaction.cpp b/src/controls/qquickaction.cpp index 6add916d..47032aab 100644 --- a/src/controls/qquickaction.cpp +++ b/src/controls/qquickaction.cpp @@ -392,12 +392,12 @@ void QQuickAction::setChecked(bool c) emit toggled(m_checked); } -QQuickExclusiveGroup *QQuickAction::exclusiveGroup() const +QQuickExclusiveGroup1 *QQuickAction::exclusiveGroup() const { return m_exclusiveGroup.data(); } -void QQuickAction::setExclusiveGroup(QQuickExclusiveGroup *eg) +void QQuickAction::setExclusiveGroup(QQuickExclusiveGroup1 *eg) { if (m_exclusiveGroup == eg) return; diff --git a/src/controls/qquickaction_p.h b/src/controls/qquickaction_p.h index e3b9c852..953cfcb0 100644 --- a/src/controls/qquickaction_p.h +++ b/src/controls/qquickaction_p.h @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE -class QQuickExclusiveGroup; +class QQuickExclusiveGroup1; class QQuickAction : public QObject { @@ -61,7 +61,7 @@ class QQuickAction : public QObject Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY checkableChanged) Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled) - Q_PROPERTY(QQuickExclusiveGroup *exclusiveGroup READ exclusiveGroup WRITE setExclusiveGroup NOTIFY exclusiveGroupChanged) + Q_PROPERTY(QQuickExclusiveGroup1 *exclusiveGroup READ exclusiveGroup WRITE setExclusiveGroup NOTIFY exclusiveGroupChanged) #ifndef QT_NO_SHORTCUT Q_PROPERTY(QVariant shortcut READ shortcut WRITE setShortcut NOTIFY shortcutChanged) #endif @@ -99,8 +99,8 @@ public: bool isChecked() const { return m_checkable && m_checked; } void setChecked(bool c); - QQuickExclusiveGroup *exclusiveGroup() const; - void setExclusiveGroup(QQuickExclusiveGroup *arg); + QQuickExclusiveGroup1 *exclusiveGroup() const; + void setExclusiveGroup(QQuickExclusiveGroup1 *arg); QIcon icon() const { return m_icon; } QVariant iconVariant() const { return QVariant(m_icon); } @@ -135,7 +135,7 @@ private: bool m_enabled; bool m_checkable; bool m_checked; - QPointer m_exclusiveGroup; + QPointer m_exclusiveGroup; QKeySequence m_shortcut; QKeySequence m_mnemonic; QString m_tooltip; diff --git a/src/controls/qquickexclusivegroup.cpp b/src/controls/qquickexclusivegroup.cpp index 08fe6d58..9682b85d 100644 --- a/src/controls/qquickexclusivegroup.cpp +++ b/src/controls/qquickexclusivegroup.cpp @@ -60,7 +60,7 @@ static bool isChecked(const QObject *o) /*! \qmltype ExclusiveGroup - \instantiates QQuickExclusiveGroup + \instantiates QQuickExclusiveGroup1 \ingroup controls \inqmlmodule QtQuick.Controls \brief ExclusiveGroup provides a way to declare several checkable controls as mutually exclusive. @@ -172,25 +172,25 @@ static bool isChecked(const QObject *o) \sa ExclusiveGroup::bindCheckable() */ -QQuickExclusiveGroup::QQuickExclusiveGroup(QObject *parent) +QQuickExclusiveGroup1::QQuickExclusiveGroup1(QObject *parent) : QObject(parent), m_current(0) { int index = metaObject()->indexOfMethod("updateCurrent()"); m_updateCurrentMethod = metaObject()->method(index); } -QQmlListProperty QQuickExclusiveGroup::actions() +QQmlListProperty QQuickExclusiveGroup1::actions() { - return QQmlListProperty(this, 0, &QQuickExclusiveGroup::append_actions, 0, 0, 0); + return QQmlListProperty(this, 0, &QQuickExclusiveGroup1::append_actions, 0, 0, 0); } -void QQuickExclusiveGroup::append_actions(QQmlListProperty *list, QQuickAction *action) +void QQuickExclusiveGroup1::append_actions(QQmlListProperty *list, QQuickAction *action) { - if (QQuickExclusiveGroup *eg = qobject_cast(list->object)) + if (QQuickExclusiveGroup1 *eg = qobject_cast(list->object)) action->setExclusiveGroup(eg); } -void QQuickExclusiveGroup::setCurrent(QObject * o) +void QQuickExclusiveGroup1::setCurrent(QObject * o) { if (m_current == o) return; @@ -203,14 +203,14 @@ void QQuickExclusiveGroup::setCurrent(QObject * o) emit currentChanged(); } -void QQuickExclusiveGroup::updateCurrent() +void QQuickExclusiveGroup1::updateCurrent() { QObject *checkable = sender(); if (isChecked(checkable)) setCurrent(checkable); } -void QQuickExclusiveGroup::bindCheckable(QObject *o) +void QQuickExclusiveGroup1::bindCheckable(QObject *o) { for (const char **signalName = checkableSignals; *signalName; signalName++) { int signalIndex = o->metaObject()->indexOfSignal(*signalName); @@ -224,10 +224,10 @@ void QQuickExclusiveGroup::bindCheckable(QObject *o) } } - qWarning() << "QQuickExclusiveGroup::bindCheckable(): Cannot bind to" << o; + qWarning() << "QQuickExclusiveGroup1::bindCheckable(): Cannot bind to" << o; } -void QQuickExclusiveGroup::unbindCheckable(QObject *o) +void QQuickExclusiveGroup1::unbindCheckable(QObject *o) { if (m_current == o) setCurrent(0); diff --git a/src/controls/qquickexclusivegroup_p.h b/src/controls/qquickexclusivegroup_p.h index 05256dcf..835bdb5e 100644 --- a/src/controls/qquickexclusivegroup_p.h +++ b/src/controls/qquickexclusivegroup_p.h @@ -34,8 +34,8 @@ ** ****************************************************************************/ -#ifndef QQUICKEXCLUSIVEGROUP_H -#define QQUICKEXCLUSIVEGROUP_H +#ifndef QQUICKEXCLUSIVEGROUP1_H +#define QQUICKEXCLUSIVEGROUP1_H #include #include @@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE class QQuickAction; -class QQuickExclusiveGroup : public QObject +class QQuickExclusiveGroup1 : public QObject { Q_OBJECT @@ -54,7 +54,7 @@ class QQuickExclusiveGroup : public QObject Q_CLASSINFO("DefaultProperty", "__actions") public: - explicit QQuickExclusiveGroup(QObject *parent = 0); + explicit QQuickExclusiveGroup1(QObject *parent = 0); QObject *current() const { return m_current; } void setCurrent(QObject * o); @@ -80,4 +80,4 @@ private: QT_END_NAMESPACE -#endif // QQUICKEXCLUSIVEGROUP_H +#endif // QQUICKEXCLUSIVEGROUP1_H diff --git a/src/controls/qquickmenuitem.cpp b/src/controls/qquickmenuitem.cpp index 0702d398..d2236bf5 100644 --- a/src/controls/qquickmenuitem.cpp +++ b/src/controls/qquickmenuitem.cpp @@ -657,12 +657,12 @@ void QQuickMenuItem::updateChecked() emit toggled(checked); } -QQuickExclusiveGroup *QQuickMenuItem::exclusiveGroup() const +QQuickExclusiveGroup1 *QQuickMenuItem::exclusiveGroup() const { return action()->exclusiveGroup(); } -void QQuickMenuItem::setExclusiveGroup(QQuickExclusiveGroup *eg) +void QQuickMenuItem::setExclusiveGroup(QQuickExclusiveGroup1 *eg) { if (!m_boundAction) action()->setExclusiveGroup(eg); diff --git a/src/controls/qquickmenuitem_p.h b/src/controls/qquickmenuitem_p.h index fe05c9c3..d8f3ca32 100644 --- a/src/controls/qquickmenuitem_p.h +++ b/src/controls/qquickmenuitem_p.h @@ -50,7 +50,7 @@ class QUrl; class QPlatformMenuItem; class QQuickItem; class QQuickAction; -class QQuickExclusiveGroup; +class QQuickExclusiveGroup1; class QQuickMenu; class QQuickMenuItemContainer; @@ -173,7 +173,7 @@ class QQuickMenuItem : public QQuickMenuText Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) Q_PROPERTY(bool checkable READ checkable WRITE setCheckable NOTIFY checkableChanged) Q_PROPERTY(bool checked READ checked WRITE setChecked NOTIFY toggled) - Q_PROPERTY(QQuickExclusiveGroup *exclusiveGroup READ exclusiveGroup WRITE setExclusiveGroup NOTIFY exclusiveGroupChanged) + Q_PROPERTY(QQuickExclusiveGroup1 *exclusiveGroup READ exclusiveGroup WRITE setExclusiveGroup NOTIFY exclusiveGroupChanged) Q_PROPERTY(QVariant shortcut READ shortcut WRITE setShortcut NOTIFY shortcutChanged) Q_PROPERTY(QQuickAction *action READ boundAction WRITE setBoundAction NOTIFY actionChanged) @@ -213,8 +213,8 @@ public: bool checked() const; void setChecked(bool checked); - QQuickExclusiveGroup *exclusiveGroup() const; - void setExclusiveGroup(QQuickExclusiveGroup *); + QQuickExclusiveGroup1 *exclusiveGroup() const; + void setExclusiveGroup(QQuickExclusiveGroup1 *); void setParentMenu(QQuickMenu *parentMenu); -- cgit v1.2.1 From b2492f31fd55b7b7335154464c1c12a6895f5a23 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 29 Oct 2015 14:00:29 +0100 Subject: BasicTableView: Use ListView's overlay header for the table header Previoulsy we manually positioned the table header over the table contents, which required some manual tweakings. Since 5.4, ListView support overlay headers that we can use them to clean our code in BasicTableView. There is, however, a small issue on Mac where the vertical scrollbar (specially in non-transient mode) is displayed below the table header. Since the header can't span beyond the ListView boundaries, we need to account for the vertical scrollbar width in the ListView's content width. This patch also updates the Desktop style to set the transientScrollBars property and some small tweaks to the Base style. Change-Id: I4433d0703328f23eadb0ae4563fbef5bba0168db Task-number: QTBUG-34344 Reviewed-by: Mitch Curtis --- src/controls/Private/BasicTableView.qml | 74 +++++++++++++----------- src/controls/ScrollView.qml | 8 ++- src/controls/Styles/Base/BasicTableViewStyle.qml | 9 +-- src/controls/Styles/Desktop/ScrollViewStyle.qml | 3 + 4 files changed, 50 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/controls/Private/BasicTableView.qml b/src/controls/Private/BasicTableView.qml index 5fd21167..822086ee 100644 --- a/src/controls/Private/BasicTableView.qml +++ b/src/controls/Private/BasicTableView.qml @@ -45,8 +45,8 @@ // We mean it. // -import QtQuick 2.4 -import QtQuick.Controls 1.3 +import QtQuick 2.6 +import QtQuick.Controls 1.5 import QtQuick.Controls.Private 1.0 import QtQuick.Controls.Styles 1.2 import QtQuick.Window 2.2 @@ -325,7 +325,7 @@ ScrollView { function resizeColumnsToContents () { for (var i = 0; i < __columns.length; ++i) { var col = getColumn(i) - var header = repeater.itemAt(i) + var header = __listView.headerItem.headerRepeater.itemAt(i) if (col) { col.__index = i col.resizeToContents() @@ -349,8 +349,8 @@ ScrollView { implicitHeight: 150 frameVisible: true - __scrollBarTopMargin: (__style && __style.transientScrollBars || Qt.platform.os === "osx") ? headerrow.height : 0 - __viewTopMargin: headerVisible ? headerrow.height : 0 + __scrollBarTopMargin: headerVisible && (listView.transientScrollBars || Qt.platform.os === "osx") + ? listView.headerItem.height : 0 /*! \internal Use this to display user-friendly messages in TableView and TreeView common functions. @@ -395,13 +395,32 @@ ScrollView { focus: true activeFocusOnTab: false Keys.forwardTo: [__mouseArea] - anchors.topMargin: headerVisible ? tableHeader.height : 0 anchors.fill: parent + contentWidth: headerItem.headerRow.width + listView.vScrollbarPadding + // ### FIXME Late configuration of the header item requires + // this binding to get the header visible after creation + contentY: -headerItem.height + currentIndex: -1 visible: columnCount > 0 interactive: Settings.hasTouchScreen property var rowItemStack: [] // Used as a cache for rowDelegates + readonly property bool transientScrollbars: __style && !!__style.transientScrollBars + readonly property real vScrollbarPadding: __scroller.verticalScrollBar.visible + && !transientScrollbars && Qt.platform.os === "osx" ? + __verticalScrollBar.width + __scroller.scrollBarSpacing + root.__style.padding.right : 0 + + Binding { + // On Mac, we reserve the vSB space in the contentItem because the vSB should + // appear under the header. Unfortunately, the ListView header won't expand + // beyond the ListView's boundaries, that's why we need to ressort to this. + target: root.__scroller + when: Qt.platform.os === "osx" + property: "verticalScrollbarOffset" + value: 0 + } + function incrementCurrentIndexBlocking() { var oldIndex = __listView.currentIndex __scroller.blockUpdates = true; @@ -572,7 +591,6 @@ ScrollView { id: itemrow height: parent.height Repeater { - id: repeater model: columnModel delegate: __itemDelegateLoader @@ -588,27 +606,17 @@ ScrollView { } } - Item { + headerPositioning: ListView.OverlayHeader + header: Item { id: tableHeader - clip: true - parent: __scroller visible: headerVisible - anchors.top: parent.top - anchors.topMargin: viewport.anchors.topMargin - anchors.leftMargin: viewport.anchors.leftMargin - anchors.margins: viewport.anchors.margins - anchors.rightMargin: (frameVisible ? __scroller.rightMargin : 0) + - (__scroller.outerFrame && __scrollBarTopMargin ? 0 - : __verticalScrollBar.width + __scroller.scrollBarSpacing + root.__style.padding.right) - - anchors.left: parent.left - anchors.right: parent.right - - height: headerrow.height + width: Math.max(headerRow.width + listView.vScrollbarPadding, root.viewport.width) + height: visible ? headerRow.height : 0 + property alias headerRow: row + property alias headerRepeater: repeater Row { - id: headerrow - x: -listView.contentX + id: row Repeater { id: repeater @@ -632,8 +640,7 @@ ScrollView { Loader { id: headerStyle sourceComponent: root.headerDelegate - anchors.left: parent.left - anchors.right: parent.right + width: parent.width property QtObject styleData: QtObject { readonly property string value: modelData.title readonly property bool pressed: headerClickArea.pressed @@ -670,7 +677,7 @@ ScrollView { onPositionChanged: { if (drag.active && modelData.movable && pressed && columnCount > 1) { // only do this while dragging for (var h = columnCount-1 ; h >= 0 ; --h) { - if (drag.target.x + listView.contentX + headerRowDelegate.width/2 > headerrow.children[h].x) { + if (drag.target.x + listView.contentX + headerRowDelegate.width/2 > headerRow.children[h].x) { repeater.targetIndex = h break } @@ -742,12 +749,9 @@ ScrollView { } } } - - onWidthChanged: listView.contentWidth = width } Loader { - id: loader property QtObject styleData: QtObject{ readonly property string value: "" readonly property bool pressed: false @@ -758,17 +762,17 @@ ScrollView { anchors.top: parent.top anchors.right: parent.right - anchors.bottom: headerrow.bottom - anchors.rightMargin: -2 + anchors.bottom: headerRow.bottom sourceComponent: root.headerDelegate - width: root.width - headerrow.width + 2 - visible: root.columnCount + readonly property real __remainingWidth: parent.width - headerRow.width + visible: __remainingWidth > 0 + width: __remainingWidth z:-1 } } function columnAt(offset) { - var item = headerrow.childAt(offset, 0) + var item = listView.headerItem.headerRow.childAt(offset, 0) return item ? item.column : -1 } } diff --git a/src/controls/ScrollView.qml b/src/controls/ScrollView.qml index e6001b04..a6eaed82 100644 --- a/src/controls/ScrollView.qml +++ b/src/controls/ScrollView.qml @@ -164,7 +164,9 @@ FocusScope { default property Item contentItem /*! \internal */ - property Item __scroller: scroller + property alias __scroller: scroller + /*! \internal */ + property alias __verticalScrollbarOffset: scroller.verticalScrollbarOffset /*! \internal */ property alias __wheelAreaScrollSpeed: wheelArea.scrollSpeed /*! \internal */ @@ -328,9 +330,9 @@ FocusScope { property bool outerFrame: !frameVisible || !(__style ? __style.__externalScrollBars : 0) property int scrollBarSpacing: outerFrame ? 0 : (__style ? __style.__scrollBarSpacing : 0) property int verticalScrollbarOffset: verticalScrollBar.visible && !verticalScrollBar.isTransient ? - verticalScrollBar.width + scrollBarSpacing : 0 + verticalScrollBar.width + scrollBarSpacing : 0 property int horizontalScrollbarOffset: horizontalScrollBar.visible && !horizontalScrollBar.isTransient ? - horizontalScrollBar.height + scrollBarSpacing : 0 + horizontalScrollBar.height + scrollBarSpacing : 0 Loader { id: frameLoader sourceComponent: __style ? __style.frame : null diff --git a/src/controls/Styles/Base/BasicTableViewStyle.qml b/src/controls/Styles/Base/BasicTableViewStyle.qml index c8d817c9..e0a33406 100644 --- a/src/controls/Styles/Base/BasicTableViewStyle.qml +++ b/src/controls/Styles/Base/BasicTableViewStyle.qml @@ -84,7 +84,7 @@ ScrollViewStyle { See qtquickcontrolsstyles-tableviewstyle.qdoc and qtquickcontrolsstyles-treeviewstyle.qdoc */ property Component headerDelegate: BorderImage { - height: textItem.implicitHeight * 1.2 + height: Math.round(textItem.implicitHeight * 1.2) source: "images/header.png" border.left: 4 border.bottom: 2 @@ -102,12 +102,9 @@ ScrollViewStyle { renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering } Rectangle { - anchors.right: parent.right - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.bottomMargin: 1 - anchors.topMargin: 1 width: 1 + height: parent.height - 2 + y: 1 color: "#ccc" } } diff --git a/src/controls/Styles/Desktop/ScrollViewStyle.qml b/src/controls/Styles/Desktop/ScrollViewStyle.qml index 0ec5788f..bba99fde 100644 --- a/src/controls/Styles/Desktop/ScrollViewStyle.qml +++ b/src/controls/Styles/Desktop/ScrollViewStyle.qml @@ -71,6 +71,7 @@ Style { readonly property bool __externalScrollBars: __styleitem.styleHint("externalScrollBars") readonly property int __scrollBarSpacing: __styleitem.pixelMetric("scrollbarspacing") readonly property bool scrollToClickedPosition: __styleitem.styleHint("scrollToClickPosition") !== 0 + property bool transientScrollBars: false readonly property int __wheelScrollLines: __styleitem.styleHint("wheelScrollLines") @@ -88,6 +89,8 @@ Style { implicitWidth: horizontal ? 200 : pixelMetric("scrollbarExtent") implicitHeight: horizontal ? pixelMetric("scrollbarExtent") : 200 + + onIsTransientChanged: root.transientScrollBars = isTransient } } -- cgit v1.2.1 From a68b58a35aeafad279236d31c28acda02baff5cf Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Wed, 4 Nov 2015 11:26:56 +0100 Subject: Fix CircularGauge's tickmark labels all being set 0 We were relying on model.get() to somehow reevaluate after we'd updated properties of model items, which somehow worked until 4876ea6a18ccdfd72014582aa5d50ab9f6b6ec9e. The correct approach is to do the same thing as we do for styleData.index: rely on the model properties that are exposed to the delegate, which do get updated. Change-Id: I529ab7dcc142187fc185b11658dc5e1496b6d6db Task-number: QTBUG-48839 Reviewed-by: J-P Nurmi --- src/controls/Styles/Base/CircularTickmarkLabelStyle.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/controls/Styles/Base/CircularTickmarkLabelStyle.qml b/src/controls/Styles/Base/CircularTickmarkLabelStyle.qml index 010e9245..6e1c6740 100644 --- a/src/controls/Styles/Base/CircularTickmarkLabelStyle.qml +++ b/src/controls/Styles/Base/CircularTickmarkLabelStyle.qml @@ -285,6 +285,7 @@ Style { } delegate: Loader { id: tickmarkLabelDelegateLoader + objectName: "labelDelegateLoader" + index sourceComponent: tickmarkLabel x: pos.x y: pos.y @@ -292,8 +293,9 @@ Style { readonly property point pos: panelItem.labelPosFromIndex(index, width, height); readonly property int __index: index + readonly property real __value: value property QtObject styleData: QtObject { - readonly property var value: index != -1 ? labelItemRepeater.model.get(index).value : 0 + readonly property var value: index != -1 ? tickmarkLabelDelegateLoader.__value : 0 readonly property alias index: tickmarkLabelDelegateLoader.__index } } -- cgit v1.2.1