diff options
Diffstat (limited to 'src')
25 files changed, 167 insertions, 160 deletions
diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml index 4e29dfe9..10702ff6 100644 --- a/src/controls/ComboBox.qml +++ b/src/controls/ComboBox.qml @@ -564,7 +564,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: { 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/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/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; diff --git a/src/controls/ScrollView.qml b/src/controls/ScrollView.qml index 74d5ee7d..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 */ @@ -238,13 +240,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 +276,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 +293,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 } } @@ -327,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/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 } } 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 } } 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 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/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<QQuickAction>(uri, 1, 0, "Action"); - qmlRegisterType<QQuickExclusiveGroup>(uri, 1, 0, "ExclusiveGroup"); + qmlRegisterType<QQuickExclusiveGroup1>(uri, 1, 0, "ExclusiveGroup"); qmlRegisterType<QQuickMenuItem>(uri, 1, 0, "MenuItem"); qmlRegisterUncreatableType<QQuickMenuItemType>(uri, 1, 0, "MenuItemType", QLatin1String("Do not create objects of type MenuItemType")); 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: { 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<QQuickExclusiveGroup> m_exclusiveGroup; + QPointer<QQuickExclusiveGroup1> 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<QQuickAction> QQuickExclusiveGroup::actions() +QQmlListProperty<QQuickAction> QQuickExclusiveGroup1::actions() { - return QQmlListProperty<QQuickAction>(this, 0, &QQuickExclusiveGroup::append_actions, 0, 0, 0); + return QQmlListProperty<QQuickAction>(this, 0, &QQuickExclusiveGroup1::append_actions, 0, 0, 0); } -void QQuickExclusiveGroup::append_actions(QQmlListProperty<QQuickAction> *list, QQuickAction *action) +void QQuickExclusiveGroup1::append_actions(QQmlListProperty<QQuickAction> *list, QQuickAction *action) { - if (QQuickExclusiveGroup *eg = qobject_cast<QQuickExclusiveGroup *>(list->object)) + if (QQuickExclusiveGroup1 *eg = qobject_cast<QQuickExclusiveGroup1 *>(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 <QtCore/qobject.h> #include <QtCore/qmetaobject.h> @@ -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); 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/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 } 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 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; }); } 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 += ../ diff --git a/src/layouts/qquicklayout.cpp b/src/layouts/qquicklayout.cpp index 559f8ff2..aa54e11c 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 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); |