From dca452260217b1b63f9874d3d436a1b910ad4a41 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 27 May 2013 12:58:08 +0200 Subject: Update all plugins.qmltypes files Task-number: QTBUG-31388 Change-Id: I6b8ed2c7f641e38242540633fefe9ed0dc7cc8bf Reviewed-by: Shawn Rutledge --- src/controls/plugins.qmltypes | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/controls') diff --git a/src/controls/plugins.qmltypes b/src/controls/plugins.qmltypes index 89363578..8997cecf 100644 --- a/src/controls/plugins.qmltypes +++ b/src/controls/plugins.qmltypes @@ -3,7 +3,7 @@ import QtQuick.tooling 1.1 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. // -// This file was auto-generated with the command '/home/jpnurmi/Projects/qt5-stable/qtbase/bin/qmlplugindump -notrelocatable QtQuick.Controls 1.0'. +// This file was auto-generated with the command 'qmlplugindump -notrelocatable QtQuick.Controls 1.0'. Module { Component { @@ -67,6 +67,8 @@ Module { Property { name: "__contentItem"; type: "QQuickItem"; isPointer: true } Property { name: "__minimumWidth"; type: "int" } Property { name: "__font"; type: "QFont" } + Property { name: "__xOffset"; type: "double" } + Property { name: "__yOffset"; type: "double" } Signal { name: "__menuClosed" } Signal { name: "popupVisibleChanged" } Method { name: "__closeMenu" } -- cgit v1.2.1 From 9b34e4377d3bbbcfd600bb056d77453eaa76fd3e Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 27 May 2013 12:38:42 +0200 Subject: Yet another plugin rename For consistency we should use "plugin" as suffix on plugin names. Change-Id: Ieea483cc1d7642e4fcd7d0907de8efd7e00743e1 Reviewed-by: Caroline Chao Reviewed-by: J-P Nurmi --- src/controls/controls.pro | 2 +- src/controls/qmldir | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/controls') diff --git a/src/controls/controls.pro b/src/controls/controls.pro index 928708c2..fbda88fc 100644 --- a/src/controls/controls.pro +++ b/src/controls/controls.pro @@ -1,4 +1,4 @@ -TARGET = qtquickcontrols +TARGET = qtquickcontrolsplugin TARGETPATH = QtQuick/Controls QT += qml quick gui-private core-private diff --git a/src/controls/qmldir b/src/controls/qmldir index f593439f..c243360c 100644 --- a/src/controls/qmldir +++ b/src/controls/qmldir @@ -1,5 +1,5 @@ module QtQuick.Controls -plugin qtquickcontrols +plugin qtquickcontrolsplugin ApplicationWindow 1.0 ApplicationWindow.qml Button 1.0 Button.qml CheckBox 1.0 CheckBox.qml -- cgit v1.2.1 From 78713a31058472c8a83813510d39fdf31056a35f Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Mon, 27 May 2013 08:57:12 +0200 Subject: Slider: Fix "Binding loop detected" warning Change-Id: Iffdf1b65a3ac80af73c3567c49bf8f0a9070dccb Reviewed-by: Jens Bache-Wiig --- src/controls/Slider.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/controls') diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml index 711c449b..b6f3e551 100644 --- a/src/controls/Slider.qml +++ b/src/controls/Slider.qml @@ -273,7 +273,7 @@ Control { // means that setting a value while dragging will not "interrupt" the // dragging activity. Binding { - when: !mouseArea.drag.active + when: !updateValueWhileDragging && !mouseArea.drag.active target: fakeHandle property: __horizontal ? "x" : "y" value: range.position -- cgit v1.2.1 From 89b6c336f1670a24bdc9ffbea8ad236b8148176d Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 27 May 2013 15:09:50 +0200 Subject: Revert "Slider: Fix "Binding loop detected" warning" This reverts commit 1283dffcae90ace0cd97e10f28082318a3049271 As Tomasz pointed out, this causes a regression when setting value so we need to revise. Change-Id: I965b815b14b7ec7497e1a09d42fd973c74759f2b Reviewed-by: Caroline Chao --- src/controls/Slider.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/controls') diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml index b6f3e551..711c449b 100644 --- a/src/controls/Slider.qml +++ b/src/controls/Slider.qml @@ -273,7 +273,7 @@ Control { // means that setting a value while dragging will not "interrupt" the // dragging activity. Binding { - when: !updateValueWhileDragging && !mouseArea.drag.active + when: !mouseArea.drag.active target: fakeHandle property: __horizontal ? "x" : "y" value: range.position -- cgit v1.2.1 From dbf42fc0028acc0170bb0d0dad966c74b86a456e Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 27 May 2013 15:51:08 +0200 Subject: Make GroupBox size respect anchor margins and update Gallery We now implicitly add the margins to GroupBox so that you can easily add them to a layout. This also gets rid of the silly Sidebar example and adds a much more useful Layout tab for effective testing. Change-Id: I6026c32b2a198062d9b11a67245df0529aa61f8a Reviewed-by: J-P Nurmi --- src/controls/GroupBox.qml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/controls') diff --git a/src/controls/GroupBox.qml b/src/controls/GroupBox.qml index e358dd9d..9bf1c0cc 100644 --- a/src/controls/GroupBox.qml +++ b/src/controls/GroupBox.qml @@ -212,7 +212,11 @@ Item { enabled: (!groupbox.checkable || groupbox.checked) property Item layoutItem: container.children.length === 1 ? container.children[0] : null - function calcWidth () { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) : container.childrenRect.width) } - function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) : container.childrenRect.height) } + function calcWidth () { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) + + (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin + + layoutItem.anchors.rightMargin : 0) : container.childrenRect.width) } + function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) + + (layoutItem.anchors.fill ? layoutItem.anchors.topMargin + + layoutItem.anchors.bottomMargin : 0) : container.childrenRect.height) } }] } -- cgit v1.2.1 From a84444f3809e9372c61ace8f5b973ad59fcaa9af Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 27 May 2013 15:07:33 +0200 Subject: ScrollView: take Flickable::originX and originY into account Change-Id: I16eb186a2b1f706bbc961d34a614bf2f9a9a0646 Reviewed-by: Jens Bache-Wiig --- src/controls/ScrollView.qml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/controls') diff --git a/src/controls/ScrollView.qml b/src/controls/ScrollView.qml index 31f69b8f..3262648e 100644 --- a/src/controls/ScrollView.qml +++ b/src/controls/ScrollView.qml @@ -236,11 +236,15 @@ FocusScope { property bool horizontalRecursionGuard: false property bool verticalRecursionGuard: false - horizontalMaximumValue: flickableItem ? flickableItem.contentWidth - viewport.width : 0 - verticalMaximumValue: flickableItem ? flickableItem.contentHeight - viewport.height + __viewTopMargin : 0 + horizontalMinimumValue: flickableItem ? flickableItem.originX : 0 + horizontalMaximumValue: flickableItem ? flickableItem.originX + flickableItem.contentWidth - viewport.width : 0 + + verticalMinimumValue: flickableItem ? flickableItem.originY : 0 + verticalMaximumValue: flickableItem ? flickableItem.originY + flickableItem.contentHeight - viewport.height + __viewTopMargin : 0 Connections { target: flickableItem + onContentYChanged: { wheelArea.verticalRecursionGuard = true wheelArea.verticalValue = flickableItem.contentY -- cgit v1.2.1 From 5b36fa87bca007c0fac50b5b99f424e2fed59fab Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Mon, 27 May 2013 15:26:37 +0200 Subject: Doc: Add a section for Styles Change-Id: I96af8ea444754e7c3cab954622d0f385b75f9689 Reviewed-by: Jens Bache-Wiig --- src/controls/doc/src/qtquickcontrols-index.qdoc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/controls') diff --git a/src/controls/doc/src/qtquickcontrols-index.qdoc b/src/controls/doc/src/qtquickcontrols-index.qdoc index 011de527..658d117b 100644 --- a/src/controls/doc/src/qtquickcontrols-index.qdoc +++ b/src/controls/doc/src/qtquickcontrols-index.qdoc @@ -82,6 +82,9 @@ \li \l{Qt Quick Controls Examples} \endlist - \l {Qt Quick Controls Styles QML Types} + \section2 Styles + \list + \li \l {Qt Quick Controls Styles QML Types} + \endlist */ -- cgit v1.2.1 From bb64aef56bd43891bd6f91aee25bdfe6633c3a98 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 27 May 2013 17:54:54 +0200 Subject: Refactor TableView styling API We don't want to directly expose the item properties in the namespace of the loader. Instead we standardize on styleData as a property container. Change-Id: Ib451e06ab393ba4945c96076d71dd3f96489e0c7 Reviewed-by: J-P Nurmi --- src/controls/TableView.qml | 119 ++++++++++++++++++++++++++------------------- 1 file changed, 68 insertions(+), 51 deletions(-) (limited to 'src/controls') diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index ca0df45a..4cde5d3e 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -128,22 +128,23 @@ ScrollView { In the item delegate you have access to the following special properties: \list - \li itemSelected - if the item is currently selected - \li itemValue - the value or text for this item - \li itemTextColor - the default text color for an item - \li row - the index of the row - \li column - the index of the column - \li itemElideMode - the elide mode of the column - \li itemTextAlignment - the horizontal text alignment of the column + \li styleData.selected - if the item is currently selected + \li styleData.value - the value or text for this item + \li styleData.textColor - the default text color for an item + \li styleData.row - the index of the row + \li styleData.column - the index of the column + \li styleData.elideMode - the elide mode of the column + \li styleData.textAlignment - the horizontal text alignment of the column \endlist + Example: \code itemDelegate: Item { Text { anchors.verticalCenter: parent.verticalCenter - color: itemTextColor - elide: itemElideMode - text: itemValue + color: styleData.textColor + elide: styleData.elideMode + text: styleData.value } } \endcode */ @@ -153,9 +154,9 @@ ScrollView { In the row delegate you have access to the following special properties: \list - \li alternateBackground - if the row uses the alternate background color - \li rowSelected - if the row is currently selected - \li index - the index of the row + \li styleData.alternate - true when the row uses the alternate background color + \li styleData.selected - true when the row is currently selected + \li styleData.row - the index of the row \endlist */ property Component rowDelegate: __style ? __style.rowDelegate : null @@ -166,7 +167,16 @@ ScrollView { The default value is the base color of the SystemPalette. */ property alias backgroundColor: colorRect.color - /*! This property defines a delegate to draw a header. */ + /*! This property defines a delegate to draw a header. + + In the header delegate you have access to the following special properties: + \list + \li styleData.value - the value or text for this item + \li styleData.column - the index of the column + \li styleData.pressed - true when the column is being pressed + \li styleData.containsMouse - true when the column is under the mouse + \endlist + */ property Component headerDelegate: __style ? __style.headerDelegate : null /*! Index of the current sort column. @@ -408,11 +418,13 @@ ScrollView { width: rowfiller.width height: rowfiller.rowHeight sourceComponent: root.rowDelegate - readonly property bool alternateBackground: (index + rowCount) % 2 === 1 - readonly property bool rowSelected: false + property QtObject styleData: QtObject { + readonly property bool alternate: (index + rowCount) % 2 === 1 + readonly property bool selected: false + readonly property bool hasActiveFocus: root.activeFocus + } readonly property var model: listView.model readonly property var modelData: null - readonly property bool hasActiveFocus: root.activeFocus } } } @@ -439,7 +451,7 @@ ScrollView { height: rowstyle.height readonly property int rowIndex: model.index - readonly property bool alternateBackground: alternatingRowColors && rowIndex % 2 == 1 + readonly property bool alternate: alternatingRowColors && rowIndex % 2 == 1 readonly property var itemModelData: typeof modelData == "undefined" ? null : modelData readonly property var itemModel: model readonly property bool itemSelected: ListView.isCurrentItem @@ -457,12 +469,14 @@ ScrollView { // these properties are exposed to the row delegate // Note: these properties should be mirrored in the row filler as well - readonly property bool alternateBackground: rowitem.alternateBackground - readonly property bool rowSelected: rowitem.itemSelected - readonly property int row: rowitem.rowIndex + property QtObject styleData: QtObject { + readonly property int row: rowitem.rowIndex + readonly property bool alternate: rowitem.alternate + readonly property bool selected: rowitem.itemSelected + readonly property bool hasActiveFocus: root.activeFocus + } readonly property var model: listView.model readonly property var modelData: rowitem.itemModelData - readonly property bool hasActiveFocus: root.activeFocus } Row { id: itemrow @@ -482,20 +496,22 @@ ScrollView { readonly property var model: listView.model readonly property var modelData: itemModelData - readonly property var itemValue: __hasModelRole ? itemModel[role] // Qml ListModel and QAbstractItemModel - : __hasModelDataRole ? modelData[role] // QObjectList / QObject - : modelData != undefined ? modelData : "" // Models without role - readonly property bool itemSelected: rowitem.itemSelected - readonly property color itemTextColor: rowitem.itemTextColor - readonly property int row: rowitem.rowIndex - readonly property int column: index - readonly property int itemElideMode: __column.elideMode - readonly property int itemTextAlignment: __column.horizontalAlignment - readonly property string role: __column.role + property QtObject styleData: QtObject { + readonly property var value: __hasModelRole ? itemModel[role] // Qml ListModel and QAbstractItemModel + : __hasModelDataRole ? modelData[role] // QObjectList / QObject + : modelData != undefined ? modelData : "" // Models without role + readonly property int row: rowitem.rowIndex + readonly property int column: index + readonly property int elideMode: __column.elideMode + readonly property int textAlignment: __column.horizontalAlignment + readonly property bool selected: rowitem.itemSelected + readonly property color textColor: rowitem.itemTextColor + readonly property string role: __column.role + } readonly property TableViewColumn __column: columns[index] - readonly property bool __hasModelRole: role && itemModel.hasOwnProperty(role) - readonly property bool __hasModelDataRole: role && modelData && modelData.hasOwnProperty(role) + readonly property bool __hasModelRole: styleData.role && itemModel.hasOwnProperty(styleData.role) + readonly property bool __hasModelDataRole: styleData.role && modelData && modelData.hasOwnProperty(styleData.role) } } onWidthChanged: listView.contentWidth = width @@ -545,13 +561,12 @@ ScrollView { sourceComponent: root.headerDelegate anchors.left: parent.left anchors.right: parent.right - property string itemValue: columns[index].title - property string itemSort: (sortIndicatorVisible && index == sortIndicatorColumn) ? (sortIndicatorOrder == Qt.AscendingOrder ? "up" : "down") : ""; - property bool itemPressed: headerClickArea.pressed - property bool itemContainsMouse: headerClickArea.containsMouse - property string itemPosition: columnCount === 1 ? "only" : - index===columnCount-1 ? "end" : - index===0 ? "beginning" : "" + property QtObject styleData: QtObject { + readonly property string value: columns[index].title + readonly property bool pressed: headerClickArea.pressed + readonly property bool containsMouse: headerClickArea.containsMouse + readonly property int column: index + } } Rectangle{ id: targetmark @@ -612,11 +627,12 @@ ScrollView { Loader { id: draghandle - property string itemValue: columns[index].title - property string itemSort: (sortIndicatorVisible && index == sortIndicatorColumn) ? (sortIndicatorOrder == Qt.AscendingOrder ? "up" : "down") : ""; - property bool itemPressed: headerClickArea.pressed - property bool itemContainsMouse: headerClickArea.containsMouse - property string itemPosition + property QtObject styleData: QtObject{ + readonly property string value: columns[index].title + readonly property bool pressed: headerClickArea.pressed + readonly property bool containsMouse: headerClickArea.containsMouse + readonly property int column: index + } parent: tableHeader width: columns[index].width @@ -661,11 +677,12 @@ ScrollView { } Loader { id: loader - property string itemValue - property string itemSort - property bool itemPressed - property bool itemContainsMouse - property string itemPosition + property QtObject styleData: QtObject{ + readonly property string value: "" + readonly property bool pressed: false + readonly property bool containsMouse: false + readonly property int column: -1 + } anchors.top: parent.top anchors.right: parent.right -- cgit v1.2.1 From e0c8035c3db5c3c68602a90a5addbb2d48c0733f Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 27 May 2013 18:34:37 +0200 Subject: Rename controlState to styleData Change-Id: I06c9f4b0d9b6eef7d2ca608827eee982d8d97027 Reviewed-by: Jens Bache-Wiig --- src/controls/SpinBox.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/controls') diff --git a/src/controls/SpinBox.qml b/src/controls/SpinBox.qml index ec563afc..4db67c8d 100644 --- a/src/controls/SpinBox.qml +++ b/src/controls/SpinBox.qml @@ -148,7 +148,7 @@ Control { /*! \internal */ property alias __text: input.text - __controlState: QtObject { + __styleData: QtObject { readonly property bool upEnabled: value != maximumValue; readonly property alias upHovered: mouseUp.containsMouse readonly property alias upPressed: mouseUp.pressed -- cgit v1.2.1 From 960a78ae6231767a34a6e4de76bf4fa28ff401f1 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 27 May 2013 11:32:39 +0200 Subject: The function was moved to QtDeclarative It is about default behavior for QQuickWindow, when there is no any activeFocusItem in the whole window, Tab/BackTab key could help you to focus the item in the tab focus chain. Change-Id: Iccd770794e2f99a9a74c3a11f0ed278264a02d9e Reviewed-by: Gabriel de Dietrich --- src/controls/ApplicationWindow.qml | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/controls') diff --git a/src/controls/ApplicationWindow.qml b/src/controls/ApplicationWindow.qml index f2e181a5..602661a3 100644 --- a/src/controls/ApplicationWindow.qml +++ b/src/controls/ApplicationWindow.qml @@ -125,14 +125,6 @@ Window { /*! \internal */ default property alias data: contentArea.data - /*! \internal */ - Binding { - target: contentItem - property: "activeFocusOnTab" - when: activeFocusItem - value: activeFocusItem ? ( (activeFocusItem != contentItem) ? !activeFocusItem.activeFocusOnTab : true ) : false - } - color: syspal.window SystemPalette {id: syspal} -- cgit v1.2.1 From 10851004e327f4ab798753c645ab987f10160100 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 28 May 2013 17:27:09 +0200 Subject: Consistent use of "hovered" and style API conventions We were still using "containsMouse" in a few places, and we should consistently add "hovered" to all button types for consistency. Also fixed the SplitView to follow the new style conventions. Change-Id: Iebc333c0cecc5bcde27e626b1a611c2f2edcf7dc Reviewed-by: J-P Nurmi Reviewed-by: Caroline Chao --- src/controls/ScrollView.qml | 2 +- src/controls/SpinBox.qml | 2 +- src/controls/SplitView.qml | 50 +++++++++++++++++++++++++-------------------- 3 files changed, 30 insertions(+), 24 deletions(-) (limited to 'src/controls') diff --git a/src/controls/ScrollView.qml b/src/controls/ScrollView.qml index 3262648e..efa6e631 100644 --- a/src/controls/ScrollView.qml +++ b/src/controls/ScrollView.qml @@ -146,7 +146,7 @@ FocusScope { /*! \internal */ property Component style: Qt.createComponent(Settings.style + "/ScrollViewStyle.qml", root) - /* \internal */ + /*! \internal */ property PaddedStyle __style: styleLoader.item activeFocusOnTab: true diff --git a/src/controls/SpinBox.qml b/src/controls/SpinBox.qml index 4db67c8d..92f25fbc 100644 --- a/src/controls/SpinBox.qml +++ b/src/controls/SpinBox.qml @@ -157,7 +157,7 @@ Control { readonly property alias downPressed: mouseDown.pressed readonly property alias downHovered: mouseDown.containsMouse - readonly property alias containsMouse: mouseArea.containsMouse + readonly property alias hovered: mouseArea.containsMouse readonly property int contentHeight: Math.max(input.implicitHeight, 16) readonly property int contentWidth: Math.max(maxSizeHint.implicitWidth, minSizeHint.implicitWidth) diff --git a/src/controls/SplitView.qml b/src/controls/SplitView.qml index fc43874e..0adb4282 100644 --- a/src/controls/SplitView.qml +++ b/src/controls/SplitView.qml @@ -117,14 +117,17 @@ Item { /*! This property holds the delegate that will be instantiated between each child item. Inside the delegate the following properties are available: - \list - \li int \c handleIndex - specifies the index of the splitter handle. The handle - between the first and the second item will get index 0, - the next handle index 1 etc. - \li bool \c pressed: the handle is being pressed. - \li bool \c resizing: the handle is being dragged. - \endlist - */ + + \table + \li readonly property bool styleData.index - Specifies the index of the splitter handle. The handle + between the first and the second item will get index 0, + the next handle index 1 etc. + \li readonly property bool styleData.hovered - The handle is being hovered. + \li readonly property bool styleData.pressed - The handle is being pressed. + \li readonly property bool styleData.resizing - The handle is being dragged. + \endtable + +*/ property Component handleDelegate: Rectangle { width: 1 height: 1 @@ -176,7 +179,7 @@ Item { continue if (splitterItems.children.length > 0) - handleLoader.createObject(splitterHandles, {"handleIndex":splitterItems.children.length - 1}) + handleLoader.createObject(splitterHandles, {"__handleIndex":splitterItems.children.length - 1}) item.parent = splitterItems i-- // item was removed from list item.widthChanged.connect(d.updateLayout) @@ -319,18 +322,21 @@ Item { id: handleLoader Loader { id: itemHandle - property int handleIndex: -1 - property alias containsMouse: mouseArea.containsMouse - property alias pressed: mouseArea.pressed - property bool resizing: mouseArea.drag.active - visible: __items[handleIndex + ((d.fillIndex >= handleIndex) ? 0 : 1)].visible + property int __handleIndex: -1 + property QtObject styleData: QtObject { + readonly property int index: __handleIndex + readonly property alias hovered: mouseArea.containsMouse + readonly property alias pressed: mouseArea.pressed + readonly property bool resizing: mouseArea.drag.active + onResizingChanged: root.resizing = resizing + } + visible: __items[__handleIndex + ((d.fillIndex >= __handleIndex) ? 0 : 1)].visible sourceComponent: handleDelegate onWidthChanged: d.updateLayout() onHeightChanged: d.updateLayout() onXChanged: moveHandle() onYChanged: moveHandle() - onResizingChanged: root.resizing = resizing MouseArea { id: mouseArea @@ -357,12 +363,12 @@ Item { var leftEdge, rightEdge, newWidth, leftStopX, rightStopX var i - if (d.fillIndex > handleIndex) { + if (d.fillIndex > __handleIndex) { // Resize item to the left. // Ensure that the handle is not crossing other handles. So // find the first visible handle to the left to determine the left edge: leftEdge = 0 - for (i=handleIndex-1; i>=0; --i) { + for (i=__handleIndex-1; i>=0; --i) { leftHandle = __handles[i] if (leftHandle.visible) { leftEdge = leftHandle[d.offset] + leftHandle[d.size] @@ -371,13 +377,13 @@ Item { } // Ensure: leftStopX >= itemHandle[d.offset] >= rightStopX - var min = d.accumulatedSize(handleIndex+1, __items.length, true) + var min = d.accumulatedSize(__handleIndex+1, __items.length, true) rightStopX = root[d.size] - min - itemHandle[d.size] leftStopX = Math.max(leftEdge, itemHandle[d.offset]) itemHandle[d.offset] = Math.min(rightStopX, Math.max(leftStopX, itemHandle[d.offset])) newWidth = itemHandle[d.offset] - leftEdge - leftItem = __items[handleIndex] + leftItem = __items[__handleIndex] // The next line will trigger 'updateLayout': leftItem[d.size] = newWidth } else { @@ -385,7 +391,7 @@ Item { // Ensure that the handle is not crossing other handles. So // find the first visible handle to the right to determine the right edge: rightEdge = root[d.size] - for (i=handleIndex+1; i<__handles.length; ++i) { + for (i=__handleIndex+1; i<__handles.length; ++i) { rightHandle = __handles[i] if (rightHandle.visible) { rightEdge = rightHandle[d.offset] @@ -394,13 +400,13 @@ Item { } // Ensure: leftStopX <= itemHandle[d.offset] <= rightStopX - min = d.accumulatedSize(0, handleIndex+1, true) + min = d.accumulatedSize(0, __handleIndex+1, true) leftStopX = min - itemHandle[d.size] rightStopX = Math.min((rightEdge - itemHandle[d.size]), itemHandle[d.offset]) itemHandle[d.offset] = Math.max(leftStopX, Math.min(itemHandle[d.offset], rightStopX)) newWidth = rightEdge - (itemHandle[d.offset] + itemHandle[d.size]) - rightItem = __items[handleIndex+1] + rightItem = __items[__handleIndex+1] // The next line will trigger 'updateLayout': rightItem[d.size] = newWidth } -- cgit v1.2.1 From c47c502e794f7ae37c516a1db123139d9dc1270d Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 28 May 2013 13:39:00 +0200 Subject: Revise TableView API for managing the columns Replace "property list columns" with: - addColumn(column) - insertColumn(index, column) - moveColumn(from, to) - removeColumn(index) - getColumn(index) Exposing list type of property in the public API was problematic for several reasons. First of all, it limited the internal implementation too much. Secondly, modifying the list programmatically did not work as expected, and it also threw nasty warnings while reordering the columns interactively. Task-number: QTBUG-30319 Task-number: QTBUG-31028 Change-Id: I0039f7e4be2d6ee9303a4118bdf84146b6a96a05 Reviewed-by: Jens Bache-Wiig --- src/controls/TableView.qml | 112 ++++++++++++++++++++++++++++++--------- src/controls/TableViewColumn.qml | 2 + 2 files changed, 90 insertions(+), 24 deletions(-) (limited to 'src/controls') diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index 4cde5d3e..93d75e92 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -200,9 +200,8 @@ ScrollView { */ property int sortIndicatorOrder: Qt.AscendingOrder - /*! \qmlproperty list TableView::columns - This property contains the TableViewColumn items */ - default property alias columns: listView.columnheader + /*! \internal */ + default property alias __columns: root.data /*! \qmlproperty Component TableView::contentHeader This is the content header of the TableView */ @@ -216,8 +215,9 @@ ScrollView { The current number of rows */ readonly property alias rowCount: listView.count - /*! The current number of columns */ - readonly property int columnCount: columns.length + /*! \qmlproperty int TableView::columnCount + The current number of columns */ + readonly property alias columnCount: columnModel.count /*! \qmlproperty string TableView::section.property \qmlproperty enumeration TableView::section.criteria @@ -288,6 +288,73 @@ ScrollView { return listView.indexAt(obj.x, obj.y) } + /*! Adds a \a column and returns the added column. + + The \a column argument can be an instance of TableViewColumn, + or a Component. The component has to contain a TableViewColumn. + Otherwise \c null is returned. + */ + function addColumn(column) { + return insertColumn(columnCount, column) + } + + /*! Inserts a \a column at the given \a index and returns the inserted column. + + The \a column argument can be an instance of TableViewColumn, + or a Component. The component has to contain a TableViewColumn. + Otherwise \c null is returned. + */ + function insertColumn(index, column) { + var object = column + if (typeof column['createObject'] === 'function') + object = column.createObject(root) + + if (index >= 0 && index <= columnCount && object.Accessible.role === Accessible.ColumnHeader) { + columnModel.insert(index, {columnItem: object}) + return object + } + + if (object !== column) + object.destroy() + console.warn("TableView::insertColumn(): invalid argument") + return null + } + + /*! Removes and destroys a column at the given \a index. */ + function removeColumn(index) { + if (index < 0 || index >= columnCount) { + console.warn("TableView::removeColumn(): invalid argument") + return + } + var column = columnModel.get(index).columnItem + columnModel.remove(index, 1) + column.destroy() + } + + /*! Moves a column \a from index \a to another. */ + function moveColumn(from, to) { + if (from < 0 || from >= columnCount || to < 0 || to >= columnCount) { + console.warn("TableView::moveColumn(): invalid argument") + return + } + columnModel.move(from, to, 1) + } + + /*! Returns the column at the given \a index + or \c null if the \a index is invalid. */ + function getColumn(index) { + if (index < 0 || index >= columnCount) + return null + return columnModel.get(index).columnItem + } + + Component.onCompleted: { + for (var i = 0; i < __columns.length; ++i) { + var column = __columns[i] + if (column.Accessible.role === Accessible.ColumnHeader) + addColumn(column) + } + } style: Qt.createComponent(Settings.style + "/TableViewStyle.qml", root) @@ -429,7 +496,10 @@ ScrollView { } } - property list columnheader + ListModel { + id: columnModel + } + highlightFollowsCurrentItem: true model: root.model @@ -483,7 +553,7 @@ ScrollView { height: parent.height Repeater { id: repeater - model: root.columnCount + model: columnModel Loader { id: itemDelegateLoader @@ -509,7 +579,7 @@ ScrollView { readonly property string role: __column.role } - readonly property TableViewColumn __column: columns[index] + readonly property TableViewColumn __column: columnItem readonly property bool __hasModelRole: styleData.role && itemModel.hasOwnProperty(styleData.role) readonly property bool __hasModelDataRole: styleData.role && modelData && modelData.hasOwnProperty(styleData.role) } @@ -548,12 +618,12 @@ ScrollView { property int targetIndex: -1 property int dragIndex: -1 - model: columnCount + model: columnModel delegate: Item { z:-index - width: columns[index].width - visible: columns[index].visible + width: modelData.width + visible: modelData.visible height: headerVisible ? headerStyle.height : 0 Loader { @@ -562,7 +632,7 @@ ScrollView { anchors.left: parent.left anchors.right: parent.right property QtObject styleData: QtObject { - readonly property string value: columns[index].title + readonly property string value: modelData.title readonly property bool pressed: headerClickArea.pressed readonly property bool containsMouse: headerClickArea.containsMouse readonly property int column: index @@ -608,13 +678,7 @@ ScrollView { onReleased: { if (repeater.targetIndex >= 0 && repeater.targetIndex != index ) { - // Rearrange the header sections - var items = new Array - for (var i = 0 ; i< columnCount ; ++i) - items.push(columns[i]) - items.splice(index, 1); - items.splice(repeater.targetIndex, 0, columns[index]); - columns = items + columnModel.move(index, repeater.targetIndex, 1) if (sortIndicatorColumn == index) sortIndicatorColumn = repeater.targetIndex } @@ -628,14 +692,14 @@ ScrollView { Loader { id: draghandle property QtObject styleData: QtObject{ - readonly property string value: columns[index].title + readonly property string value: modelData.title readonly property bool pressed: headerClickArea.pressed readonly property bool containsMouse: headerClickArea.containsMouse readonly property int column: index } parent: tableHeader - width: columns[index].width + width: modelData.width height: parent.height sourceComponent: root.headerDelegate visible: headerClickArea.pressed @@ -651,8 +715,8 @@ ScrollView { width: 16 ; height: parent.height anchors.right: parent.right onPositionChanged: { - var newHeaderWidth = columns[index].width + (mouseX - offset) - columns[index].width = Math.max(minimumSize, newHeaderWidth) + var newHeaderWidth = modelData.width + (mouseX - offset) + modelData.width = Math.max(minimumSize, newHeaderWidth) } property bool found:false @@ -667,7 +731,7 @@ ScrollView { minWidth = Math.max(minWidth, item.children[1].children[index].children[0].implicitWidth) } if (minWidth) - columns[index].width = minWidth + modelData.width = minWidth } onPressedChanged: if (pressed) offset=mouseX cursorShape: Qt.SplitHCursor diff --git a/src/controls/TableViewColumn.qml b/src/controls/TableViewColumn.qml index 919f30de..2c629dfb 100644 --- a/src/controls/TableViewColumn.qml +++ b/src/controls/TableViewColumn.qml @@ -89,4 +89,6 @@ QtObject { /*! The delegate of the column. This can be used to set the \l TableView::itemDelegate for a specific column. */ property Component delegate + + Accessible.role: Accessible.ColumnHeader } -- cgit v1.2.1 From c6389d78fc51fb404043848f5d7da2d4e3e19599 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 28 May 2013 13:14:15 +0200 Subject: Move backgroundColor from TableView to TableViewStyle This property was not respected by some of the native styles and makes more sense as a styling attribute. Change-Id: I9cc1d3a130b764a67552ed7f0cec49ccc87ea246 Reviewed-by: J-P Nurmi --- src/controls/TableView.qml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/controls') diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index 93d75e92..d0417bfa 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -161,12 +161,6 @@ ScrollView { */ property Component rowDelegate: __style ? __style.rowDelegate : null - /*! \qmlproperty color TableView::backgroundColor - - This property sets the background color of the viewport. - The default value is the base color of the SystemPalette. */ - property alias backgroundColor: colorRect.color - /*! This property defines a delegate to draw a header. In the header delegate you have access to the following special properties: @@ -404,7 +398,7 @@ ScrollView { id: colorRect parent: viewport anchors.fill: parent - color: palette.base + color: __style ? __style.backgroundColor : palette.base z: -1 } -- cgit v1.2.1 From a48849649e9d534449f6feb685dbb708f354d270 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 28 May 2013 16:50:49 +0200 Subject: MenuItem: Connect to own action's 'shortcutChanged' signal Otherwise, we won't be setting the shortcut on the platform item. Task-number: QTBUG-31368 Change-Id: I333b903719d6e95a411f4f423c0e9b8ce15e640e Reviewed-by: J-P Nurmi --- src/controls/qquickmenuitem.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/controls') diff --git a/src/controls/qquickmenuitem.cpp b/src/controls/qquickmenuitem.cpp index 4ac7c7ff..de215df1 100644 --- a/src/controls/qquickmenuitem.cpp +++ b/src/controls/qquickmenuitem.cpp @@ -401,6 +401,7 @@ QQuickMenuItem::QQuickMenuItem(QObject *parent) { connect(this, SIGNAL(__textChanged()), this, SIGNAL(textChanged())); + connect(action(), SIGNAL(shortcutChanged(QString)), this, SLOT(updateShortcut())); connect(action(), SIGNAL(triggered()), this, SIGNAL(triggered())); connect(action(), SIGNAL(toggled(bool)), this, SLOT(updateChecked())); if (platformItem()) -- cgit v1.2.1 From 6e62a72c72abc5ad6e241541208a36378d448853 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 28 May 2013 10:19:30 +0200 Subject: Improved size calculation of GroupBox This adds some pixel tweaks on mac, adds minimum size to fit the label and fixes dpi scaling on Windows Change-Id: I4c43ba4a7815be87356336a9dafc1a217437940b Reviewed-by: Gabriel de Dietrich --- src/controls/GroupBox.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/controls') diff --git a/src/controls/GroupBox.qml b/src/controls/GroupBox.qml index 9bf1c0cc..4aa6a50f 100644 --- a/src/controls/GroupBox.qml +++ b/src/controls/GroupBox.qml @@ -159,7 +159,8 @@ Item { /*! \internal */ property alias __style: styleLoader.item - implicitWidth: (!anchors.fill ? container.calcWidth() : 0) + loader.leftMargin + loader.rightMargin + implicitWidth: Math.max((!anchors.fill ? container.calcWidth() : 0) + loader.leftMargin + loader.rightMargin, + sizeHint.implicitWidth + (checkable ? 24 : 6)) implicitHeight: (!anchors.fill ? container.calcHeight() : 0) + loader.topMargin + loader.bottomMargin Layout.minimumWidth: implicitWidth @@ -181,6 +182,7 @@ Item { property int rightMargin: __style ? __style.padding.right : 0 sourceComponent: styleLoader.item ? styleLoader.item.panel : null onLoaded: item.z = -1 + Text { id: sizeHint ; visible: false ; text: title } Loader { id: styleLoader property alias __control: groupbox -- cgit v1.2.1 From b0510b53256cbc3d2ea46dd936e85c0d1f463b37 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 28 May 2013 13:49:44 +0200 Subject: Rename::tabAt(index) to getTab(index) The fooAt() type methods are reserved for coordinate based queries. Change-Id: Iea91bdd29df4fa53cc1c7a07880f466ef2325725 Reviewed-by: Caroline Chao --- src/controls/TabView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/controls') diff --git a/src/controls/TabView.qml b/src/controls/TabView.qml index d292ce05..3273f825 100644 --- a/src/controls/TabView.qml +++ b/src/controls/TabView.qml @@ -133,7 +133,7 @@ FocusScope { } /*! Returns the \l Tab item at \a index. */ - function tabAt(index) { + function getTab(index) { return __tabs.get(index).tab } -- cgit v1.2.1 From 26dda49ccb3572bedc785c85c41cec5db8114579 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 29 May 2013 13:06:34 +0200 Subject: Rename PaddedStyle to AbstractStyle Make Style inherit AbstractStyle, so it becomes the base class of all styles. AbstractStyle also now has a default "data" property so it's possible to conveniently declare helper content inside styles. Change-Id: Id84f3762cfae506e65021322619d7fb77b137994 Reviewed-by: Tomasz Olszak Reviewed-by: Jens Bache-Wiig --- src/controls/ScrollView.qml | 2 +- src/controls/doc/qtquickcontrols.qdocconf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/controls') diff --git a/src/controls/ScrollView.qml b/src/controls/ScrollView.qml index efa6e631..0af69a0d 100644 --- a/src/controls/ScrollView.qml +++ b/src/controls/ScrollView.qml @@ -147,7 +147,7 @@ FocusScope { property Component style: Qt.createComponent(Settings.style + "/ScrollViewStyle.qml", root) /*! \internal */ - property PaddedStyle __style: styleLoader.item + property Style __style: styleLoader.item activeFocusOnTab: true diff --git a/src/controls/doc/qtquickcontrols.qdocconf b/src/controls/doc/qtquickcontrols.qdocconf index c04bced2..1f692597 100644 --- a/src/controls/doc/qtquickcontrols.qdocconf +++ b/src/controls/doc/qtquickcontrols.qdocconf @@ -52,7 +52,7 @@ sources += ../../private/qstyleitem.cpp \ ../../private/TabBar.qml \ ../../private/Control.qml \ ../../private/Style.qml \ - ../../private/qquickpaddedstyle.h \ - ../../private/qquickpaddedstyle.cpp + ../../private/qquickabstractstyle.h \ + ../../private/qquickabstractstyle.cpp imagedirs += images -- cgit v1.2.1 From c536d0cf324bd7cb2299ecd3e5212b9826b2bf42 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Wed, 29 May 2013 14:38:21 +0200 Subject: Removed reference to nonexistent file PageSlideTransition.qml. Change-Id: I2b4a4369496d85829fb2de14078042c0a76f2aba Reviewed-by: Jerome Pasion --- src/controls/doc/qtquickcontrols.qdocconf | 1 - 1 file changed, 1 deletion(-) (limited to 'src/controls') diff --git a/src/controls/doc/qtquickcontrols.qdocconf b/src/controls/doc/qtquickcontrols.qdocconf index 1f692597..7cf1ee54 100644 --- a/src/controls/doc/qtquickcontrols.qdocconf +++ b/src/controls/doc/qtquickcontrols.qdocconf @@ -47,7 +47,6 @@ sources += ../../private/qstyleitem.cpp \ ../../private/BasicButton.qml \ ../../private/FocusFrame.qml \ ../../private/ModalPopupBehavior.qml \ - ../../private/PageSlideTransition.qml \ ../../private/ScrollBar.qml \ ../../private/TabBar.qml \ ../../private/Control.qml \ -- cgit v1.2.1 From 6de2c97d064daa069066bb46880f04bfd5be43b7 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 29 May 2013 15:23:14 +0200 Subject: Docs: fix missing/leftover docs, types, tags... Task-number: QTBUG-31262 Change-Id: I6bf48604b9392a2a9c63c344363188a4693a8547 Reviewed-by: Jens Bache-Wiig --- src/controls/ComboBox.qml | 12 +++++++++--- src/controls/ProgressBar.qml | 2 +- src/controls/Slider.qml | 13 ------------- src/controls/SpinBox.qml | 17 +++++++++++++---- src/controls/SplitView.qml | 23 +++++++++++++++++------ src/controls/TextArea.qml | 2 +- 6 files changed, 41 insertions(+), 28 deletions(-) (limited to 'src/controls') diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml index 7b13bc8e..e5efb63c 100644 --- a/src/controls/ComboBox.qml +++ b/src/controls/ComboBox.qml @@ -80,13 +80,19 @@ import QtQuick.Controls.Private 1.0 Control { id: comboBox - /*! The model to populate the ComboBox from. */ + /*! \qmlproperty model ComboBox::model + The model to populate the ComboBox from. */ property alias model: popupItems.model + + /*! The model role used for populating the ComboBox. */ property string textRole: "" - /*! The index of the currently selected item in the ComboBox. */ + /*! \qmlproperty int ComboBox::currentIndex + The index of the currently selected item in the ComboBox. */ property alias currentIndex: popup.__selectedIndex - /*! The text of the currently selected item in the ComboBox. */ + + /*! \qmlproperty string ComboBox::currentText + The text of the currently selected item in the ComboBox. */ readonly property alias currentText: popup.selectedText /*! This property specifies whether the combobox should gain active focus when pressed. diff --git a/src/controls/ProgressBar.qml b/src/controls/ProgressBar.qml index 33e21514..6d9f8be1 100644 --- a/src/controls/ProgressBar.qml +++ b/src/controls/ProgressBar.qml @@ -123,7 +123,7 @@ Control { implicitWidth:(__panel ? __panel.implicitWidth : 0) implicitHeight: (__panel ? __panel.implicitHeight: 0) - /* \internal */ + /*! \internal */ function setValue(v) { var newval = parseFloat(v) if (!isNaN(newval)) { diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml index 711c449b..b31d4f78 100644 --- a/src/controls/Slider.qml +++ b/src/controls/Slider.qml @@ -174,19 +174,6 @@ Control { Accessible.role: Accessible.Slider Accessible.name: value - /*! - \qmlmethod Slider::formatValue - - This method returns the current slider value in a way that is more suitable - for user display, such as the \l value rounded to only two decimal places. - - By default this function returns the nearest \c int value. - */ - - function formatValue(v) { - return Math.round(v); - } - style: Qt.createComponent(Settings.style + "/SliderStyle.qml", slider) Keys.onRightPressed: value += (maximumValue - minimumValue)/10.0 diff --git a/src/controls/SpinBox.qml b/src/controls/SpinBox.qml index 92f25fbc..68f97e0a 100644 --- a/src/controls/SpinBox.qml +++ b/src/controls/SpinBox.qml @@ -75,6 +75,8 @@ Control { id: spinbox /*! + \qmlproperty real SpinBox::value + The value of this SpinBox, clamped to \l minimumValue and \l maximumValue. The default value is \c{0.0}. @@ -82,6 +84,8 @@ Control { property alias value: validator.value /*! + \qmlproperty real SpinBox::minimumValue + The minimum value of the SpinBox range. The \l value is clamped to this value. @@ -90,6 +94,8 @@ Control { property alias minimumValue: validator.minimumValue /*! + \qmlproperty real SpinBox::maximumValue + The maximum value of the SpinBox range. The \l value is clamped to this value. If maximumValue is smaller than \l minimumValue, \l minimumValue will be enforced. @@ -98,7 +104,7 @@ Control { */ property alias maximumValue: validator.maximumValue - /*! + /*! \qmlproperty real SpinBox::stepSize The amount by which the \l value is incremented/decremented when a spin button is pressed. @@ -106,13 +112,16 @@ Control { */ property alias stepSize: validator.stepSize - /*! The suffix for the value. I.e "cm" */ + /*! \qmlproperty string SpinBox::suffix + The suffix for the value. I.e "cm" */ property alias suffix: validator.suffix - /*! The prefix for the value. I.e "$" */ + /*! \qmlproperty string SpinBox::prefix + The prefix for the value. I.e "$" */ property alias prefix: validator.prefix - /*! This property indicates the amount of decimals. + /*! \qmlproperty int SpinBox::decimals + This property indicates the amount of decimals. Note that if you enter more decimals than specified, they will be truncated to the specified amount of decimal places. The default value is \c{0}. diff --git a/src/controls/SplitView.qml b/src/controls/SplitView.qml index 0adb4282..aba7809f 100644 --- a/src/controls/SplitView.qml +++ b/src/controls/SplitView.qml @@ -53,13 +53,14 @@ import QtQuick.Controls.Private 1.0 as Private SplitView is a control that lays out items horizontally or vertically with a draggable splitter between each item. - There will always be one (and only one) item in the SplitView that has \l {Layout}{Layout.fillWidth} - set to \c true (or Layout.fillHeight, if orientation is Qt.Vertical). This means that the + There will always be one (and only one) item in the SplitView that has \l{Layout::fillWidth}{Layout.fillWidth} + set to \c true (or \l{Layout::fillHeight}{Layout.fillHeight}, if orientation is Qt.Vertical). This means that the 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 Layout.minimumWidth and Layout.maximumWidth will still be respected). + to width and height will be ignored (but \l{Layout::minimumWidth}{Layout.minimumWidth} and + \l{Layout::maximumWidth}{Layout.maximumWidth} will still be respected). A handle can belong to the item either on the left or top side, or on the right or bottom side: \list @@ -69,9 +70,19 @@ import QtQuick.Controls.Private 1.0 as Private This will again control which item gets resized when the user drags a handle, and which handle gets hidden when an item is told to hide. - SplitView supports setting attached \l Layout properties on child items, which means that you - can control minimumWidth, minimumHeight, maximumWidth and maximumHeight (in addition - to fillWidth/fillHeight) for each child. + + SplitView supports setting attached Layout properties on child items, which + means that you can set the following attached properties for each child: + \list + \li \l{Layout::minimumWidth}{Layout.minimumWidth} + \li \l{Layout::minimumHeight}{Layout.minimumHeight} + \li \l{Layout::preferredWidth}{Layout.preferredWidth} + \li \l{Layout::preferredHeight}{Layout.preferredHeight} + \li \l{Layout::maximumWidth}{Layout.maximumWidth} + \li \l{Layout::maximumHeight}{Layout.maximumHeight} + \li \l{Layout::fillWidth}{Layout.fillWidth} (\c true for only one child) + \li \l{Layout::fillHeight}{Layout.fillHeight} (\c true for only one child) + \endlist Example: diff --git a/src/controls/TextArea.qml b/src/controls/TextArea.qml index 6dab90fd..43cc347c 100644 --- a/src/controls/TextArea.qml +++ b/src/controls/TextArea.qml @@ -621,7 +621,7 @@ ScrollView { Accessible.role: Accessible.EditableText /*! - \qmlproperty textDocument TextArea::textDocument + \qmlproperty TextDocument TextArea::textDocument This property exposes the \l QTextDocument of this TextArea. \sa TextEdit::textDocument -- cgit v1.2.1 From f6a716a11a26e2ce76f8ed71ad1733e939ca468b Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 29 May 2013 16:17:02 +0200 Subject: Remove remaining references to PageStack Change-Id: I59a9846c83340d0752659ef22cbb19a4be6a4129 Reviewed-by: Jens Bache-Wiig Reviewed-by: Gabriel de Dietrich --- src/controls/StackView.qml | 6 +++--- src/controls/plugins.qmltypes | 4 ++-- src/controls/qquickstack.cpp | 24 ++++++++++++------------ src/controls/qquickstack_p.h | 12 ++++++------ 4 files changed, 23 insertions(+), 23 deletions(-) (limited to 'src/controls') diff --git a/src/controls/StackView.qml b/src/controls/StackView.qml index c7b2366f..2c760e89 100644 --- a/src/controls/StackView.qml +++ b/src/controls/StackView.qml @@ -797,7 +797,7 @@ Item { } element.item.Stack.__index = element.index - element.item.Stack.__stackView = root + element.item.Stack.__view = root // Let item fill all available space by default: element.item.width = Qt.binding(function() { return root.width }) element.item.height = Qt.binding(function() { return root.height }) @@ -842,7 +842,7 @@ Item { // might reenter on pop if pushed several times: item.visible = false __setStatus(item, Stack.Inactive) - item.Stack.__stackView = null + item.Stack.__view = null item.Stack.__index = -1 if (element.originalParent) item.parent = element.originalParent @@ -871,7 +871,7 @@ Item { // Since an item can be pushed several times, we need to update its properties: enterItem.parent = root - enterItem.Stack.__stackView = root + enterItem.Stack.__view = root enterItem.Stack.__index = transition.inElement.index __currentItem = enterItem diff --git a/src/controls/plugins.qmltypes b/src/controls/plugins.qmltypes index 8997cecf..bd8508da 100644 --- a/src/controls/plugins.qmltypes +++ b/src/controls/plugins.qmltypes @@ -199,7 +199,7 @@ Module { Property { name: "__index"; type: "int" } Property { name: "status"; type: "Status"; isReadonly: true } Property { name: "__status"; type: "Status" } - Property { name: "pageStack"; type: "QQuickItem"; isReadonly: true; isPointer: true } - Property { name: "__stackView"; type: "QQuickItem"; isPointer: true } + Property { name: "view"; type: "QQuickItem"; isReadonly: true; isPointer: true } + Property { name: "__view"; type: "QQuickItem"; isPointer: true } } } diff --git a/src/controls/qquickstack.cpp b/src/controls/qquickstack.cpp index 1723ef72..5d3accff 100644 --- a/src/controls/qquickstack.cpp +++ b/src/controls/qquickstack.cpp @@ -64,7 +64,7 @@ QQuickStack::QQuickStack(QObject *object) : QObject(object), m_index(-1), m_status(Inactive), - m_pageStack(0) + m_view(0) { } @@ -77,9 +77,9 @@ QQuickStack *QQuickStack::qmlAttachedProperties(QObject *object) \readonly \qmlproperty int Stack::index - This property holds the index of the item inside \l{pageStack}{StackView}, - so that \l{StackView::get()}{pageStack.get(index)} will return the item itself. - If \l{Stack::pageStack}{pageStack} is \c null, \a index will be \c -1. + This property holds the index of the item inside \l{view}{StackView}, + so that \l{StackView::get()}{StackView.get(index)} will return the item itself. + If \l{Stack::view}{view} is \c null, \a index will be \c -1. */ int QQuickStack::index() const { @@ -121,21 +121,21 @@ void QQuickStack::setStatus(Status status) /*! \readonly - \qmlproperty StackView Stack::pageStack + \qmlproperty StackView Stack::view This property holds the StackView the item is in. If the item is not inside - a StackView, \a pageStack will be \c null. + a StackView, \a view will be \c null. */ -QQuickItem *QQuickStack::pageStack() const +QQuickItem *QQuickStack::view() const { - return m_pageStack; + return m_view; } -void QQuickStack::setStackView(QQuickItem *pageStack) +void QQuickStack::setView(QQuickItem *view) { - if (m_pageStack != pageStack) { - m_pageStack = pageStack; - emit pageStackChanged(); + if (m_view != view) { + m_view = view; + emit viewChanged(); } } diff --git a/src/controls/qquickstack_p.h b/src/controls/qquickstack_p.h index a4b36644..c34dd1a3 100644 --- a/src/controls/qquickstack_p.h +++ b/src/controls/qquickstack_p.h @@ -53,8 +53,8 @@ class QQuickStack : public QObject Q_PROPERTY(int __index READ index WRITE setIndex NOTIFY indexChanged) Q_PROPERTY(Status status READ status NOTIFY statusChanged) Q_PROPERTY(Status __status READ status WRITE setStatus NOTIFY statusChanged) - Q_PROPERTY(QQuickItem* pageStack READ pageStack NOTIFY pageStackChanged) - Q_PROPERTY(QQuickItem* __stackView READ pageStack WRITE setStackView NOTIFY pageStackChanged) + Q_PROPERTY(QQuickItem* view READ view NOTIFY viewChanged) + Q_PROPERTY(QQuickItem* __view READ view WRITE setView NOTIFY viewChanged) Q_ENUMS(Status) public: @@ -75,18 +75,18 @@ public: Status status() const; void setStatus(Status status); - QQuickItem *pageStack() const; - void setStackView(QQuickItem *pageStack); + QQuickItem *view() const; + void setView(QQuickItem *view); signals: void statusChanged(); - void pageStackChanged(); + void viewChanged(); void indexChanged(); private: int m_index; Status m_status; - QQuickItem *m_pageStack; + QQuickItem *m_view; }; QT_END_NAMESPACE -- cgit v1.2.1 From c94a6f44d5d1ba5532de48419ce10ef9000d4511 Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Thu, 30 May 2013 10:34:06 +0200 Subject: Doc: Make Stack attached properties more visible And use \qmlattachedproperty instead of \qmlproperty for properties in the Stack. Change-Id: I1ffbd84ce91fd5a9040c082a8bcb403589becf91 Reviewed-by: J-P Nurmi Reviewed-by: Jerome Pasion --- src/controls/StackView.qml | 11 +++++++++++ src/controls/qquickstack.cpp | 15 ++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) (limited to 'src/controls') diff --git a/src/controls/StackView.qml b/src/controls/StackView.qml index 2c760e89..be1ddf06 100644 --- a/src/controls/StackView.qml +++ b/src/controls/StackView.qml @@ -65,6 +65,8 @@ import "Private/StackView.js" as JSArray The stack can then be used by invoking its navigation methods. The first item to show in the StackView is commonly loaded assigning it to \l initialItem. + \note Items pushed onto the stack view have \l{Supported Attached Properties}{Stack attached properties}. + \section1 Basic Navigation There are three primary navigation operations in StackView: push(), pop() and replace (you replace by specifying argument \c replace to push()). @@ -435,6 +437,15 @@ import "Private/StackView.js" as JSArray } } \endqml + + \section1 Supported Attached Properties + + Items in a StackView support these attached properties: + \list + \li \l{Stack::index}{Stack.index} - Contains the index of the item inside the StackView + \li \l{Stack::view}{Stack.view} - Contains the StackView the item is in + \li \l{Stack::status}{Stack.status} - Contains the status of the item + \endlist */ Item { diff --git a/src/controls/qquickstack.cpp b/src/controls/qquickstack.cpp index 5d3accff..ecf873d7 100644 --- a/src/controls/qquickstack.cpp +++ b/src/controls/qquickstack.cpp @@ -50,12 +50,9 @@ QT_BEGIN_NAMESPACE \ingroup views \brief Provides attached properties for items pushed onto a StackView. - The Stack attached property provides information when an item becomes - active or inactive through the \l{Stack::status}{Stack.status} property. - Status will be \c Stack.Activating when an item is transitioning into - being the current item on the screen, and \c Stack.Active once the - transition stops. When it leaves the screen, it will be - \c Stack.Deactivating, and then \c Stack.Inactive. + The Stack type provides attached properties for items pushed onto a \l StackView. + It gives specific information about the item, such as its \l status and + \l index in the stack \l view the item is in. \sa StackView */ @@ -75,7 +72,7 @@ QQuickStack *QQuickStack::qmlAttachedProperties(QObject *object) /*! \readonly - \qmlproperty int Stack::index + \qmlattachedproperty int Stack::index This property holds the index of the item inside \l{view}{StackView}, so that \l{StackView::get()}{StackView.get(index)} will return the item itself. @@ -96,7 +93,7 @@ void QQuickStack::setIndex(int index) /*! \readonly - \qmlproperty enumeration Stack::status + \qmlattachedproperty enumeration Stack::status This property holds the status of the item. It can have one of the following values: \list @@ -121,7 +118,7 @@ void QQuickStack::setStatus(Status status) /*! \readonly - \qmlproperty StackView Stack::view + \qmlattachedproperty StackView Stack::view This property holds the StackView the item is in. If the item is not inside a StackView, \a view will be \c null. -- cgit v1.2.1 From 9490e1161817ad74d5441db79bd8bde5c8c8db91 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Wed, 29 May 2013 18:43:37 +0200 Subject: Fix missing margins and incorrect size for ToolBar and StatusBar Using the implicitHeight of an item makes ToolBar and StatusBar a lot more useable with layouts. In addition we enable the padding property from the style, allowing its content to be positioned in a more convenient way. This is similar to how we already do it for GroupBox. Change-Id: Ia2aa1bcb9ae109718fd752401400222adec242ac Reviewed-by: Gabriel de Dietrich --- src/controls/StatusBar.qml | 82 +++++++++++++++++++++++++++++++++++++++------- src/controls/ToolBar.qml | 81 ++++++++++++++++++++++++++++++++++++++------- 2 files changed, 140 insertions(+), 23 deletions(-) (limited to 'src/controls') diff --git a/src/controls/StatusBar.qml b/src/controls/StatusBar.qml index 13edc5ef..068b6b20 100644 --- a/src/controls/StatusBar.qml +++ b/src/controls/StatusBar.qml @@ -52,14 +52,20 @@ import QtQuick.Controls.Private 1.0 The common way of using StatusBar is in relation to \l ApplicationWindow. Note that the StatusBar does not provide a layout of its own, but requires - you to position its contents, for instance by creating a \l Row. + you to position its contents, for instance by creating a \l RowLayout. + + If only a single item is used within the StatusBar, it will resize to fit the implicitHeight + of its contained item. This makes it particularly suitable for use together with layouts. + Otherwise the height is platform dependent. \code + import QtQuick.Controls 1.0 + import QtQuick.Layouts 1.0 + ApplicationWindow { statusBar: StatusBar { - Label { - text: "Read Only" - anchors.centerIn: parent + RowLayout { + Label { text: "Read Only" } } } } @@ -68,16 +74,68 @@ import QtQuick.Controls.Private 1.0 Item { id: statusbar + activeFocusOnTab: false Accessible.role: Accessible.StatusBar + width: parent ? parent.width : implicitWidth - implicitWidth: loader.item.implicitHeight - implicitHeight: loader.item ? loader.item.implicitHeight : 0 + implicitWidth: loader.item ? loader.item.implicitWidth : 200 + implicitHeight: Math.max(container.topMargin + container.bottomMargin + container.calcHeight(), + loader.item ? loader.item.implicitHeight : 19) + + /*! \internal */ property Component style: Qt.createComponent(Settings.style + "/StatusBarStyle.qml", statusbar) - Loader { - id: loader - anchors.fill: parent - sourceComponent: style - property var __control: statusbar - } + + /*! \internal */ + property alias __style: styleLoader.item + + /*! \internal */ + default property alias __content: container.data + + /*! + \qmlproperty Item StatusBar::contentItem + + This property holds the content Item of the status bar. + + Items declared as children of a StatusBar are automatically parented to the StatusBar's contentItem. + Items created dynamically need to be explicitly parented to the contentItem: + + \note The implicit size of the StatusBar is calculated based on the size of its content. If you want to anchor + items inside the status bar, you must specify an explicit width and height on the StatusBar itself. + */ + readonly property alias contentItem: container + + data: [ + Loader { + id: loader + anchors.fill: parent + sourceComponent: styleLoader.item ? styleLoader.item.panel : null + onLoaded: item.z = -1 + Loader { + id: styleLoader + property alias __control: statusbar + sourceComponent: style + } + }, + Item { + id: container + z: 1 + focus: true + anchors.fill: parent + + anchors.topMargin: topMargin + anchors.leftMargin: leftMargin + anchors.rightMargin: rightMargin + anchors.bottomMargin: bottomMargin + + property int topMargin: __style ? __style.padding.top : 0 + property int bottomMargin: __style ? __style.padding.bottom : 0 + property int leftMargin: __style ? __style.padding.left : 0 + property int rightMargin: __style ? __style.padding.right : 0 + + property Item layoutItem: container.children.length === 1 ? container.children[0] : null + function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) + + (layoutItem.anchors.fill ? layoutItem.anchors.topMargin + + layoutItem.anchors.bottomMargin : 0) : loader.item ? loader.item.implicitHeight : 0) } + }] } diff --git a/src/controls/ToolBar.qml b/src/controls/ToolBar.qml index d2adea56..e5cc8419 100644 --- a/src/controls/ToolBar.qml +++ b/src/controls/ToolBar.qml @@ -53,13 +53,20 @@ import QtQuick.Controls.Private 1.0 provides styling and is generally designed to work well with ToolButton as well as other controls. - Note that the ToolBar does not provide a layout of its own, but requires you - to position its contents, for instance by creating a Row. + Note that the ToolBar does not provide a layout of its own, but requires + you to position its contents, for instance by creating a \l RowLayout. + + If only a single item is used within the ToolBar, it will resize to fit the implicitHeight + of its contained item. This makes it particularly suitable for use together with layouts. + Otherwise the height is platform dependent. \code + import QtQuick.Controls 1.0 + import QtQuick.Layouts 1.0 + ApplicationWindow { toolBar: ToolBar { - Row { + RowLayout { ToolButton { ... } ToolButton { ... } ToolButton { ... } @@ -71,16 +78,68 @@ import QtQuick.Controls.Private 1.0 Item { id: toolbar + activeFocusOnTab: false Accessible.role: Accessible.ToolBar + width: parent ? parent.width : implicitWidth - implicitWidth: loader.item ? loader.item.implicitWidth : 0 - implicitHeight: loader.item ? loader.item.implicitHeight : 0 + implicitWidth: loader.item ? loader.item.implicitWidth : 200 + implicitHeight: container.topMargin + container.bottomMargin + container.calcHeight() + + /*! \internal */ property Component style: Qt.createComponent(Settings.style + "/ToolBarStyle.qml", toolbar) - Loader { - id: loader - anchors.fill: parent - sourceComponent: style - property var __control: toolbar - } + + /*! \internal */ + property alias __style: styleLoader.item + + /*! \internal */ + default property alias __content: container.data + + /*! + \qmlproperty Item ToolBar::contentItem + + This property holds the content Item of the tool bar. + + Items declared as children of a ToolBar are automatically parented to the ToolBar's contentItem. + Items created dynamically need to be explicitly parented to the contentItem: + + \note The implicit size of the ToolBar is calculated based on the size of its content. If you want to anchor + items inside the tool bar, you must specify an explicit width and height on the ToolBar itself. + */ + readonly property alias contentItem: container + + data: [ + Loader { + id: loader + anchors.fill: parent + sourceComponent: styleLoader.item ? styleLoader.item.panel : null + onLoaded: item.z = -1 + Loader { + id: styleLoader + property alias __control: toolbar + sourceComponent: style + } + }, + Item { + id: container + z: 1 + focus: true + anchors.fill: parent + + anchors.topMargin: topMargin + anchors.leftMargin: leftMargin + anchors.rightMargin: rightMargin + anchors.bottomMargin: bottomMargin + + property int topMargin: __style ? __style.padding.top : 0 + property int bottomMargin: __style ? __style.padding.bottom : 0 + property int leftMargin: __style ? __style.padding.left : 0 + property int rightMargin: __style ? __style.padding.right : 0 + + property Item layoutItem: container.children.length === 1 ? container.children[0] : null + function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) + + (layoutItem.anchors.fill ? layoutItem.anchors.topMargin + + layoutItem.anchors.bottomMargin : 0) : + loader.item ? loader.item.implicitHeight : 0) } + }] } -- cgit v1.2.1 From 8beda08087effd684cfcb325855c9f4b47186135 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Thu, 30 May 2013 16:51:34 +0200 Subject: Cleaning up some examples and removing clutter We want to use more layouts in our examples as it is the recommended way to create tool bars etc. Change-Id: Ib3b1e8e907cc5277d522557a19d2c294a7d251b1 Reviewed-by: J-P Nurmi --- .../doc/images/qtquickcontrols-example-gallery.png | Bin 53632 -> 34070 bytes 1 file changed, 0 insertions(+), 0 deletions(-) (limited to 'src/controls') diff --git a/src/controls/doc/images/qtquickcontrols-example-gallery.png b/src/controls/doc/images/qtquickcontrols-example-gallery.png index d3b19bb5..a88eab79 100644 Binary files a/src/controls/doc/images/qtquickcontrols-example-gallery.png and b/src/controls/doc/images/qtquickcontrols-example-gallery.png differ -- cgit v1.2.1 From 33850881a074f93622869cc4dc6bc77fbbc1fa0c Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Fri, 31 May 2013 13:10:02 +0200 Subject: TableView: Expand to single column and prevent multiple use This fix ensures that we can only add a TableViewColumn exactly once. It also automatically expands the column with to the viewport when only one column is in use. In addition I have disabled dragging when columnCount == 1 as it was pointless. Change-Id: Ief6011c3e58166907836bf55b0fa6643698192d2 Reviewed-by: Caroline Chao --- src/controls/TableView.qml | 14 ++++++++++---- src/controls/TableViewColumn.qml | 10 ++++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) (limited to 'src/controls') diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index d0417bfa..88a897e1 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -303,7 +303,12 @@ ScrollView { if (typeof column['createObject'] === 'function') object = column.createObject(root) + else if (object.__view) { + console.warn("TableView::insertColumn(): you cannot add a column to multiple views") + return null + } if (index >= 0 && index <= columnCount && object.Accessible.role === Accessible.ColumnHeader) { + object.__view = root columnModel.insert(index, {columnItem: object}) return object } @@ -616,7 +621,7 @@ ScrollView { delegate: Item { z:-index - width: modelData.width + width: columnCount == 1 ? viewport.width + __verticalScrollBar.width : modelData.width visible: modelData.visible height: headerVisible ? headerStyle.height : 0 @@ -655,7 +660,7 @@ ScrollView { // NOTE: the direction is different from the master branch // so this indicates that I am using an invalid assumption on item ordering onPositionChanged: { - if (pressed) { // only do this while dragging + if (pressed && columnCount > 1) { // only do this while dragging for (var h = columnCount-1 ; h >= 0 ; --h) { if (drag.target.x > headerrow.children[h].x) { repeater.targetIndex = h @@ -680,7 +685,7 @@ ScrollView { } drag.maximumX: 1000 drag.minimumX: -1000 - drag.target: draghandle + drag.target: columnCount > 1 ? draghandle : null } Loader { @@ -708,6 +713,7 @@ ScrollView { anchors.rightMargin: -width/2 width: 16 ; height: parent.height anchors.right: parent.right + enabled: columnCount > 1 onPositionChanged: { var newHeaderWidth = modelData.width + (mouseX - offset) modelData.width = Math.max(minimumSize, newHeaderWidth) @@ -728,7 +734,7 @@ ScrollView { modelData.width = minWidth } onPressedChanged: if (pressed) offset=mouseX - cursorShape: Qt.SplitHCursor + cursorShape: enabled ? Qt.SplitHCursor : Qt.ArrowCursor } } } diff --git a/src/controls/TableViewColumn.qml b/src/controls/TableViewColumn.qml index 2c629dfb..f1abc553 100644 --- a/src/controls/TableViewColumn.qml +++ b/src/controls/TableViewColumn.qml @@ -49,6 +49,10 @@ import QtQuick 2.1 */ QtObject { + + /*! \internal */ + property Item __view: null + /*! The title text of the column. */ property string title @@ -56,8 +60,10 @@ QtObject { property string role /*! The current width of the column - The default value depends on platform. */ - property int width: 160 + The default value depends on platform. If only one + column is defined, the width expands to the viewport. + */ + property int width: (__view && __view.columnCount === 1) ? __view.viewport.width : 160 /*! The visible status of the column. */ property bool visible: true -- cgit v1.2.1 From ea2de46b77aa42f857d79cf0b23113c57e02c759 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Sun, 2 Jun 2013 13:56:30 +0200 Subject: Remove unnecessary bottom margin for TabView on mac This extra padding at the bottom is not needed and only serves to make the borders uneven on mac. Change-Id: Ibb3f8a3ba1f37ce1e9c6674a53cfb13e257fb97f Reviewed-by: Richard Moe Gustavsen --- src/controls/TabView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/controls') diff --git a/src/controls/TabView.qml b/src/controls/TabView.qml index 3273f825..e0d3ca3b 100644 --- a/src/controls/TabView.qml +++ b/src/controls/TabView.qml @@ -198,7 +198,7 @@ FocusScope { anchors.fill: parent anchors.margins: (frameVisible ? frameWidth : 0) anchors.topMargin: anchors.margins + (style =="mac" ? 6 : 0) - anchors.bottomMargin: anchors.margins + (style =="mac" ? 6 : 0) + anchors.bottomMargin: anchors.margins property int frameWidth property string style -- cgit v1.2.1 From 3eee91908e8bd0c5f3c3ebe59ef1e179c8d1eb68 Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Sat, 1 Jun 2013 17:16:10 +0200 Subject: Doc: Add doc structure for Styles And: - Add an index page for the Styles - Add missing documentation for some properties (Component) - Fix unexpected curly brackets in a couple of code snippets Change-Id: Ib7265d1cd011a81012eb4b7f69738b84fba5b531 Reviewed-by: Jerome Pasion --- src/controls/doc/qtquickcontrols.qdocconf | 17 ++-------- src/controls/doc/src/qtquickcontrols-index.qdoc | 7 ++++- src/controls/doc/src/styles.qdoc | 41 ------------------------- 3 files changed, 9 insertions(+), 56 deletions(-) delete mode 100644 src/controls/doc/src/styles.qdoc (limited to 'src/controls') diff --git a/src/controls/doc/qtquickcontrols.qdocconf b/src/controls/doc/qtquickcontrols.qdocconf index 7cf1ee54..ab321a74 100644 --- a/src/controls/doc/qtquickcontrols.qdocconf +++ b/src/controls/doc/qtquickcontrols.qdocconf @@ -18,18 +18,13 @@ qhp.QtQuickControls.filterAttributes = qtcontrols $QT_VERSION qtrefdoc qhp.QtQuickControls.customFilters.Qt.name = QtQuickControls $QT_VERSION qhp.QtQuickControls.customFilters.Qt.filterAttributes = qtquickcontrols $QT_VERSION -qhp.QtQuickControls.subprojects = qtquickcontrolsqmltypes styleqmltypes +qhp.QtQuickControls.subprojects = qtquickcontrolsqmltypes qhp.QtQuickControls.subprojects.qtquickcontrolsqmltypes.title = QML Types qhp.QtQuickControls.subprojects.qtquickcontrolsqmltypes.indexTitle = Qt Quick Controls QML Types qhp.QtQuickControls.subprojects.qtquickcontrolsqmltypes.selectors = class fake:qmlclass qhp.QtQuickControls.subprojects.qtquickcontrolsqmltypes.sortPages = true -qhp.QtQuickControls.subprojects.styleqmltypes.title = Styles QML Types -qhp.QtQuickControls.subprojects.styleqmltypes.indexTitle = Qt Quick Controls Styles QML Types -qhp.QtQuickControls.subprojects.styleqmltypes.selectors = class fake:qmlclass -qhp.QtQuickControls.subprojects.styleqmltypes.sortPages = true - -depends = qtqml qtquick qtwidgets qtdoc qtquicklayouts +depends = qtqml qtquick qtwidgets qtdoc qtquicklayouts qtquickcontrolsstyles exampledirs += ../../../examples/quick/controls @@ -37,21 +32,15 @@ exampledirs += ../../../examples/quick/controls examplesinstallpath = quick/controls headerdirs += ../ -headerdirs += ../ ../../styles/Base sourcedirs += ../ -sourcedirs += ../ ../../styles/Base -sources += ../../private/qstyleitem.cpp \ - ../../private/AbstractCheckable.qml \ +sources += ../../private/AbstractCheckable.qml \ ../../private/BasicButton.qml \ ../../private/FocusFrame.qml \ ../../private/ModalPopupBehavior.qml \ ../../private/ScrollBar.qml \ ../../private/TabBar.qml \ ../../private/Control.qml \ - ../../private/Style.qml \ - ../../private/qquickabstractstyle.h \ - ../../private/qquickabstractstyle.cpp imagedirs += images diff --git a/src/controls/doc/src/qtquickcontrols-index.qdoc b/src/controls/doc/src/qtquickcontrols-index.qdoc index 658d117b..0272755f 100644 --- a/src/controls/doc/src/qtquickcontrols-index.qdoc +++ b/src/controls/doc/src/qtquickcontrols-index.qdoc @@ -84,7 +84,12 @@ \section2 Styles \list - \li \l {Qt Quick Controls Styles QML Types} + \li \l {Qt Quick Controls Styles} + \endlist + + \section2 Styles + \list + \li \l {Qt Quick Layouts} \endlist */ diff --git a/src/controls/doc/src/styles.qdoc b/src/controls/doc/src/styles.qdoc deleted file mode 100644 index 40809414..00000000 --- a/src/controls/doc/src/styles.qdoc +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \qmlmodule QtQuick.Controls.Styles 1 - \title Qt Quick Controls Styles QML Types - \ingroup qmlmodules - \brief Provides QML types for Qt Quick Controls styles. - - The \l{Qt Quick Controls} module provides a set of QML types for handling - styles. - - Some of the controls allow custom styling similar to widget style sheets. - A styling object is usually a collection of properties that control behavior and simple delegates - that can be replaced with custom QML snippets. - -*/ -- cgit v1.2.1 From cbd4b0f4e83cd458bd0f1ecbb53f1d789dfe9ff7 Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Mon, 3 Jun 2013 10:43:33 +0200 Subject: Doc: Fixes warnings Fixes issues including: - Misspelled links - Links to signal with arguments - \table in SplitView.qml - Links to current file Change-Id: I2cbadf661a641f19ed55f6854922b2b69966bc9c Reviewed-by: Jerome Pasion --- src/controls/Button.qml | 2 +- src/controls/SplitView.qml | 8 ++++---- src/controls/TableView.qml | 5 ++--- src/controls/ToolButton.qml | 2 +- src/controls/qquickaction.cpp | 10 +++++----- src/controls/qquickexclusivegroup.cpp | 16 ++++++++-------- src/controls/qquickmenu.cpp | 4 ++-- src/controls/qquickmenuitem.cpp | 10 +++++----- 8 files changed, 28 insertions(+), 29 deletions(-) (limited to 'src/controls') diff --git a/src/controls/Button.qml b/src/controls/Button.qml index 1a9b198e..21231e57 100644 --- a/src/controls/Button.qml +++ b/src/controls/Button.qml @@ -80,7 +80,7 @@ BasicButton { property string text /*! This property holds the icon shown on the button. If the button has no - icon, the \l iconSource property will be an empty string. + icon, the iconSource property will be an empty string. The default value is the empty string. */ diff --git a/src/controls/SplitView.qml b/src/controls/SplitView.qml index aba7809f..ff44a03a 100644 --- a/src/controls/SplitView.qml +++ b/src/controls/SplitView.qml @@ -130,12 +130,12 @@ Item { child item. Inside the delegate the following properties are available: \table - \li readonly property bool styleData.index - Specifies the index of the splitter handle. The handle + \row \li readonly property bool styleData.index \li Specifies the index of the splitter handle. The handle between the first and the second item will get index 0, the next handle index 1 etc. - \li readonly property bool styleData.hovered - The handle is being hovered. - \li readonly property bool styleData.pressed - The handle is being pressed. - \li readonly property bool styleData.resizing - The handle is being dragged. + \row \li readonly property bool styleData.hovered \li The handle is being hovered. + \row \li readonly property bool styleData.pressed \li The handle is being pressed. + \row \li readonly property bool styleData.resizing \li The handle is being dragged. \endtable */ diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index 88a897e1..f6a8ed4b 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -65,8 +65,7 @@ import QtQuick.Controls.Styles 1.0 \endcode You provide title and size of a column header - by adding a \l TableViewColumn to the default \l header property - as demonstrated below. + by adding a \l TableViewColumn as demonstrated below. \code TableView { @@ -259,7 +258,7 @@ ScrollView { Depending on how the model is populated, the model may not be ready when TableView Component.onCompleted is called. In that case you may need to - delay the call to positionViewAtRow by using a \l {Timer}. + delay the call to positionViewAtRow by using a \l {QtQml::Timer}{Timer}. \note This method should only be called after the component has completed. */ diff --git a/src/controls/ToolButton.qml b/src/controls/ToolButton.qml index d6607d28..6cd3661b 100644 --- a/src/controls/ToolButton.qml +++ b/src/controls/ToolButton.qml @@ -46,7 +46,7 @@ import QtQuick.Controls.Private 1.0 \qmltype ToolButton \inqmlmodule QtQuick.Controls 1.0 \since QtQtuick.Controls 1.0 - \ingroup applicationwindow + \ingroup controls \brief Provides a button type that is typically used within a ToolBar. ToolButton is functionally similar to \l Button, but can provide a look that is more diff --git a/src/controls/qquickaction.cpp b/src/controls/qquickaction.cpp index a597515f..e240d111 100644 --- a/src/controls/qquickaction.cpp +++ b/src/controls/qquickaction.cpp @@ -123,7 +123,7 @@ QT_BEGIN_NAMESPACE Whether the action is enabled, and can be triggered. Defaults to \c true. - \sa tigger(), triggered() + \sa trigger(), triggered */ /*! @@ -140,7 +140,7 @@ QT_BEGIN_NAMESPACE If the action is \l checkable, this property reflects its checked state. Defaults to \c false. Its value is also false while \l checkable is false. - \sa toggled(), exclusiveGroup + \sa toggled, exclusiveGroup */ /*! @@ -169,14 +169,14 @@ QT_BEGIN_NAMESPACE /*! \qmlmethod Action::trigger() - Will emit the \l triggered() signal if the action is enabled. Will also emit the - \l toggled() signal if it is checkable. + Will emit the \l triggered signal if the action is enabled. Will also emit the + \l toggled signal if it is checkable. */ /*! \qmlsignal Action::toggled(checked) Emitted whenever a action's \l checked property changes. - This usually happens at the same time as \l triggered(). + This usually happens at the same time as \l triggered. */ QQuickAction::QQuickAction(QObject *parent) diff --git a/src/controls/qquickexclusivegroup.cpp b/src/controls/qquickexclusivegroup.cpp index eecff416..f1b6935e 100644 --- a/src/controls/qquickexclusivegroup.cpp +++ b/src/controls/qquickexclusivegroup.cpp @@ -97,9 +97,9 @@ static bool isChecked(const QObject *o) } \endcode - Several controls already support \l ExclusiveGroup, e.g. \l Action, \l MenuItem, \l Button, and \l RadioButton. + Several controls already support ExclusiveGroup, e.g. \l Action, \l MenuItem, \l Button, and \l RadioButton. - Since \l ExclusiveGroup only supports \l Action as child items, we need to manually assign the \c exclusiveGroup + Since ExclusiveGroup only supports \l Action as child items, we need to manually assign the \c exclusiveGroup property for other objects. \code @@ -131,9 +131,9 @@ static bool isChecked(const QObject *o) \section1 Adding support to ExclusiveGroup - It is possible to add support for \l ExclusiveGroup for an object, or control. It should have a \c checked + It is possible to add support for ExclusiveGroup for an object, or control. It should have a \c checked property, and either a \c checkedChanged, \c toggled(), or \c toggled(bool) signal. It also needs - to be bound with \l ExclusiveGroup::bindCheckable(object) when its \l ExclusiveGroup ty[ped property is set. + to be bound with \l ExclusiveGroup::bindCheckable() when its ExclusiveGroup ty[ped property is set. \code Item { @@ -149,13 +149,13 @@ static bool isChecked(const QObject *o) } \endcode - The example above shows the minimum necessary to add \l ExclusiveGroup support to any item. + The example above shows the minimum necessary to add ExclusiveGroup support to any item. */ /*! \qmlproperty object ExclusiveGroup::current - The currently selected object. Defaults to the first checked object bound to the \l ExclusiveGroup. + The currently selected object. Defaults to the first checked object bound to the ExclusiveGroup. If there is none, then it defaults to \c null. */ @@ -166,7 +166,7 @@ static bool isChecked(const QObject *o) You should only need to call this function when creating a component you want to be compatible with \c ExclusiveGroup. - \sa ExclusiveGroup::unbindCheckable(object) + \sa ExclusiveGroup::unbindCheckable() */ /*! @@ -176,7 +176,7 @@ static bool isChecked(const QObject *o) You should only need to call this function when creating a component you want to be compatible with \c ExclusiveGroup. - \sa ExclusiveGroup::bindCheckable(object) + \sa ExclusiveGroup::bindCheckable() */ QQuickExclusiveGroup::QQuickExclusiveGroup(QObject *parent) diff --git a/src/controls/qquickmenu.cpp b/src/controls/qquickmenu.cpp index efc49cd6..bb0ddae9 100644 --- a/src/controls/qquickmenu.cpp +++ b/src/controls/qquickmenu.cpp @@ -100,7 +100,7 @@ QT_BEGIN_NAMESPACE \endcode Note that in this case, the \c index parameter passed to \l insertItem() is relative - to the position of the \l Instatiator in the menu, as opposed to absolute position + to the position of the \l Instantiator in the menu, as opposed to absolute position in the menu. \sa MenuItem, MenuSeparator @@ -170,7 +170,7 @@ QT_BEGIN_NAMESPACE Adds an item to the menu. Returns the newly created \l MenuItem. - \sa insertItem(int before, string title) + \sa insertItem() */ /*! diff --git a/src/controls/qquickmenuitem.cpp b/src/controls/qquickmenuitem.cpp index de215df1..622fdd2d 100644 --- a/src/controls/qquickmenuitem.cpp +++ b/src/controls/qquickmenuitem.cpp @@ -329,14 +329,14 @@ void QQuickMenuText::updateIcon() Emitted when either the menu item or its bound action have been activated. - \sa trigger(), Action::triggered(), Action::toggled() + \sa trigger(), Action::triggered, Action::toggled */ /*! \qmlmethod MenuItem::trigger() Manually trigger a menu item. Will also trigger the item's bound action. - \sa triggered(), Action::trigger() + \sa triggered, Action::trigger() */ /*! @@ -360,7 +360,7 @@ void QQuickMenuText::updateIcon() If the menu item is checkable, this property reflects its checked state. Defaults to \c false. - \sa checkable, Action::toggled() + \sa checkable, Action::toggled */ /*! \qmlproperty ExclusiveGroup MenuItem::exclusiveGroup @@ -378,9 +378,9 @@ void QQuickMenuText::updateIcon() /*! \qmlsignal MenuItem::toggled(checked) Emitted whenever a menu item's \c checked property changes. - This usually happens at the same time as \l triggered(). + This usually happens at the same time as \l triggered. - \sa checked, triggered(), Action::triggered(), Action::toggled() + \sa checked, triggered, Action::triggered, Action::toggled */ /*! -- cgit v1.2.1 From 207366038543adf5ee6384ff2577410f48df7a13 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 3 Jun 2013 13:37:25 +0200 Subject: Fix incorrect size hint for ToolBar and StatusBar We only cared about reserving space for the height but while trying to actually get the minimumSize for a window based on the toolbar content I realized that we really need to calculate the width as well. Change-Id: I7b55b66a2475a2355d30614095f173a39f47f2f1 Reviewed-by: Caroline Chao --- src/controls/StatusBar.qml | 6 +++++- src/controls/ToolBar.qml | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/controls') diff --git a/src/controls/StatusBar.qml b/src/controls/StatusBar.qml index 068b6b20..85cc6681 100644 --- a/src/controls/StatusBar.qml +++ b/src/controls/StatusBar.qml @@ -79,7 +79,7 @@ Item { Accessible.role: Accessible.StatusBar width: parent ? parent.width : implicitWidth - implicitWidth: loader.item ? loader.item.implicitWidth : 200 + implicitWidth: container.leftMargin + container.rightMargin + container.calcWidth() implicitHeight: Math.max(container.topMargin + container.bottomMargin + container.calcHeight(), loader.item ? loader.item.implicitHeight : 19) @@ -134,6 +134,10 @@ Item { property int rightMargin: __style ? __style.padding.right : 0 property Item layoutItem: container.children.length === 1 ? container.children[0] : null + function calcWidth() { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) + + (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin + + layoutItem.anchors.rightMargin : 0) : + loader.item ? loader.item.implicitWidth: 0) } function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) + (layoutItem.anchors.fill ? layoutItem.anchors.topMargin + layoutItem.anchors.bottomMargin : 0) : loader.item ? loader.item.implicitHeight : 0) } diff --git a/src/controls/ToolBar.qml b/src/controls/ToolBar.qml index e5cc8419..b73a6f3e 100644 --- a/src/controls/ToolBar.qml +++ b/src/controls/ToolBar.qml @@ -83,7 +83,7 @@ Item { Accessible.role: Accessible.ToolBar width: parent ? parent.width : implicitWidth - implicitWidth: loader.item ? loader.item.implicitWidth : 200 + implicitWidth: container.leftMargin + container.rightMargin + container.calcWidth() implicitHeight: container.topMargin + container.bottomMargin + container.calcHeight() /*! \internal */ @@ -137,6 +137,10 @@ Item { property int rightMargin: __style ? __style.padding.right : 0 property Item layoutItem: container.children.length === 1 ? container.children[0] : null + function calcWidth() { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) + + (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin + + layoutItem.anchors.rightMargin : 0) : + loader.item ? loader.item.implicitWidth : 0) } function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) + (layoutItem.anchors.fill ? layoutItem.anchors.topMargin + layoutItem.anchors.bottomMargin : 0) : -- cgit v1.2.1 From 4e5bf941f1b3089c22392bb5416d44cb8defe47d Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 3 Jun 2013 15:53:50 +0200 Subject: Improve default size for several controls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We should set this to some decent default value that doesn't look wrong. Note that the width and height definition in TextArea could cause conflicts when used in layouts. Change-Id: I815ff96c02f9a9a76c07d57181f3a24291c83c52 Reviewed-by: Jan Arve Sæther Reviewed-by: Gabriel de Dietrich --- src/controls/ScrollView.qml | 5 +++-- src/controls/TabView.qml | 3 ++- src/controls/TableView.qml | 4 ++-- src/controls/TextArea.qml | 3 --- 4 files changed, 7 insertions(+), 8 deletions(-) (limited to 'src/controls') diff --git a/src/controls/ScrollView.qml b/src/controls/ScrollView.qml index 0af69a0d..aa980ddd 100644 --- a/src/controls/ScrollView.qml +++ b/src/controls/ScrollView.qml @@ -86,8 +86,9 @@ import QtQuick.Controls.Styles 1.0 FocusScope { id: root - implicitWidth: 200 - implicitHeight: 100 + + implicitWidth: 240 + implicitHeight: 150 /*! This property tells the ScrollView if it should render diff --git a/src/controls/TabView.qml b/src/controls/TabView.qml index e0d3ca3b..6319d72c 100644 --- a/src/controls/TabView.qml +++ b/src/controls/TabView.qml @@ -55,7 +55,8 @@ import QtQuick.Controls.Private 1.0 FocusScope { id: root - implicitWidth: 150 + + implicitWidth: 240 implicitHeight: 150 /*! The current tab index */ diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index f6a8ed4b..a71264da 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -359,8 +359,8 @@ ScrollView { Accessible.role: Accessible.Table - width: 200 - height: 200 + implicitWidth: 200 + implicitHeight: 150 frameVisible: true __scrollBarTopMargin: Qt.platform.os === "mac" ? headerrow.height : 0 diff --git a/src/controls/TextArea.qml b/src/controls/TextArea.qml index 43cc347c..cbef6e31 100644 --- a/src/controls/TextArea.qml +++ b/src/controls/TextArea.qml @@ -611,9 +611,6 @@ ScrollView { /*! \internal */ property int __documentMargin: 4 - width: 280 - height: 120 - frameVisible: true activeFocusOnTab: true -- cgit v1.2.1 From eeb3c959334d1e6b4ea9f7538b603a711f8a8262 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 3 Jun 2013 14:05:26 +0200 Subject: Buttons: Allow overriding of visual properties when 'action' is set Those properties are, text, tooltip, iconName, and iconSource. Also, properly capitalized gallery's tooltips. Change-Id: I1995a85565edd7aaa420279821d7c1a31ef18253 Reviewed-by: J-P Nurmi Reviewed-by: Jens Bache-Wiig --- src/controls/Button.qml | 22 ++++++++-------------- src/controls/ToolButton.qml | 12 ------------ src/controls/qquickaction_p.h | 9 ++++++--- src/controls/qquickmenuitem.cpp | 2 +- 4 files changed, 15 insertions(+), 30 deletions(-) (limited to 'src/controls') diff --git a/src/controls/Button.qml b/src/controls/Button.qml index 21231e57..1f00dccb 100644 --- a/src/controls/Button.qml +++ b/src/controls/Button.qml @@ -72,20 +72,6 @@ BasicButton { */ property bool isDefault: false - /*! This property holds the text shown on the button. If the button has no - text, the \l text property will be an empty string. - - The default value is the empty string. - */ - property string text - - /*! This property holds the icon shown on the button. If the button has no - icon, the iconSource property will be an empty string. - - The default value is the empty string. - */ - property url iconSource - /*! Assign a \l Menu to this property to get a pull-down menu button. The default value is \c null. @@ -115,6 +101,14 @@ BasicButton { value: button } + Binding { + target: button + property: "tooltip" + // We don't want a tooltip if it's the same as the button text + when: !!text && !(action && (!!action.tooltip || action.tooltip === text)) + value: "" + } + Connections { target: __behavior onEffectivePressedChanged: { diff --git a/src/controls/ToolButton.qml b/src/controls/ToolButton.qml index 6cd3661b..3c1eab1a 100644 --- a/src/controls/ToolButton.qml +++ b/src/controls/ToolButton.qml @@ -62,18 +62,6 @@ import QtQuick.Controls.Private 1.0 BasicButton { id: button - /*! The image label source as file name or resource. */ - property url iconSource - - /*! The image label source as theme name. - When an icon from the platform icon theme is found, this takes - precedence over iconSource. - */ - property url iconName - - /*! The label text. */ - property string text - activeFocusOnTab: true Accessible.name: text diff --git a/src/controls/qquickaction_p.h b/src/controls/qquickaction_p.h index e106a920..aa63b408 100644 --- a/src/controls/qquickaction_p.h +++ b/src/controls/qquickaction_p.h @@ -57,11 +57,11 @@ class QQuickAction : public QObject { Q_OBJECT - Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) - Q_PROPERTY(QUrl iconSource READ iconSource WRITE setIconSource NOTIFY iconSourceChanged) + Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged RESET resetText) + Q_PROPERTY(QUrl iconSource READ iconSource WRITE setIconSource NOTIFY iconSourceChanged RESET resetIconSource) Q_PROPERTY(QString iconName READ iconName WRITE setIconName NOTIFY iconNameChanged) Q_PROPERTY(QVariant __icon READ iconVariant NOTIFY iconChanged) - Q_PROPERTY(QString tooltip READ tooltip WRITE setTooltip NOTIFY tooltipChanged) + Q_PROPERTY(QString tooltip READ tooltip WRITE setTooltip NOTIFY tooltipChanged RESET resetTooltip) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY checkableChanged) Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled) @@ -76,6 +76,7 @@ public: ~QQuickAction(); QString text() const { return m_text; } + void resetText() { setText(QString()); } void setText(const QString &text); QString shortcut() const; @@ -87,9 +88,11 @@ public: void setIconName(const QString &iconName); QUrl iconSource() const { return m_iconSource; } + void resetIconSource() { setIconSource(QString()); } void setIconSource(const QUrl &iconSource); QString tooltip() const { return m_tooltip; } + void resetTooltip() { setTooltip(QString()); } void setTooltip(const QString &tooltip); bool isEnabled() const { return m_enabled; } diff --git a/src/controls/qquickmenuitem.cpp b/src/controls/qquickmenuitem.cpp index 622fdd2d..ed03b336 100644 --- a/src/controls/qquickmenuitem.cpp +++ b/src/controls/qquickmenuitem.cpp @@ -503,7 +503,7 @@ void QQuickMenuItem::setBoundAction(QQuickAction *a) QString QQuickMenuItem::text() const { QString ownText = QQuickMenuText::text(); - if (!ownText.isEmpty()) + if (!ownText.isNull()) return ownText; return m_boundAction ? m_boundAction->text() : QString(); } -- cgit v1.2.1 From 8db84cb14a049ff27ccc5893517d8c5ffe0fd636 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 3 Jun 2013 18:54:40 +0200 Subject: TextArea: allow declaring child elements inline Change-Id: I7da8e3664d6bd3ee9a8c4f22d4a5b686d1c5b5a9 Reviewed-by: Gabriel de Dietrich Reviewed-by: Jens Bache-Wiig --- src/controls/TextArea.qml | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/controls') diff --git a/src/controls/TextArea.qml b/src/controls/TextArea.qml index cbef6e31..4771fcb0 100644 --- a/src/controls/TextArea.qml +++ b/src/controls/TextArea.qml @@ -608,6 +608,9 @@ ScrollView { */ property alias backgroundColor: colorRect.color + /*! \internal */ + default property alias data: area.data + /*! \internal */ property int __documentMargin: 4 -- cgit v1.2.1 From 1c7d06f2696465993d63a33bf4144f49f02552bc Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 4 Jun 2013 11:03:39 +0200 Subject: Fix warning in Slider when stepSize is set Also adding a new test for stepSize Task-number: QTBUG-31441 Change-Id: Ib8d9cc2188b5f73b6b0ac866ade1a7edb1d662b7 Reviewed-by: Caroline Chao --- src/controls/Slider.qml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/controls') diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml index b31d4f78..e7e49151 100644 --- a/src/controls/Slider.qml +++ b/src/controls/Slider.qml @@ -197,6 +197,14 @@ Control { anchors.horizontalCenter: !__horizontal ? parent.horizontalCenter : undefined width: __panel.handleWidth height: __panel.handleHeight + + function updatePos() { + if (updateValueWhileDragging && !mouseArea.drag.active) + range.position = __horizontal ? x : y + } + + onXChanged: updatePos(); + onYChanged: updatePos(); } MouseArea { @@ -247,14 +255,6 @@ Control { } } - // Range position normally follows handle, except when - // 'updateValueWhileDragging' is false. - Binding { - when: updateValueWhileDragging && !mouseArea.drag.active - target: range - property: "position" - value: __horizontal ? fakeHandle.x : fakeHandle.y - } // During the drag, we simply ignore the position set from the range, this // means that setting a value while dragging will not "interrupt" the -- cgit v1.2.1 From ea30e6ff10180cea8f486e02d691a0d3410fd5c9 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 4 Jun 2013 13:18:42 +0200 Subject: Improve qtquick controls page Added more information for "Getting Started" - Cleaned up some language - Remove desktop specific - Mention widget dependency - Use QmlApplicationEngine in example Change-Id: I0e5d4bef124ce4571c1b6fe780ee78b8231cbb32 Reviewed-by: Jerome Pasion --- src/controls/doc/src/qtquickcontrols-index.qdoc | 54 +++++++++++++++++++++---- 1 file changed, 46 insertions(+), 8 deletions(-) (limited to 'src/controls') diff --git a/src/controls/doc/src/qtquickcontrols-index.qdoc b/src/controls/doc/src/qtquickcontrols-index.qdoc index 0272755f..5729fbae 100644 --- a/src/controls/doc/src/qtquickcontrols-index.qdoc +++ b/src/controls/doc/src/qtquickcontrols-index.qdoc @@ -29,19 +29,16 @@ \page qtquickcontrols-index.html \title Qt Quick Controls - \brief The Qt Quick Controls module provides a set of reusable Qt Quick UI components. + \brief The Qt Quick Controls module provides a set of UI controls for Qt Quick. - The Qt Quick Controls module provides a set of reusable UI components to create - classic desktop-style user interfaces using Qt Quick. + The Qt Quick Controls module provides a set of controls that can be used to + build complete interfaces in Qt Quick. The module is new in Qt 5.1 and requires \l{Qt Quick} 2.1. - \note \l{Qt Quick Layouts} can be used to arrange Qt Quick Controls in a user interface. + \image qtquickcontrols-example-gallery.png - \note The current focus is on desktop, but in the long term Qt Quick Controls - are expected to be supported on mobile platforms too. - - \section1 Getting started + \section1 Getting Started The QML types can be imported into your application using the following import statement in your \c {.qml} file. @@ -49,6 +46,47 @@ import QtQuick.Controls 1.0 \endcode + A basic example of a QML file that makes use of controls is shown here: + + \code + import QtQuick.Controls 1.0 + + ApplicationWindow { + title: "My Application" + + Button { + text: "Push Me" + anchors.centerIn: parent + } + } + \endcode + + \section2 Setting Up Controls from C++ + + While we traditionally have used a QQuickView window to display QML files + in a C++ application, doing this means you can only set window properties from C++. + + With Qt Quick Controls, declare an ApplicationWindow as the root item of your application and launch it by using the + QQmlApplicationEngine instead. This ensures that you can control top level window properties from QML. + + A basic example of a source file that makes use of controls is shown here: + + \code + #include + #include + + int main(int argc, char *argv[]) + { + QApplication app(argc, argv); + QQmlApplicationEngine engine("main.qml"); + return app.exec(); + } + \endcode + + \note We are using QApplication and not QGuiApplication in this example. + Though you can use QGuiApplication instead, doing this will eliminate platform-dependent styling. + This is because it is relying on the widget module to provide the native look and feel. + \section1 Application Window Components used to describe the basic window properties of an application. \annotatedlist applicationwindow -- cgit v1.2.1 From fef62c9b40ff1d79e62778e67c90f956da84b238 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 4 Jun 2013 19:28:26 +0200 Subject: Prevent possible division by zero This might cause problems on certain platforms. While hard to reproduce it seems safer to add the check. Note that we do not get the alternating pattern if there is nothing set on the model, but this was already the case. Change-Id: I984df9cfef30b4de0e72e8ccf14cc65bddbf04ef Reviewed-by: Gabriel de Dietrich --- src/controls/TableView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/controls') diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index a71264da..fad6ee47 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -470,7 +470,7 @@ ScrollView { // Fills extra rows with alternate color Column { id: rowfiller - property int rowHeight: listView.contentHeight/count + property int rowHeight: count ? listView.contentHeight/count : height property int paddedRowCount: height/rowHeight property int count: listView.count y: listView.contentHeight -- cgit v1.2.1 From 0ad4925f94c86dbe75e01d890fdb9fce64ca52fe Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Wed, 5 Jun 2013 10:58:13 +0200 Subject: Doc: Small fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I163f69c14ecbc07a66b1bac7c5a53b22405c895e Reviewed-by: Jan Arve Sæther Reviewed-by: Frederik Gladhorn --- src/controls/TextArea.qml | 2 +- src/controls/doc/src/qtquickcontrols-index.qdoc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/controls') diff --git a/src/controls/TextArea.qml b/src/controls/TextArea.qml index 4771fcb0..84f67b23 100644 --- a/src/controls/TextArea.qml +++ b/src/controls/TextArea.qml @@ -623,7 +623,7 @@ ScrollView { /*! \qmlproperty TextDocument TextArea::textDocument - This property exposes the \l QTextDocument of this TextArea. + This property exposes the \l QQuickTextDocument of this TextArea. \sa TextEdit::textDocument */ property alias textDocument: edit.textDocument diff --git a/src/controls/doc/src/qtquickcontrols-index.qdoc b/src/controls/doc/src/qtquickcontrols-index.qdoc index 5729fbae..5c22276e 100644 --- a/src/controls/doc/src/qtquickcontrols-index.qdoc +++ b/src/controls/doc/src/qtquickcontrols-index.qdoc @@ -125,7 +125,7 @@ \li \l {Qt Quick Controls Styles} \endlist - \section2 Styles + \section2 Layouts \list \li \l {Qt Quick Layouts} \endlist -- cgit v1.2.1 From 420bb714a8c8ebc67ad958897939d7d96e11806c Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Wed, 5 Jun 2013 09:54:28 +0200 Subject: Expose hovered to our controls and document it consistently The current solution is messy and we only expose it partially to some of our styles. I think we should simply expose this to all. Change-Id: Ia546d5657ea416df99c9d9d92cc714b7f1c928fe Reviewed-by: Caroline Chao Reviewed-by: Nico Vertriest --- src/controls/Button.qml | 2 +- src/controls/ComboBox.qml | 13 ++++++++++--- src/controls/ProgressBar.qml | 12 ++++++++++++ src/controls/Slider.qml | 18 +++++++++++------- src/controls/SpinBox.qml | 11 ++++++++--- src/controls/TextField.qml | 7 +++++-- 6 files changed, 47 insertions(+), 16 deletions(-) (limited to 'src/controls') diff --git a/src/controls/Button.qml b/src/controls/Button.qml index 1f00dccb..0a3cb131 100644 --- a/src/controls/Button.qml +++ b/src/controls/Button.qml @@ -80,7 +80,7 @@ BasicButton { /*! \qmlproperty bool BasicButton::pressed - This property holds whether the button is pressed. */ + This property holds whether the button is being pressed. */ readonly property bool pressed: __behavior.effectivePressed || menu && menu.__popupVisible activeFocusOnTab: true diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml index e5efb63c..9282c58d 100644 --- a/src/controls/ComboBox.qml +++ b/src/controls/ComboBox.qml @@ -99,10 +99,17 @@ Control { The default value is \c false. */ property bool activeFocusOnPress: false - /*! \internal */ + /*! \qmlproperty bool ComboBox::pressed + + This property holds whether the button is being pressed. */ readonly property bool pressed: mouseArea.pressed && mouseArea.containsMouse || popup.__popupVisible - /*! \internal */ - property alias __containsMouse: mouseArea.containsMouse + + /*! \qmlproperty bool ComboBox::hovered + + This property indicates whether the control is being hovered. + */ + readonly property alias hovered: mouseArea.containsMouse + /*! \internal */ property var __popup: popup diff --git a/src/controls/ProgressBar.qml b/src/controls/ProgressBar.qml index 6d9f8be1..e472e66e 100644 --- a/src/controls/ProgressBar.qml +++ b/src/controls/ProgressBar.qml @@ -98,6 +98,12 @@ Control { */ property int orientation: Qt.Horizontal + /*! \qmlproperty bool ProgressBar::hovered + + This property indicates whether the control is being hovered. + */ + readonly property alias hovered: hoverArea.containsMouse + /*! \internal */ style: Qt.createComponent(Settings.style + "/ProgressBarStyle.qml", progressbar) @@ -123,6 +129,12 @@ Control { implicitWidth:(__panel ? __panel.implicitWidth : 0) implicitHeight: (__panel ? __panel.implicitHeight: 0) + MouseArea { + id: hoverArea + anchors.fill: parent + hoverEnabled: true + } + /*! \internal */ function setValue(v) { var newval = parseFloat(v) diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml index e7e49151..64dcfff1 100644 --- a/src/controls/Slider.qml +++ b/src/controls/Slider.qml @@ -108,9 +108,16 @@ Control { /*! \qmlproperty bool Slider::pressed - This property indicates if slider handle is currently being pressed. + This property indicates whether the slider handle is being pressed. */ - property alias pressed: mouseArea.pressed + readonly property alias pressed: mouseArea.pressed + + /*! + \qmlproperty bool Slider::hovered + + This property indicates whether the control is being hovered. + */ + readonly property alias hovered: mouseArea.containsMouse /*! \qmlproperty real Slider::stepSize @@ -145,7 +152,7 @@ Control { /*! \qmlproperty bool Slider::activeFocusOnPress - This property indicates if the Slider should receive active focus when + This property indicates whether the Slider should receive active focus when pressed. */ property bool activeFocusOnPress: false @@ -153,16 +160,13 @@ Control { /*! \qmlproperty bool Slider::tickmarksEnabled - This property indicates if the Slider should display tickmarks + This property indicates whether the Slider should display tickmarks at step intervals. The default value is \c false. */ property bool tickmarksEnabled: false - /*! \internal */ - property bool __containsMouse: mouseArea.containsMouse - /*! \internal */ property bool __horizontal: orientation === Qt.Horizontal diff --git a/src/controls/SpinBox.qml b/src/controls/SpinBox.qml index 68f97e0a..b1f87cec 100644 --- a/src/controls/SpinBox.qml +++ b/src/controls/SpinBox.qml @@ -134,12 +134,19 @@ Control { */ property alias font: input.font - /*! This property indicates if the Spinbox should get active + /*! This property indicates whether the Spinbox should get active focus when pressed. The default value is \c true. */ property bool activeFocusOnPress: true + /*! + \qmlproperty bool SpinBox::hovered + + This property indicates whether the control is being hovered. + */ + readonly property alias hovered: mouseArea.containsMouse + style: Qt.createComponent(Settings.style + "/SpinBoxStyle.qml", spinbox) /*! \internal */ @@ -166,8 +173,6 @@ Control { readonly property alias downPressed: mouseDown.pressed readonly property alias downHovered: mouseDown.containsMouse - readonly property alias hovered: mouseArea.containsMouse - readonly property int contentHeight: Math.max(input.implicitHeight, 16) readonly property int contentWidth: Math.max(maxSizeHint.implicitWidth, minSizeHint.implicitWidth) } diff --git a/src/controls/TextField.qml b/src/controls/TextField.qml index 903a6462..32b2d4fb 100644 --- a/src/controls/TextField.qml +++ b/src/controls/TextField.qml @@ -524,8 +524,11 @@ Control { textInput.undo(); } - /*! \internal */ - property alias __containsMouse: mouseArea.containsMouse + /*! \qmlproperty bool TextField::hovered + + This property holds whether the control is being hovered. + */ + readonly property alias hovered: mouseArea.containsMouse /*! \internal */ property alias __contentHeight: textInput.contentHeight -- cgit v1.2.1 From f31c8c1b567cb3c2c0704ef1edb982999f96fd74 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Wed, 5 Jun 2013 11:47:10 +0200 Subject: Replace backgroundColor with backgroundVisible This exposes backgroundVisible to TableView and replaces backgroundColor in TextArea. We think the backgroundVisible is more flexible and allows us to find a more appropriate solution to support palette in the future. Change-Id: Icfcd512c29cf030059c4ce2d32feb402d1a33662 Reviewed-by: Caroline Chao Reviewed-by: J-P Nurmi --- src/controls/TableView.qml | 10 ++++++++++ src/controls/TextArea.qml | 9 ++++----- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'src/controls') diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index fad6ee47..c0212391 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -123,6 +123,16 @@ ScrollView { The default value is \c true. */ property bool headerVisible: true + /*! \qmlproperty bool TableView::backgroundVisible + + This property determines if the background should be filled or not. + + The default value is \c true. + + \note The rowDelegate is not affected by this property + */ + property alias backgroundVisible: colorRect.visible + /*! This property defines a delegate to draw a specific cell. In the item delegate you have access to the following special properties: diff --git a/src/controls/TextArea.qml b/src/controls/TextArea.qml index 84f67b23..fd715a36 100644 --- a/src/controls/TextArea.qml +++ b/src/controls/TextArea.qml @@ -599,14 +599,13 @@ ScrollView { edit.undo(); } - /*! - \qmlproperty color TextArea::backgroundColor + /*! \qmlproperty bool TextArea::backgroundVisible - This property sets the background color of the viewport. + This property determines if the background should be filled or not. - The default value is the base color of the SystemPalette. + The default value is \c true. */ - property alias backgroundColor: colorRect.color + property alias backgroundVisible: colorRect.visible /*! \internal */ default property alias data: area.data -- cgit v1.2.1 From 6694cbabbf905ede781f430d6ec7587c79f94de9 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Wed, 5 Jun 2013 20:21:43 +0200 Subject: Fix missing headerview gap when not showing frame in TableView Tested on all three platforms and looks better. Change-Id: I8a68dfc7fe97a05c4313ac10de2f93dabec5a964 Reviewed-by: Gabriel de Dietrich --- src/controls/TableView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/controls') diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index c0212391..17b2b186 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -607,7 +607,7 @@ ScrollView { anchors.topMargin: viewport.anchors.topMargin anchors.leftMargin: viewport.anchors.leftMargin anchors.margins: viewport.anchors.margins - anchors.rightMargin: __scroller.rightMargin + + anchors.rightMargin: (frameVisible ? __scroller.rightMargin : 0) + (__scroller.outerFrame && __scrollBarTopMargin ? 0 : __verticalScrollBar.width + __scroller.scrollBarSpacing + root.__style.padding.right) -- cgit v1.2.1 From a258188d303f1d3767eda05cd1ce3a96f7541fd8 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Tue, 7 May 2013 15:48:07 +0200 Subject: Doc: check language and compliance with Writing Guidelines Task-number: QTBUG-30318 Change-Id: I6117c41344f1a5015a1fa2d4a59950306a719313 Reviewed-by: Venugopal Shivashankar Reviewed-by: Jerome Pasion --- src/controls/StackView.qml | 252 +++++++++++++++++++++++---------------------- 1 file changed, 127 insertions(+), 125 deletions(-) (limited to 'src/controls') diff --git a/src/controls/StackView.qml b/src/controls/StackView.qml index be1ddf06..9559ea87 100644 --- a/src/controls/StackView.qml +++ b/src/controls/StackView.qml @@ -52,39 +52,38 @@ import "Private/StackView.js" as JSArray \brief Provides a stack-based navigation model. - StackView implements a stack-based navigation model. You use this view when you - have a set of interlinked information pages for the user to browse. - Items are pushed onto the stack as the user navigates deeper into the material, and - popped off again when he chooses to go back. + StackView implements a stack-based navigation model, which can be used + with a set of interlinked information pages. Items are pushed onto the stack + as the user navigates deeper into the material, and popped off again when he + chooses to go back. \section1 Using StackView in an Application Using the StackView in the application is typically a simple matter of adding - the StackView as a child of a Window. The stack is usually - anchored to the edges of the window, except at the top or bottom where it might - be anchored to a status bar, or some other similar UI component. - The stack can then be used by invoking its navigation methods. The first item - to show in the StackView is commonly loaded assigning it to \l initialItem. + the StackView as a child of a Window. The stack is usually anchored to the + edges of the window, except at the top or bottom where it might be anchored + to a status bar, or some other similar UI component. The stack can then be + used by invoking its navigation methods. The first item to show in the StackView + is commonly loaded assigning it to \l initialItem. \note Items pushed onto the stack view have \l{Supported Attached Properties}{Stack attached properties}. \section1 Basic Navigation - There are three primary navigation operations in StackView: push(), pop() and - replace (you replace by specifying argument \c replace to push()). + There are three primary navigation operations in StackView: push(), pop(), and + replace (replace by specifying argument \c replace to push()). These correspond to classic stack operations where "push" adds an item to the top of a stack, "pop" removes the top item from the stack, and "replace" is like a pop followed by a push in that it replaces the topmost item on the stack with a new item (but the applied transtition might be different). The topmost item - in the stack corresponds to the one that is \l{StackView::currentItem} {current}, - i.e. the one that is visible on - screen. That means that "push" is the logical equivalent of navigating forward or - deeper into the application, "pop" is the equivalent of navigation back and - "replace" is the equivalent of replacing the current item with a different item. - - Sometimes it is necessary to go back more than a single step in the stack, e.g. - to return to a "main" item or some kind of section item in the application. - For this use case, pop() can be provided with a item to pop to. This is called - an "unwind" operation as the stack gets unwound to the specified item. If the - item is not found then the stack unwinds until there is only a single item in + in the stack corresponds to the one that is \l{StackView::currentItem} {currently} + visible on the screen. That means that "push" is the logical equivalent of navigating + forward or deeper into the application, "pop" is the equivalent of navigating back, + and "replace" is the equivalent of replacing the current item. + + Sometimes it is necessary to go back more than a single step in the stack, for + example, to return to a "main" item or some kind of section item in the application. + For this use case, it is possible to specify an item as a parameter for pop(). + This is called an "unwind" operation as the stack gets unwound to the specified item. + If the item is not found then the stack unwinds until there is only a single item in the stack, which becomes the current item. To explicitly unwind to the bottom of the stack it is recommended to use \l{pop()} {pop(null)}, though technically any non-existent item will do. @@ -98,11 +97,11 @@ import "Private/StackView.js" as JSArray \li \l{pop()}{pop(A)} => [A] - "pop" transition between C and A \endlist - Note that when the stack is empty, a push() will not perform a - transition animation because there is nothing to transition from (which will - typically happend during application start-up). A pop() on a stack with - depth 1 or 0 is a no-operation. If removing all items from the stack is - needed, a separate function clear() is available. + \note Note that when the stack is empty, a push() will not perform a + transition animation because there is nothing to transition from (typically during + application start-up). A pop() on a stack with depth 1 or 0 is a no-operation. + If removing all items from the stack is needed, a separate function clear() is + available. Calling push() returns the item that was pushed onto the stack. Calling pop() returns the item that was popped off the stack. When pop() is @@ -110,22 +109,22 @@ import "Private/StackView.js" as JSArray popped, which will also be the one transitioning out) is returned. \section1 Deep Linking - Deep linking means launching an application into a particular state. For example - a Newspaper application could be launched into showing a particular article, - bypassing the front item (and possible a section item) that would normally have - to be navigated through to get to the article in question. In terms of StackView, deep - linking means the ability to modify the state of the stack so that - you e.g. push a set of items to the top of the stack, or that you completely reset + \e{Deep linking} means launching an application into a particular state. For example, + a newspaper application could be launched into showing a particular article, + bypassing the front item (and possibly a section item) that would normally have + to be navigated through to get to the article concerned. In terms of StackView, deep + linking means the ability to modify the state of the stack, so much so that it is + possible to push a set of items to the top of the stack, or to completely reset the stack to a given state. - The API for deep linking in StackView is the same as for basic navigation. If - you push an array instead of a single item then all the items in that array will + The API for deep linking in StackView is the same as for basic navigation. Pushing + an array instead of a single item, will involve that all the items in that array will be pushed onto the stack. The transition animation, however, will be conducted as if only the last item in the array was pushed onto the stack. The normal semantics - of push() apply for deep linking, meaning that push() adds whatever you push onto - the stack. Note also that only the last item in the array will actually be loaded. - The rest will be lazy loaded as needed when entering - the screen upon subsequent calls to pop (or when requesting the item by using \a get). + of push() apply for deep linking, meaning that push() adds whatever is pushed onto + the stack. Note also that only the last item of the array will be loaded. + The rest will be lazy-loaded as needed when entering the screen upon subsequent + calls to pop (or when requesting the item by using \a get). This gives us the following result, given the stack [A, B, C]: @@ -137,93 +136,95 @@ import "Private/StackView.js" as JSArray \section1 Pushing items - An item you push onto the StackView can be either an Item, a URL, a - string with a URL, or a Component. To push it, you assign it - to a property "item" inside a property list, and send it as argument to \l{StackView::push}{push}: + An item pushed onto the StackView can be either an Item, a URL, a string + with a URL, or a Component. To push it, assign it to a property "item" + inside a property list, and send it as an argument to \l{StackView::push}{push}: \code stackView.push({item: yourItem}) \endcode - The list can contain several properties that controls how the item should be pushed: + The list can contain several properties that control how the item should be pushed: \list - \li \c item: This property is required, and holds the item you want to push. - \li \c properties: You can set a property list of QML properties that should be assigned - to the item upon push. These properties will be copied into the item at the - time the item is loaded, or about to become the current item (normally upon push). - \li \c immediate: Set this property to \c true to skip transition effects. When pushing - an array, you only need to set this property on the first element to make the + \li \c item: this property is required, and holds the item to be pushed. + \li \c properties: a list of QML properties to be assigned to the item upon push. These + properties will be copied into the item at load time, or when the item will become + the current item (normally upon push). + \li \c immediate: set this property to \c true to skip transition effects. When pushing + an array, this property only needs to be set on the first element to make the whole operation immediate. - \li \c replace: Set this property to replace the current item on the stack. When pushing + \li \c replace: set this property to replace the current item on the stack. When pushing an array, you only need to set this property on the first element to replace as many elements on the stack as inside the array. - \li \c destroyOnPop: Set this property to be explicit to whether or not StackView should - destroy the item when its popped off the stack. By default (if \a destroyOnPop is - not specified), StackView will destroy items pushed as components or URLs. Items - not destroyed will be reparented back to the original parents they had before being - pushed onto the stack, and hidden. If you need to set this property, do it with - care, so that items are not leaked. + \li \c destroyOnPop: set this boolean to true if StackView needs to destroy the item when + it is popped off the stack. By default (if \a destroyOnPop is not specified), StackView + will destroy items pushed as components or URLs. Items not destroyed will be re-parented + back to the original parents they had before being pushed onto the stack and hidden. + If you need to set this property, do it with care, so that items are not leaked. \endlist - If the only argument needed is "item", you can also, as a short-hand - notation, do: + If the only argument needed is "item", the following short-hand notation can be applied: \code - stackView.push(yourItem). + stackView.push(yourItem) \endcode You can push several items in one go by using an array of property lists. This is optimizing compared to pushing items one by one, since StackView then can load only the last item in the list. The rest will be loaded as they are about to become - the current item (which happends when the stack is popped). The following example shows how + the current item (which happens when the stack is popped). The following example shows how to push an array of items: \code stackView.push([{item: yourItem1}, {item: yourItem2}]) \endcode - If inline items are pushed, the item gets re-parented into an internal - container in the StackView. When the item is later popped off, it gets - re-parented back to its original owner. If, however, an item is pushed - as a component or a URL, the actual item will be created as a item from that component. This - happens automatically when the item is about to become the current item in the stack. Ownership - over the item will then normally be taken by the StackView. It will as such automatically - destroy the item when it is later popped off. The component that declared the item, by + If an inline item is pushed, the item is temporarily re-parented into the StackView. When the item + is later popped off, it gets re-parented back to its original owner again. + If, however, an item is pushed as a component or a URL, the actual item will be created as an + item from that component. This happens automatically when the item is about to become the current + item in the stack. Ownership of the item will then normally be taken by the StackView. It will as + such automatically destroy the item when it is later popped off. The component that declared the item, by contrast, remains in the ownership of the application and is not destroyed by the stack. - You can override this behavior if needed by explicitly setting "destroyOnPop" in the list - argument given to push. + This can be overridden by explicitly setting \c{destroyOnPop} in the list of arguments given to push. - If you specify the \c properties property to push, these properties will be copied into - the item at the time the item is loaded (in case of a component or URL), or instead when - its about to become the current item (in case of an inline item). This normally happens when - the item is pushed. The following example shows how this can be done: + If the \c properties to be pushed are specified, they will be copied into the item at loading time + (in case of a component or URL), or when the item will become the current item (in case of an inline + item). The following example shows how this can be done: \code - stackView.push({item: someItem, properties: {fgcolor: "red", bgcolor: "blue"}}); + stackView.push({item: someItem, properties: {fgcolor: "red", bgcolor: "blue"}}) \endcode - Note that if an item is declared inside another item that is destroyed - even if a component - was used - that child item also gets destroyed. - This follows normal Qt parent-child destruction rules but sometimes comes as a surprise - for developers. In practice this means that if you declare a item B as a child of - item A and then do a replace from item A to item B, then item B will be destroyed when - item A was destroyed (as it was popped off the stack) and the application will effectively - be switching to a item that has been destroyed. + + \note Note that if an item is declared inside another item, and if that parent gets destroyed, + (even if a component was used), that child item will also be destroyed. + This follows normal Qt parent-child destruction rules, but sometimes comes as a surprise + for developers. \section1 Lifecycle - An items lifecycle in the StackView goes from instantiation to inactive, activating, active, - deactivating, inactive, and when no longer needed, destruction. + An item's lifecycle in the StackView can have the following transitions: + \list 1 + \li instantiation + \li inactive + \li activating + \li active + \li deactivating + \li inactive + \li destruction + \endlist + It can move any number of times between inactive and active. When an item is activated, it's visible on the screen and is considered to be the current item. An item in a StackView that is not visible is not activated, even if the item is currently the - top-most item in the stack. When the stack becomes visible the item that is top-most gets - activated. Likewise if the stack is then hidden, the top-most item would be deactivated. + top-most item in the stack. When the stack becomes visible, the item that is top-most gets + activated. Likewise if the stack is then hidden, the topmost item would be deactivated. Popping the item off the top of the stack at this point would not result in further deactivation since the item is not active. - There is an attached \l{Stack::status}{Stack.status} property that tracks the lifecycle. The value of status is - an enumeration with values \c Stack.Inactive, \c Stack.Activating, \c Stack.Active - and \c Stack.Deactivating. Combined with the normal \c Component.onComplete and + There is an attached \l{Stack::status}{Stack.status} property that tracks the lifecycle. The + status values list is an enumeration with values \c Stack.Inactive, \c Stack.Activating, + \c Stack.Active and \c Stack.Deactivating. Combined with the normal \c Component.onComplete and \c Component.onDestruction signals the entire lifecycle is thus: \list @@ -236,26 +237,26 @@ import "Private/StackView.js" as JSArray \endlist \section1 Finding items - Sometimes it is necessary to search for a item, e.g. in order to unwind the stack to + Sometimes it is necessary to search for an item, for example, in order to unwind the stack to an item to which the application does not have a reference. This is facilitated using a function find() in StackView. The find() function takes a callback function as its only argument. The callback gets invoked for each item in the stack (starting at the top). - If the callback returns true then it signals that a match has been found and the find() - function returns that item. If the callback fails to return true (i.e. no match is found) + If the callback returns true, then it signals that a match has been found and the find() + function returns that item. If the callback fails to return true (no match is found), then find() returns \c null. - The code below searches for an item in the stack that has a name "foo" and then unwinds to - that item. Note that since find() returns null if no item is found and since pop unwinds to - the bottom of the stack if null is given as the target item, the code works well even in the - case that no matching item was found. + The code below searches for an item in the stack that has a name "order_id" and then unwinds to + that item. Note that since find() returns \c {null} if no item is found, and since pop unwinds to + the bottom of the stack if null is given as the target item, the code works well even in + case no matching item is found. \code stackView.pop(stackView.find(function(item) { - return item.name == "foo"; + return item.name == "order_id"; })); \endcode - You can also get to a item in the stack using get(index). You should use + You can also get to an item in the stack using \l {get()}{get(index)}. You should use this function if your item depends on another item in the stack, as the function will ensure that the item at the given index gets loaded before it is returned. @@ -316,8 +317,8 @@ import "Private/StackView.js" as JSArray Implement this function to reset any properties animated on the exitItem so that later transitions can expect the items to be in a default state. - A more complex example could look like the following. Here, the items slides in lying on the side before - they are rotated up in an upright position: + A more complex example could look like the following. Here, the items are lying on the side before + being rotated to an upright position: \qml StackView { @@ -376,7 +377,7 @@ import "Private/StackView.js" as JSArray depending on the their internal state. StackView will expect you to return a Component that contains a StackViewTransition, or a StackViewTransition directly. The former is easier, as StackView will then create the transition and later destroy it when it's done, while avoiding any sideeffects - caused by the transition being alive long after it ran. Returning a StackViewTransition directly + caused by the transition being alive long after it has run. Returning a StackViewTransition directly can be useful if you need to write some sort of transition caching for performance reasons. As an optimization, you can also return \c null to signal that you just want to show/hide the items immediately without creating or running any transitions. You can also override this function if @@ -385,9 +386,9 @@ import "Private/StackView.js" as JSArray \c properties contains the properties that will be assigned to the StackViewTransition before it runs. In fact, you can add more properties to this object during the call if you need to initialize additional properties of your custom StackViewTransition when the returned - component is instanciated. + component is instantiated. - The following example shows how you can decide run-time which animation to use: + The following example shows how you can decide which animation to use during runtime : \qml StackViewDelegate { @@ -491,28 +492,28 @@ Item { /*! Pushes an item onto the stack. The function takes a property list as argument, which should contain one or more of the following properties: \list - \li \c item: This property is required, and holds the item you want to push. - \li \c properties: You can set a property list of QML properties that should be assigned - to the item upon push. These properties will be copied into the item at the - time the item is loaded (in case of a component or URL), or else the first time it - becomes the current item (normally upon push). - \li \c immediate: Set this property to \c true to skip transition effects. When pushing + \li \c item: this property is required, and holds the item you want to push. + \li \c properties: a list of QML properties that should be assigned + to the item upon push. These properties will be copied into the item when it is + loaded (in case of a component or URL), or when it becomes the current item for the + first time (normally upon push). + \li \c immediate: set this property to \c true to skip transition effects. When pushing an array, you only need to set this property on the first element to make the whole operation immediate. - \li \c replace: Set this property to replace the current item on the stack. When pushing + \li \c replace: set this property to replace the current item on the stack. When pushing an array, you only need to set this property on the first element to replace as many elements on the stack as inside the array. - \li \c destroyOnPop: Set this property to be explicit to whether or not StackView should - destroy the item when its popped off the stack. By default (if \a destroyOnPop is - not specified), StackView will destroy items pushed as components or URLs. Items - not destroyed will be reparented back to the original parents they had before being + \li \c destroyOnPop: set this property to specify if the item needs to be destroyed + when its popped off the stack. By default (if \a destroyOnPop is not specified), + StackView will destroy items pushed as components or URLs. Items + not destroyed will be re-parented to the original parents they had before being pushed onto the stack, and hidden. If you need to set this property, do it with care, so that items are not leaked. \endlist You can also push an array of items (property lists) if you need to push several items in one go. A transition will then only occur between the current item and the last - item in the list. The other items will be deferred loaded until needed. + item in the list. Loading the other items will be deferred until needed. Examples: \list @@ -524,8 +525,8 @@ Item { \li stackView.push([{item:anitem, immediate:true}, {item:aURL}]) \endlist - Note: If the only argument needed is "item", you can also, as a short-hand - notation, do: \c{stackView.push(anItem)}. + \note Note: if the only argument needed is "item", you can apply the following short- + hand notation: \c{stackView.push(anItem)}. Returns the item that became current. @@ -581,11 +582,11 @@ Item { /*! Pops one or more items off the stack. The function takes a property list as argument which can contain one or more of the following properties: \list - \li \c item: If specified, all items down to (but not including) \a item will be - popped off. if \a item is \c null, all items down to (but not including) the + \li \c item: if specified, all items down to (but not including) \a item will be + popped off. If \a item is \c null, all items down to (but not including) the first item will be popped. If not specified, only the current item will be popped. - \li \c immediate: Set this property to \c true to skip transition effects. + \li \c immediate: set this property to \c true to skip transition effects. \endlist Examples: @@ -596,8 +597,8 @@ Item { \li stackView.pop(null) \endlist - Note: If the only argument needed is "item", you can also, as a short-hand - notation, do: \c{stackView.pop(anItem)}. + \note Note: If the only argument needed is "item", you can apply the following short- + hand notation: \c{stackView.pop(anItem)}. Returns the item that was popped off \sa clear() @@ -668,7 +669,8 @@ Item { /*! Search for a specific item inside the stack. \a func will be called for each item in the stack (with the item as argument) - until the function returns true. Return value will be the item found. E.g: + until the function returns true. Return value will be the item found. For + example: find(function(item, index) { return item.isTheOne }) Set \a onlySearchLoadedItems to \c true to not load items that are not loaded into memory */ @@ -794,7 +796,7 @@ Item { element.destroyOnPop = true } } else { - // comp is already an Item, so just reparent it into the StackView: + // comp is already an Item, so just re-parent it into the StackView: element.item = comp element.originalParent = parent element.item.parent = root @@ -844,7 +846,7 @@ Item { /*! \internal */ function __cleanup(element) { // INVARIANT: element has been removed from JSArray. Destroy its - // item, or reparent it back to the parent it had before it was pushed: + // item, or re-parent it back to the parent it had before it was pushed: var item = element.item if (element.destroyOnPop) { item.destroy() @@ -871,7 +873,7 @@ Item { // Animate item in "outElement" out, and item in "inElement" in. Set a guard to protect // the user from pushing new items on signals that will fire while preparing for the transition // (e.g Stack.onCompleted, Stack.onStatusChanged, Stack.onIndexChanged etc). Otherwise, we will enter - // this function several times, which causes the items to be half-way updated. + // this function several times, which causes the items to be updated half-way. if (__currentTransition) __currentTransition.animation.complete() __loadElement(transition.inElement) -- cgit v1.2.1 From 5303f814746606a78198fec5c02746c2f3090460 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 3 Jun 2013 12:47:40 +0200 Subject: Updated activation signals in TableView - Added row property to activated() - Added clicked(row) signal - Added doubleClicked(row) signal - We also fixed the behavior so that we do not emit activated if the user clicks outside of the available rows. - We fixed a problem where key events would not be seen outside of the control Change-Id: I13feba26e900daf85be7be88216f1a0a4a446c57 Reviewed-by: J-P Nurmi --- src/controls/TableView.qml | 76 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 59 insertions(+), 17 deletions(-) (limited to 'src/controls') diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index 17b2b186..44aecfc2 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -239,10 +239,30 @@ ScrollView { /*! \internal */ property alias __currentRowItem: listView.currentItem - /*! \qmlsignal TableView::activated() - Emitted when the user activates an item by single or double-clicking (depending on the platform). + /*! \qmlsignal TableView::activated(int row) + + Emitted when the user activates an item by mouse or keyboard interaction. + Mouse activation is triggered by single- or double-clicking, depending on the platform. + + \a row int provides access to the activated row index. + */ + signal activated(int row) + + /*! \qmlsignal TableView::clicked(int row) + + Emitted when the user clicks a valid row by single clicking + + \a row int provides access to the clicked row index. + */ + signal clicked(int row) + + /*! \qmlsignal TableView::doubleClicked(int row) + + Emitted when the user double clicks a valid row. + + \a row int provides access to the clicked row index. */ - signal activated + signal doubleClicked(int row) /*! \qmlmethod TableView::positionViewAtRow( int row, PositionMode mode ) @@ -447,28 +467,39 @@ ScrollView { autoincrement = false; autodecrement = false; } - var y = Math.min(listView.contentY + listView.height - 5, Math.max(mouseY + listView.contentY, listView.contentY)); - var newIndex = listView.indexAt(0, y); - if (newIndex >= 0) - listView.currentIndex = listView.indexAt(0, y); + + if (pressed) { + var newIndex = listView.indexAt(0, mouseY + listView.contentY) + if (newIndex >= 0) + listView.currentIndex = newIndex; + } } onClicked: { - if (root.__activateItemOnSingleClick) - root.activated() + var clickIndex = listView.indexAt(0, mouseY + listView.contentY) + if (clickIndex > -1) { + if (root.__activateItemOnSingleClick) + root.activated(clickIndex) + root.clicked(clickIndex) + } mouse.accepted = false } onPressed: { + var newIndex = listView.indexAt(0, mouseY + listView.contentY) listView.forceActiveFocus() - var x = Math.min(listView.contentWidth - 5, Math.max(mouseX + listView.contentX, 0)) - var y = Math.min(listView.contentHeight - 5, Math.max(mouseY + listView.contentY, 0)) - listView.currentIndex = listView.indexAt(x, y) + if (newIndex > -1) { + listView.currentIndex = newIndex + } } onDoubleClicked: { - if (!root.__activateItemOnSingleClick) - root.activated() + var clickIndex = listView.indexAt(0, mouseY + listView.contentY) + if (clickIndex > -1) { + if (!root.__activateItemOnSingleClick) + root.activated(clickIndex) + root.doubleClicked(clickIndex) + } } // Note: with boolean preventStealing we are keeping the flickable from @@ -511,8 +542,15 @@ ScrollView { highlightFollowsCurrentItem: true model: root.model - Keys.onUpPressed: root.__decrementCurrentIndex() - Keys.onDownPressed: root.__incrementCurrentIndex() + Keys.onUpPressed: { + event.accepted = false + root.__decrementCurrentIndex() + } + + Keys.onDownPressed: { + event.accepted = false + root.__incrementCurrentIndex() + } Keys.onPressed: { if (event.key === Qt.Key_PageUp) { @@ -521,7 +559,11 @@ ScrollView { verticalScrollBar.value = __verticalScrollBar.value + listView.height } - Keys.onReturnPressed: root.activated(); + Keys.onReturnPressed: { + event.accepted = false + if (currentRow > -1) + root.activated(currentRow); + } delegate: Item { id: rowitem -- cgit v1.2.1 From 68abb104e902454b8daba23b108c1ad89e33d890 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 11 Jun 2013 09:21:05 +0200 Subject: Fix TableView::positionViewAtRow() Task-number: QTBUG-31631 Change-Id: Iaf5bd5c895f0fd94c7ffec19b571786ee9352782 Reviewed-by: Jens Bache-Wiig Reviewed-by: Caroline Chao --- src/controls/TableView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/controls') diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index 44aecfc2..6f05d605 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -294,7 +294,7 @@ ScrollView { */ function positionViewAtRow(row, mode) { - listView.positionViewAtRow(row, mode) + listView.positionViewAtIndex(row, mode) } /*! -- cgit v1.2.1 From 3b10c17e34bd6da6278600f57a0ecafe5eb58431 Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Mon, 10 Jun 2013 09:38:28 +0200 Subject: Move doc from the index to the overview page Cleanup the links. And doc fix in TableViewStyle.qml Change-Id: Id61fcff49af79f35f68696900142bb200ae18042 Reviewed-by: Jens Bache-Wiig Reviewed-by: Nico Vertriest --- src/controls/doc/src/qtquickcontrols-index.qdoc | 74 ++------------------ src/controls/doc/src/qtquickcontrols-overview.qdoc | 79 +++++++++++++++++++++- src/controls/qquickstack.cpp | 1 - 3 files changed, 82 insertions(+), 72 deletions(-) (limited to 'src/controls') diff --git a/src/controls/doc/src/qtquickcontrols-index.qdoc b/src/controls/doc/src/qtquickcontrols-index.qdoc index 5c22276e..96f2a670 100644 --- a/src/controls/doc/src/qtquickcontrols-index.qdoc +++ b/src/controls/doc/src/qtquickcontrols-index.qdoc @@ -36,56 +36,7 @@ The module is new in Qt 5.1 and requires \l{Qt Quick} 2.1. - \image qtquickcontrols-example-gallery.png - - \section1 Getting Started - - The QML types can be imported into your application using the following import statement in your \c {.qml} file. - - \code - import QtQuick.Controls 1.0 - \endcode - - A basic example of a QML file that makes use of controls is shown here: - - \code - import QtQuick.Controls 1.0 - - ApplicationWindow { - title: "My Application" - - Button { - text: "Push Me" - anchors.centerIn: parent - } - } - \endcode - - \section2 Setting Up Controls from C++ - - While we traditionally have used a QQuickView window to display QML files - in a C++ application, doing this means you can only set window properties from C++. - - With Qt Quick Controls, declare an ApplicationWindow as the root item of your application and launch it by using the - QQmlApplicationEngine instead. This ensures that you can control top level window properties from QML. - - A basic example of a source file that makes use of controls is shown here: - - \code - #include - #include - - int main(int argc, char *argv[]) - { - QApplication app(argc, argv); - QQmlApplicationEngine engine("main.qml"); - return app.exec(); - } - \endcode - - \note We are using QApplication and not QGuiApplication in this example. - Though you can use QGuiApplication instead, doing this will eliminate platform-dependent styling. - This is because it is relying on the widget module to provide the native look and feel. + Visit the \l{Qt Quick Controls Overview} page to get started. \section1 Application Window Components used to describe the basic window properties of an application. @@ -105,29 +56,12 @@ \section1 Related information - \section2 Guides \list + \li \l{Qt Quick} \li \l{Qt Quick Controls Overview} - \endlist - - \section2 Reference - \list \li \l{Qt Quick Controls QML Types}{Qt Quick Controls QML Types} - \endlist - - \section2 Examples - \list \li \l{Qt Quick Controls Examples} + \li \l{Qt Quick Controls Styles} + \li \l{Qt Quick Layouts} \endlist - - \section2 Styles - \list - \li \l {Qt Quick Controls Styles} - \endlist - - \section2 Layouts - \list - \li \l {Qt Quick Layouts} - \endlist - */ diff --git a/src/controls/doc/src/qtquickcontrols-overview.qdoc b/src/controls/doc/src/qtquickcontrols-overview.qdoc index 82da0b22..4eb6892f 100644 --- a/src/controls/doc/src/qtquickcontrols-overview.qdoc +++ b/src/controls/doc/src/qtquickcontrols-overview.qdoc @@ -28,5 +28,82 @@ /*! \page qtquickcontrols-overview.html \title Qt Quick Controls Overview - \brief A set of APIs for working with ... + \brief A set of UI controls to create user interfaces in Qt Quick + + The Qt Quick Controls provide a set of UI controls to create user interfaces + in Qt Quick. + + \section1 Getting Started + + The QML types can be imported into your application using the following import statement in your \c {.qml} file. + + \code + import QtQuick.Controls 1.0 + \endcode + + \section1 Creating a basic example + + A basic example of a QML file that makes use of controls is shown here: + + \code + import QtQuick.Controls 1.0 + + ApplicationWindow { + title: "My Application" + + Button { + text: "Push Me" + anchors.centerIn: parent + } + } + \endcode + + For an overview of the controls provided by \l{Qt Quick Controls}, you can look at + the \l{Qt Quick Controls - Gallery}{Gallery} example. + + \image qtquickcontrols-example-gallery.png + + \section1 Setting Up Controls from C++ + + Although we have traditionally used a QQuickView window to display QML files + in a C++ application, doing this means you can only set window properties from C++. + + With Qt Quick Controls, declare an ApplicationWindow as the root item of your application and launch it by using the + QQmlApplicationEngine instead. This ensures that you can control top level window properties from QML. + + A basic example of a source file that makes use of controls is shown here: + + \code + #include + #include + + int main(int argc, char *argv[]) + { + QApplication app(argc, argv); + QQmlApplicationEngine engine("main.qml"); + return app.exec(); + } + \endcode + + \note We are using QApplication and not QGuiApplication in this example. + Though you can use QGuiApplication instead, doing this will eliminate platform-dependent styling. + This is because it is relying on the widget module to provide the native look and feel. + + \section2 Using C++ Data From QML + + If you need to register a C++ class to use from QML, you can call, for example, + qmlRegisterType() before declaring your QQmlApplicationEngine. You can find the list + of all registering functions \l{QQmlEngine}{here}. + + If you need to expose data to QML components, you need to set them + to the context of the current QML engine. See QQmlContext for more + information. + + \section1 Related information + + \list + \li \l{Qt Quick} + \li \l{Qt Quick Controls} + \li \l{Qt Quick Controls Examples} + \endlist */ diff --git a/src/controls/qquickstack.cpp b/src/controls/qquickstack.cpp index ecf873d7..c949ffeb 100644 --- a/src/controls/qquickstack.cpp +++ b/src/controls/qquickstack.cpp @@ -47,7 +47,6 @@ QT_BEGIN_NAMESPACE \qmltype Stack \instantiates QQuickStack \inqmlmodule QtQuick.Controls 1.0 - \ingroup views \brief Provides attached properties for items pushed onto a StackView. The Stack type provides attached properties for items pushed onto a \l StackView. -- cgit v1.2.1 From 41e13d3746c8b7b5cd550091c63fd8ab066422cf Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Tue, 11 Jun 2013 09:13:44 +0200 Subject: Add qml/js files in resource files To make deployment of Qt Quick Controls based applications easier. Task-number: QTBUG-31565 Change-Id: I0b8af2864ef0dc9121eed3189ced64712bdb3d20 Reviewed-by: Friedemann Kleint Reviewed-by: Jens Bache-Wiig --- src/controls/Button.qml | 1 + src/controls/CheckBox.qml | 1 + src/controls/ComboBox.qml | 1 + src/controls/MenuBar.qml | 1 + src/controls/ProgressBar.qml | 1 + src/controls/RadioButton.qml | 1 + src/controls/Slider.qml | 1 + src/controls/SpinBox.qml | 1 + src/controls/StackView.qml | 2 +- src/controls/StatusBar.qml | 1 + src/controls/TabView.qml | 1 + src/controls/TextField.qml | 2 +- src/controls/ToolBar.qml | 1 + src/controls/ToolButton.qml | 1 + src/controls/controls.pro | 5 ++++- src/controls/plugin.cpp | 28 ++++++++++++++++++++++++++++ src/controls/qmldir | 26 -------------------------- src/controls/resources.qrc | 30 ++++++++++++++++++++++++++++++ 18 files changed, 76 insertions(+), 29 deletions(-) create mode 100644 src/controls/resources.qrc (limited to 'src/controls') diff --git a/src/controls/Button.qml b/src/controls/Button.qml index 0a3cb131..efafe26b 100644 --- a/src/controls/Button.qml +++ b/src/controls/Button.qml @@ -41,6 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.0 /*! \qmltype Button diff --git a/src/controls/CheckBox.qml b/src/controls/CheckBox.qml index 48d5e8b2..9d6f5dfe 100644 --- a/src/controls/CheckBox.qml +++ b/src/controls/CheckBox.qml @@ -41,6 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.0 /*! \qmltype CheckBox diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml index 9282c58d..b65e749a 100644 --- a/src/controls/ComboBox.qml +++ b/src/controls/ComboBox.qml @@ -41,6 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.0 /*! \qmltype ComboBox diff --git a/src/controls/MenuBar.qml b/src/controls/MenuBar.qml index 65af1c12..566c814f 100644 --- a/src/controls/MenuBar.qml +++ b/src/controls/MenuBar.qml @@ -42,6 +42,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Styles 1.0 import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.0 /*! \qmltype MenuBar diff --git a/src/controls/ProgressBar.qml b/src/controls/ProgressBar.qml index e472e66e..2270ff49 100644 --- a/src/controls/ProgressBar.qml +++ b/src/controls/ProgressBar.qml @@ -41,6 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.0 /*! \qmltype ProgressBar diff --git a/src/controls/RadioButton.qml b/src/controls/RadioButton.qml index fde08817..305e464c 100644 --- a/src/controls/RadioButton.qml +++ b/src/controls/RadioButton.qml @@ -41,6 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.0 /*! \qmltype RadioButton diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml index 64dcfff1..9fee75e6 100644 --- a/src/controls/Slider.qml +++ b/src/controls/Slider.qml @@ -41,6 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.0 /*! \qmltype Slider diff --git a/src/controls/SpinBox.qml b/src/controls/SpinBox.qml index b1f87cec..06ec64ce 100644 --- a/src/controls/SpinBox.qml +++ b/src/controls/SpinBox.qml @@ -41,6 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.0 /*! \qmltype SpinBox diff --git a/src/controls/StackView.qml b/src/controls/StackView.qml index 9559ea87..623a1026 100644 --- a/src/controls/StackView.qml +++ b/src/controls/StackView.qml @@ -41,7 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import "Private/StackView.js" as JSArray +import "../private/StackView.js" as JSArray /*! \qmltype StackView diff --git a/src/controls/StatusBar.qml b/src/controls/StatusBar.qml index 85cc6681..62b81807 100644 --- a/src/controls/StatusBar.qml +++ b/src/controls/StatusBar.qml @@ -41,6 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.0 /*! \qmltype StatusBar diff --git a/src/controls/TabView.qml b/src/controls/TabView.qml index 6319d72c..503a203e 100644 --- a/src/controls/TabView.qml +++ b/src/controls/TabView.qml @@ -41,6 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.0 /*! \qmltype TabView diff --git a/src/controls/TextField.qml b/src/controls/TextField.qml index 32b2d4fb..b7e6996e 100644 --- a/src/controls/TextField.qml +++ b/src/controls/TextField.qml @@ -41,7 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import "Styles" +import QtQuick.Controls.Styles 1.0 /*! \qmltype TextField diff --git a/src/controls/ToolBar.qml b/src/controls/ToolBar.qml index b73a6f3e..cadea5c7 100644 --- a/src/controls/ToolBar.qml +++ b/src/controls/ToolBar.qml @@ -41,6 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.0 /*! \qmltype ToolBar diff --git a/src/controls/ToolButton.qml b/src/controls/ToolButton.qml index 3c1eab1a..3cf32789 100644 --- a/src/controls/ToolButton.qml +++ b/src/controls/ToolButton.qml @@ -41,6 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 +import QtQuick.Controls.Styles 1.0 /*! \qmltype ToolButton diff --git a/src/controls/controls.pro b/src/controls/controls.pro index fbda88fc..fad8f2d9 100644 --- a/src/controls/controls.pro +++ b/src/controls/controls.pro @@ -5,7 +5,7 @@ QT += qml quick gui-private core-private QMAKE_DOCS = $$PWD/doc/qtquickcontrols.qdocconf -QML_FILES = \ +OTHER_FILES = \ ApplicationWindow.qml \ Button.qml \ CheckBox.qml \ @@ -37,3 +37,6 @@ include(plugin.pri) CONFIG += no_cxx_module load(qml_plugin) + +RESOURCES += \ + resources.qrc diff --git a/src/controls/plugin.cpp b/src/controls/plugin.cpp index 1b255302..71cc3196 100644 --- a/src/controls/plugin.cpp +++ b/src/controls/plugin.cpp @@ -98,6 +98,34 @@ void QtQuickControlsPlugin::registerTypes(const char *uri) QLatin1String("Do not create objects of type MenuBase")); qmlRegisterUncreatableType(uri, 1, 0, "Stack", QLatin1String("Do not create objects of type Stack")); + + // Controls in resources file + qmlRegisterType(QUrl("qrc:/controls/ApplicationWindow.qml"), uri, 1, 0, "ApplicationWindow"); + qmlRegisterType(QUrl("qrc:/controls/Button.qml"), uri, 1, 0, "Button"); + qmlRegisterType(QUrl("qrc:/controls/CheckBox.qml"), uri, 1, 0, "CheckBox"); + qmlRegisterType(QUrl("qrc:/controls/ComboBox.qml"), uri, 1, 0, "ComboBox"); + qmlRegisterType(QUrl("qrc:/controls/GroupBox.qml"), uri, 1, 0, "GroupBox"); + qmlRegisterType(QUrl("qrc:/controls/Label.qml"), uri, 1, 0, "Label"); + qmlRegisterType(QUrl("qrc:/controls/Menu.qml"), uri, 1, 0, "Menu"); + qmlRegisterType(QUrl("qrc:/controls/MenuBar.qml"), uri, 1, 0, "MenuBar"); + qmlRegisterType(QUrl("qrc:/controls/ProgressBar.qml"), uri, 1, 0, "ProgressBar"); + qmlRegisterType(QUrl("qrc:/controls/RadioButton.qml"), uri, 1, 0, "RadioButton"); + qmlRegisterType(QUrl("qrc:/controls/ScrollView.qml"), uri, 1, 0, "ScrollView"); + qmlRegisterType(QUrl("qrc:/controls/Slider.qml"), uri, 1, 0, "Slider"); + qmlRegisterType(QUrl("qrc:/controls/SpinBox.qml"), uri, 1, 0, "SpinBox"); + qmlRegisterType(QUrl("qrc:/controls/SplitView.qml"), uri, 1, 0, "SplitView"); + qmlRegisterType(QUrl("qrc:/controls/StackView.qml"), uri, 1, 0, "StackView"); + qmlRegisterType(QUrl("qrc:/controls/StackViewDelegate.qml"), uri, 1, 0, "StackViewDelegate"); + qmlRegisterType(QUrl("qrc:/controls/StackViewTransition.qml"), uri, 1, 0, "StackViewTransition"); + qmlRegisterType(QUrl("qrc:/controls/StatusBar.qml"), uri, 1, 0, "StatusBar"); + qmlRegisterType(QUrl("qrc:/controls/Tab.qml"), uri, 1, 0, "Tab"); + qmlRegisterType(QUrl("qrc:/controls/TableView.qml"), uri, 1, 0, "TableView"); + qmlRegisterType(QUrl("qrc:/controls/TableViewColumn.qml"), uri, 1, 0, "TableViewColumn"); + qmlRegisterType(QUrl("qrc:/controls/TextField.qml"), uri, 1, 0, "TextField"); + qmlRegisterType(QUrl("qrc:/controls/TabView.qml"), uri, 1, 0, "TabView"); + qmlRegisterType(QUrl("qrc:/controls/TextArea.qml"), uri, 1, 0, "TextArea"); + qmlRegisterType(QUrl("qrc:/controls/ToolBar.qml"), uri, 1, 0, "ToolBar"); + qmlRegisterType(QUrl("qrc:/controls/ToolButton.qml"), uri, 1, 0, "ToolButton"); } void QtQuickControlsPlugin::initializeEngine(QQmlEngine *engine, const char *uri) diff --git a/src/controls/qmldir b/src/controls/qmldir index c243360c..41d4d512 100644 --- a/src/controls/qmldir +++ b/src/controls/qmldir @@ -1,28 +1,2 @@ module QtQuick.Controls plugin qtquickcontrolsplugin -ApplicationWindow 1.0 ApplicationWindow.qml -Button 1.0 Button.qml -CheckBox 1.0 CheckBox.qml -ComboBox 1.0 ComboBox.qml -GroupBox 1.0 GroupBox.qml -Label 1.0 Label.qml -MenuBar 1.0 MenuBar.qml -Menu 1.0 Menu.qml -StackView 1.0 StackView.qml -ProgressBar 1.0 ProgressBar.qml -RadioButton 1.0 RadioButton.qml -ScrollView 1.0 ScrollView.qml -Slider 1.0 Slider.qml -SpinBox 1.0 SpinBox.qml -SplitView 1.0 SplitView.qml -StackViewDelegate 1.0 StackViewDelegate.qml -StackViewTransition 1.0 StackViewTransition.qml -StatusBar 1.0 StatusBar.qml -Tab 1.0 Tab.qml -TabView 1.0 TabView.qml -TableView 1.0 TableView.qml -TableViewColumn 1.0 TableViewColumn.qml -TextArea 1.0 TextArea.qml -TextField 1.0 TextField.qml -ToolBar 1.0 ToolBar.qml -ToolButton 1.0 ToolButton.qml diff --git a/src/controls/resources.qrc b/src/controls/resources.qrc new file mode 100644 index 00000000..5cf71c61 --- /dev/null +++ b/src/controls/resources.qrc @@ -0,0 +1,30 @@ + + + ApplicationWindow.qml + Button.qml + CheckBox.qml + ComboBox.qml + GroupBox.qml + Label.qml + Menu.qml + MenuBar.qml + ProgressBar.qml + RadioButton.qml + ScrollView.qml + Slider.qml + SpinBox.qml + SplitView.qml + StackView.qml + StackViewDelegate.qml + StackViewTransition.qml + StatusBar.qml + Tab.qml + TableView.qml + TableViewColumn.qml + TabView.qml + TextArea.qml + TextField.qml + ToolBar.qml + ToolButton.qml + + -- cgit v1.2.1 From 03c7e64ef5f3dfd10d61fd2473fb9f09b124c6e6 Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Fri, 14 Jun 2013 15:01:34 +0200 Subject: Revert "Add qml/js files in resource files" We need to investigate more this solution. Deployment issue for Qt Quick Controls will be a known limitation in 5.1.0. This reverts commit 41e13d3746c8b7b5cd550091c63fd8ab066422cf. Change-Id: I501be7494bdbdfbb799d31c612d0c20e7f87ffc7 Reviewed-by: Friedemann Kleint Reviewed-by: Jens Bache-Wiig Reviewed-by: Liang Qi --- src/controls/Button.qml | 1 - src/controls/CheckBox.qml | 1 - src/controls/ComboBox.qml | 1 - src/controls/MenuBar.qml | 1 - src/controls/ProgressBar.qml | 1 - src/controls/RadioButton.qml | 1 - src/controls/Slider.qml | 1 - src/controls/SpinBox.qml | 1 - src/controls/StackView.qml | 2 +- src/controls/StatusBar.qml | 1 - src/controls/TabView.qml | 1 - src/controls/TextField.qml | 2 +- src/controls/ToolBar.qml | 1 - src/controls/ToolButton.qml | 1 - src/controls/controls.pro | 5 +---- src/controls/plugin.cpp | 28 ---------------------------- src/controls/qmldir | 26 ++++++++++++++++++++++++++ src/controls/resources.qrc | 30 ------------------------------ 18 files changed, 29 insertions(+), 76 deletions(-) delete mode 100644 src/controls/resources.qrc (limited to 'src/controls') diff --git a/src/controls/Button.qml b/src/controls/Button.qml index efafe26b..0a3cb131 100644 --- a/src/controls/Button.qml +++ b/src/controls/Button.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype Button diff --git a/src/controls/CheckBox.qml b/src/controls/CheckBox.qml index 9d6f5dfe..48d5e8b2 100644 --- a/src/controls/CheckBox.qml +++ b/src/controls/CheckBox.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype CheckBox diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml index b65e749a..9282c58d 100644 --- a/src/controls/ComboBox.qml +++ b/src/controls/ComboBox.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype ComboBox diff --git a/src/controls/MenuBar.qml b/src/controls/MenuBar.qml index 566c814f..65af1c12 100644 --- a/src/controls/MenuBar.qml +++ b/src/controls/MenuBar.qml @@ -42,7 +42,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Styles 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype MenuBar diff --git a/src/controls/ProgressBar.qml b/src/controls/ProgressBar.qml index 2270ff49..e472e66e 100644 --- a/src/controls/ProgressBar.qml +++ b/src/controls/ProgressBar.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype ProgressBar diff --git a/src/controls/RadioButton.qml b/src/controls/RadioButton.qml index 305e464c..fde08817 100644 --- a/src/controls/RadioButton.qml +++ b/src/controls/RadioButton.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype RadioButton diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml index 9fee75e6..64dcfff1 100644 --- a/src/controls/Slider.qml +++ b/src/controls/Slider.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype Slider diff --git a/src/controls/SpinBox.qml b/src/controls/SpinBox.qml index 06ec64ce..b1f87cec 100644 --- a/src/controls/SpinBox.qml +++ b/src/controls/SpinBox.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype SpinBox diff --git a/src/controls/StackView.qml b/src/controls/StackView.qml index 623a1026..9559ea87 100644 --- a/src/controls/StackView.qml +++ b/src/controls/StackView.qml @@ -41,7 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import "../private/StackView.js" as JSArray +import "Private/StackView.js" as JSArray /*! \qmltype StackView diff --git a/src/controls/StatusBar.qml b/src/controls/StatusBar.qml index 62b81807..85cc6681 100644 --- a/src/controls/StatusBar.qml +++ b/src/controls/StatusBar.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype StatusBar diff --git a/src/controls/TabView.qml b/src/controls/TabView.qml index 503a203e..6319d72c 100644 --- a/src/controls/TabView.qml +++ b/src/controls/TabView.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype TabView diff --git a/src/controls/TextField.qml b/src/controls/TextField.qml index b7e6996e..32b2d4fb 100644 --- a/src/controls/TextField.qml +++ b/src/controls/TextField.qml @@ -41,7 +41,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 +import "Styles" /*! \qmltype TextField diff --git a/src/controls/ToolBar.qml b/src/controls/ToolBar.qml index cadea5c7..b73a6f3e 100644 --- a/src/controls/ToolBar.qml +++ b/src/controls/ToolBar.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype ToolBar diff --git a/src/controls/ToolButton.qml b/src/controls/ToolButton.qml index 3cf32789..3c1eab1a 100644 --- a/src/controls/ToolButton.qml +++ b/src/controls/ToolButton.qml @@ -41,7 +41,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 -import QtQuick.Controls.Styles 1.0 /*! \qmltype ToolButton diff --git a/src/controls/controls.pro b/src/controls/controls.pro index fad8f2d9..fbda88fc 100644 --- a/src/controls/controls.pro +++ b/src/controls/controls.pro @@ -5,7 +5,7 @@ QT += qml quick gui-private core-private QMAKE_DOCS = $$PWD/doc/qtquickcontrols.qdocconf -OTHER_FILES = \ +QML_FILES = \ ApplicationWindow.qml \ Button.qml \ CheckBox.qml \ @@ -37,6 +37,3 @@ include(plugin.pri) CONFIG += no_cxx_module load(qml_plugin) - -RESOURCES += \ - resources.qrc diff --git a/src/controls/plugin.cpp b/src/controls/plugin.cpp index 71cc3196..1b255302 100644 --- a/src/controls/plugin.cpp +++ b/src/controls/plugin.cpp @@ -98,34 +98,6 @@ void QtQuickControlsPlugin::registerTypes(const char *uri) QLatin1String("Do not create objects of type MenuBase")); qmlRegisterUncreatableType(uri, 1, 0, "Stack", QLatin1String("Do not create objects of type Stack")); - - // Controls in resources file - qmlRegisterType(QUrl("qrc:/controls/ApplicationWindow.qml"), uri, 1, 0, "ApplicationWindow"); - qmlRegisterType(QUrl("qrc:/controls/Button.qml"), uri, 1, 0, "Button"); - qmlRegisterType(QUrl("qrc:/controls/CheckBox.qml"), uri, 1, 0, "CheckBox"); - qmlRegisterType(QUrl("qrc:/controls/ComboBox.qml"), uri, 1, 0, "ComboBox"); - qmlRegisterType(QUrl("qrc:/controls/GroupBox.qml"), uri, 1, 0, "GroupBox"); - qmlRegisterType(QUrl("qrc:/controls/Label.qml"), uri, 1, 0, "Label"); - qmlRegisterType(QUrl("qrc:/controls/Menu.qml"), uri, 1, 0, "Menu"); - qmlRegisterType(QUrl("qrc:/controls/MenuBar.qml"), uri, 1, 0, "MenuBar"); - qmlRegisterType(QUrl("qrc:/controls/ProgressBar.qml"), uri, 1, 0, "ProgressBar"); - qmlRegisterType(QUrl("qrc:/controls/RadioButton.qml"), uri, 1, 0, "RadioButton"); - qmlRegisterType(QUrl("qrc:/controls/ScrollView.qml"), uri, 1, 0, "ScrollView"); - qmlRegisterType(QUrl("qrc:/controls/Slider.qml"), uri, 1, 0, "Slider"); - qmlRegisterType(QUrl("qrc:/controls/SpinBox.qml"), uri, 1, 0, "SpinBox"); - qmlRegisterType(QUrl("qrc:/controls/SplitView.qml"), uri, 1, 0, "SplitView"); - qmlRegisterType(QUrl("qrc:/controls/StackView.qml"), uri, 1, 0, "StackView"); - qmlRegisterType(QUrl("qrc:/controls/StackViewDelegate.qml"), uri, 1, 0, "StackViewDelegate"); - qmlRegisterType(QUrl("qrc:/controls/StackViewTransition.qml"), uri, 1, 0, "StackViewTransition"); - qmlRegisterType(QUrl("qrc:/controls/StatusBar.qml"), uri, 1, 0, "StatusBar"); - qmlRegisterType(QUrl("qrc:/controls/Tab.qml"), uri, 1, 0, "Tab"); - qmlRegisterType(QUrl("qrc:/controls/TableView.qml"), uri, 1, 0, "TableView"); - qmlRegisterType(QUrl("qrc:/controls/TableViewColumn.qml"), uri, 1, 0, "TableViewColumn"); - qmlRegisterType(QUrl("qrc:/controls/TextField.qml"), uri, 1, 0, "TextField"); - qmlRegisterType(QUrl("qrc:/controls/TabView.qml"), uri, 1, 0, "TabView"); - qmlRegisterType(QUrl("qrc:/controls/TextArea.qml"), uri, 1, 0, "TextArea"); - qmlRegisterType(QUrl("qrc:/controls/ToolBar.qml"), uri, 1, 0, "ToolBar"); - qmlRegisterType(QUrl("qrc:/controls/ToolButton.qml"), uri, 1, 0, "ToolButton"); } void QtQuickControlsPlugin::initializeEngine(QQmlEngine *engine, const char *uri) diff --git a/src/controls/qmldir b/src/controls/qmldir index 41d4d512..c243360c 100644 --- a/src/controls/qmldir +++ b/src/controls/qmldir @@ -1,2 +1,28 @@ module QtQuick.Controls plugin qtquickcontrolsplugin +ApplicationWindow 1.0 ApplicationWindow.qml +Button 1.0 Button.qml +CheckBox 1.0 CheckBox.qml +ComboBox 1.0 ComboBox.qml +GroupBox 1.0 GroupBox.qml +Label 1.0 Label.qml +MenuBar 1.0 MenuBar.qml +Menu 1.0 Menu.qml +StackView 1.0 StackView.qml +ProgressBar 1.0 ProgressBar.qml +RadioButton 1.0 RadioButton.qml +ScrollView 1.0 ScrollView.qml +Slider 1.0 Slider.qml +SpinBox 1.0 SpinBox.qml +SplitView 1.0 SplitView.qml +StackViewDelegate 1.0 StackViewDelegate.qml +StackViewTransition 1.0 StackViewTransition.qml +StatusBar 1.0 StatusBar.qml +Tab 1.0 Tab.qml +TabView 1.0 TabView.qml +TableView 1.0 TableView.qml +TableViewColumn 1.0 TableViewColumn.qml +TextArea 1.0 TextArea.qml +TextField 1.0 TextField.qml +ToolBar 1.0 ToolBar.qml +ToolButton 1.0 ToolButton.qml diff --git a/src/controls/resources.qrc b/src/controls/resources.qrc deleted file mode 100644 index 5cf71c61..00000000 --- a/src/controls/resources.qrc +++ /dev/null @@ -1,30 +0,0 @@ - - - ApplicationWindow.qml - Button.qml - CheckBox.qml - ComboBox.qml - GroupBox.qml - Label.qml - Menu.qml - MenuBar.qml - ProgressBar.qml - RadioButton.qml - ScrollView.qml - Slider.qml - SpinBox.qml - SplitView.qml - StackView.qml - StackViewDelegate.qml - StackViewTransition.qml - StatusBar.qml - Tab.qml - TableView.qml - TableViewColumn.qml - TabView.qml - TextArea.qml - TextField.qml - ToolBar.qml - ToolButton.qml - - -- cgit v1.2.1 From f5f818e3adfa9d39c4955ffe34443027427a7f74 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Mon, 17 Jun 2013 13:08:46 +0200 Subject: Doc: Fix QCH filter attributes for Qt Quick Controls/Styles Fix typos in filter attibutes, preventing filtering from working in Assistant. Task-number: QTBUG-31796 Change-Id: I21c91b43881cd73ae7df4203922085e7c9f93e8f Reviewed-by: Caroline Chao Reviewed-by: Jerome Pasion --- src/controls/doc/qtquickcontrols.qdocconf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/controls') diff --git a/src/controls/doc/qtquickcontrols.qdocconf b/src/controls/doc/qtquickcontrols.qdocconf index ab321a74..44fd86ca 100644 --- a/src/controls/doc/qtquickcontrols.qdocconf +++ b/src/controls/doc/qtquickcontrols.qdocconf @@ -14,7 +14,7 @@ qhp.QtQuickControls.indexTitle = Qt Quick Controls qhp.QtQuickControls.indexRoot = #qhp.QtQuickControls.extraFiles = style/qtquickcontrols.css -qhp.QtQuickControls.filterAttributes = qtcontrols $QT_VERSION qtrefdoc +qhp.QtQuickControls.filterAttributes = qtquickcontrols $QT_VERSION qtrefdoc qhp.QtQuickControls.customFilters.Qt.name = QtQuickControls $QT_VERSION qhp.QtQuickControls.customFilters.Qt.filterAttributes = qtquickcontrols $QT_VERSION -- cgit v1.2.1 From f90d7eed222d65bd35730c2dd09fc68c3d67eea0 Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Mon, 24 Jun 2013 09:26:05 +0200 Subject: Doc: Small fix for SplitView SplitView items must set width/height and not Layout.preferredWidth/Layout.preferredHeight. Change-Id: Ice888d51c63cbdaf6e0e235c0c7569c4a8794b7d Reviewed-by: Richard Moe Gustavsen Reviewed-by: Jens Bache-Wiig --- src/controls/SplitView.qml | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/controls') diff --git a/src/controls/SplitView.qml b/src/controls/SplitView.qml index ff44a03a..8214981a 100644 --- a/src/controls/SplitView.qml +++ b/src/controls/SplitView.qml @@ -76,8 +76,6 @@ import QtQuick.Controls.Private 1.0 as Private \list \li \l{Layout::minimumWidth}{Layout.minimumWidth} \li \l{Layout::minimumHeight}{Layout.minimumHeight} - \li \l{Layout::preferredWidth}{Layout.preferredWidth} - \li \l{Layout::preferredHeight}{Layout.preferredHeight} \li \l{Layout::maximumWidth}{Layout.maximumWidth} \li \l{Layout::maximumHeight}{Layout.maximumHeight} \li \l{Layout::fillWidth}{Layout.fillWidth} (\c true for only one child) -- cgit v1.2.1 From aa4ddfd8443f07badc0899d835027e46c6e0dfd8 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 24 Jun 2013 14:05:56 +0200 Subject: Adapt to Qt.platform.os rename ("mac" -> "osx") Change-Id: I089a01bee10b92f85dcdd338c695a3b796b0ecd1 Reviewed-by: Jens Bache-Wiig Reviewed-by: Jake Petroules --- src/controls/TableView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/controls') diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index 6f05d605..b02a49c0 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -393,7 +393,7 @@ ScrollView { implicitHeight: 150 frameVisible: true - __scrollBarTopMargin: Qt.platform.os === "mac" ? headerrow.height : 0 + __scrollBarTopMargin: Qt.platform.os === "osx" ? headerrow.height : 0 __viewTopMargin: headerrow.height /*! \internal */ -- cgit v1.2.1