diff options
author | Jens Bache-Wiig <jens.bache-wiig@digia.com> | 2013-02-22 11:23:24 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-22 13:38:25 +0100 |
commit | 59b12b5240f94c4822cdf4f1e4cb05bc0ede76e9 (patch) | |
tree | 4e350c46dcd4dabbb5e74e35498c620c42c84d06 | |
parent | a0714a669030d13f592e20f2a9ef145132bf00e6 (diff) | |
download | qtquickcontrols-59b12b5240f94c4822cdf4f1e4cb05bc0ede76e9.tar.gz |
Rename ScrollArea to ScrollView
We want to introduce View as a common name for items that
are not simple controlss but views controlling other items
Change-Id: I13ffc096742ec13023c58b4744ad53084e11cc67
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
-rw-r--r-- | examples/gallery/content/Panel.qml | 2 | ||||
-rw-r--r-- | src/controls/ScrollView.qml (renamed from src/controls/ScrollArea.qml) | 30 | ||||
-rw-r--r-- | src/controls/TableView.qml | 2 | ||||
-rw-r--r-- | src/controls/TextArea.qml | 6 | ||||
-rw-r--r-- | src/controls/controls.pro | 2 | ||||
-rw-r--r-- | src/controls/qmldir | 2 | ||||
-rw-r--r-- | src/private/ScrollViewHelper.qml (renamed from src/private/ScrollAreaHelper.qml) | 2 | ||||
-rw-r--r-- | src/private/private.pro | 2 | ||||
-rw-r--r-- | src/private/qmldir | 2 | ||||
-rw-r--r-- | src/styles/Desktop/ScrollAreaStyle.qml | 57 | ||||
-rw-r--r-- | src/styles/ScrollAreaStyle.qml | 54 | ||||
-rw-r--r-- | src/styles/styles.pro | 2 | ||||
-rw-r--r-- | tests/auto/controls/controls.pro | 2 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_scrollview.qml (renamed from tests/auto/controls/data/tst_scrollarea.qml) | 74 | ||||
-rw-r--r-- | tests/manual/scrollbars.qml | 8 | ||||
-rw-r--r-- | tests/manual/testbench/content/Components.qml | 4 | ||||
-rw-r--r-- | tests/manual/testbench/main.qml | 6 |
17 files changed, 72 insertions, 185 deletions
diff --git a/examples/gallery/content/Panel.qml b/examples/gallery/content/Panel.qml index 6ea8e556..f6081d0b 100644 --- a/examples/gallery/content/Panel.qml +++ b/examples/gallery/content/Panel.qml @@ -51,7 +51,7 @@ Rectangle { width: 540 height: 340 color:"#c3c3c3" - ScrollArea { + ScrollView { frame:false anchors.fill: parent diff --git a/src/controls/ScrollArea.qml b/src/controls/ScrollView.qml index 5bdba3b5..21812b5a 100644 --- a/src/controls/ScrollArea.qml +++ b/src/controls/ScrollView.qml @@ -43,21 +43,21 @@ import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 /*! - \qmltype ScrollArea + \qmltype ScrollView \inqmlmodule QtQuick.Controls 1.0 \ingroup navigation - \brief The ScrollArea class provides a scrolling view onto another Item. + \brief The ScrollView class provides a scrolling view onto another Item. - A ScrollArea can be used either instead of a \l Flickable or to decorate an + A ScrollView can be used either instead of a \l Flickable or to decorate an existing Flickable. Depending on the platform it will add scroll bars and a content frame. - Only one Item can be a direct child of the ScrollArea and the child is implicitly anchored + Only one Item can be a direct child of the ScrollView and the child is implicitly anchored to fill the scroll view. Example: \code - ScrollArea { + ScrollView { Image { imageSource: "largeImage.png" } } \endcode @@ -68,14 +68,14 @@ import QtQuick.Controls.Private 1.0 Example: \code - ScrollArea { + ScrollView { ListView { ... } } \endcode - In this case the content size of the ScrollArea will simply mirror that of its contained + In this case the content size of the ScrollView will simply mirror that of its contained \l flickableItem. */ @@ -86,7 +86,7 @@ FocusScope { implicitHeight: 100 /*! - This property tells the scroll area if it should render + This property tells the scroll view if it should render a frame around it's content. The default value is \c false @@ -95,7 +95,7 @@ FocusScope { /*! This property controls if there should be a highlight - around the frame when the ScrollArea has input focus. + around the frame when the ScrollView has input focus. The default value is \c false @@ -105,7 +105,7 @@ FocusScope { property bool highlightOnFocus: false /*! - \qmlproperty Item ScrollArea::viewport + \qmlproperty Item ScrollView::viewport The viewport determines the current "window" on to the contentItem. In other words it clips it and the size of the viewport tells you @@ -114,15 +114,15 @@ FocusScope { property alias viewport: viewportItem /*! - \qmlproperty Item ScrollArea::flickableItem + \qmlproperty Item ScrollView::flickableItem - The flickableItem of the ScrollArea. If the contentItem provided - to the ScrollArea is a Flickable, it will be the \l contentItem. + The flickableItem of the ScrollView. If the contentItem provided + to the ScrollView is a Flickable, it will be the \l contentItem. */ readonly property alias flickableItem: internal.flickableItem /*! - The contentItem of the ScrollArea. This is set by the user. + The contentItem of the ScrollView. This is set by the user. Note that the definition of contentItem is somewhat different to that of a Flickable, where the contentItem is implicitly created. @@ -249,7 +249,7 @@ FocusScope { } } - ScrollAreaHelper { + ScrollViewHelper { id: scroller anchors.fill: parent property int frameWidth: frame ? styleitem.pixelMetric("defaultframewidth") : 0 diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index 2f200c3a..d61c9945 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -92,7 +92,7 @@ import QtQuick.Controls.Private 1.0 \endlist */ -ScrollArea { +ScrollView { id: root /*! This property holds the model providing data for the list. diff --git a/src/controls/TextArea.qml b/src/controls/TextArea.qml index 6a39c73c..f697581f 100644 --- a/src/controls/TextArea.qml +++ b/src/controls/TextArea.qml @@ -66,7 +66,7 @@ import QtQuick.Controls.Private 1.0 \sa TextField, TextEdit */ -ScrollArea { +ScrollView { id: area /*! @@ -572,7 +572,7 @@ ScrollArea { } /*! - \qmlproperty color ScrollArea:backgroundColor + \qmlproperty color ScrollView:backgroundColor This property sets the background color of the viewport. @@ -630,7 +630,7 @@ ScrollArea { KeyNavigation.tab: area.tabChangesFocus ? area.KeyNavigation.tab : null KeyNavigation.backtab: area.tabChangesFocus ? area.KeyNavigation.backtab : null - // keep textcursor within scrollarea + // keep textcursor within scroll view onCursorPositionChanged: { if (cursorRectangle.y >= flickableItem.contentY + viewport.height - 1.5*cursorRectangle.height - documentMargins) flickableItem.contentY = cursorRectangle.y - viewport.height + 1.5*cursorRectangle.height + documentMargins diff --git a/src/controls/controls.pro b/src/controls/controls.pro index 7af5a965..1324aa51 100644 --- a/src/controls/controls.pro +++ b/src/controls/controls.pro @@ -23,7 +23,7 @@ QML_FILES = \ PageTransition.qml \ ProgressBar.qml \ RadioButton.qml \ - ScrollArea.qml \ + ScrollView.qml \ Slider.qml \ SpinBox.qml \ Splitter.qml \ diff --git a/src/controls/qmldir b/src/controls/qmldir index b3de1110..6543c8ae 100644 --- a/src/controls/qmldir +++ b/src/controls/qmldir @@ -15,7 +15,7 @@ PageStack 1.0 PageStack.qml PageTransition 1.0 PageTransition.qml ProgressBar 1.0 ProgressBar.qml RadioButton 1.0 RadioButton.qml -ScrollArea 1.0 ScrollArea.qml +ScrollView 1.0 ScrollView.qml Slider 1.0 Slider.qml SpinBox 1.0 SpinBox.qml Splitter 1.0 Splitter.qml diff --git a/src/private/ScrollAreaHelper.qml b/src/private/ScrollViewHelper.qml index 40187b98..0386213a 100644 --- a/src/private/ScrollAreaHelper.qml +++ b/src/private/ScrollViewHelper.qml @@ -43,7 +43,7 @@ import QtQuick.Controls 1.0 import QtQuick.Controls.Private 1.0 /*! - \qmltype ScrollAreaHeader + \qmltype ScrollViewHeader \internal \inqmlmodule QtQuick.Controls.Private 1.0 */ diff --git a/src/private/private.pro b/src/private/private.pro index 23381d0e..6f4caaaf 100644 --- a/src/private/private.pro +++ b/src/private/private.pro @@ -30,7 +30,7 @@ QML_FILES += \ ModalPopupBehavior.qml \ PageSlideTransition.qml \ PageStack.js \ - ScrollAreaHelper.qml \ + ScrollViewHelper.qml \ ScrollBar.qml \ FocusFrame.qml diff --git a/src/private/qmldir b/src/private/qmldir index d4589068..788e341e 100644 --- a/src/private/qmldir +++ b/src/private/qmldir @@ -4,6 +4,6 @@ Control 1.0 Control.qml FocusFrame 1.0 FocusFrame.qml BasicButton 1.0 BasicButton.qml ScrollBar 1.0 ScrollBar.qml -ScrollAreaHelper 1.0 ScrollAreaHelper.qml +ScrollViewHelper 1.0 ScrollViewHelper.qml TabBar 1.0 TabBar.qml PageSlideTransition 1.0 PageSlideTransition.qml diff --git a/src/styles/Desktop/ScrollAreaStyle.qml b/src/styles/Desktop/ScrollAreaStyle.qml deleted file mode 100644 index a86e9ecb..00000000 --- a/src/styles/Desktop/ScrollAreaStyle.qml +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Controls 1.0 -import QtQuick.Controls.Private 1.0 - -StyleItem { - id: styleitem - elementType: "frame" - sunken: true - visible: frame - anchors.fill: parent - anchors.rightMargin: frame ? (frameAroundContents ? (verticalScrollBar.visible ? verticalScrollBar.width + 2 * frameMargins : 0) : 0) : 0 - anchors.bottomMargin: frame ? (frameAroundContents ? (horizontalScrollBar.visible ? horizontalScrollBar.height + 2 * frameMargins : 0) : 0) : 0 - anchors.topMargin: frame ? (frameAroundContents ? 0 : 0) : 0 - property int frameWidth - property int scrollbarspacing: pixelMetric("scrollbarspacing"); - property int frameMargins : frame ? scrollbarspacing : 0 - Component.onCompleted: frameWidth = pixelMetric("defaultframewidth"); -} diff --git a/src/styles/ScrollAreaStyle.qml b/src/styles/ScrollAreaStyle.qml deleted file mode 100644 index 46e9a480..00000000 --- a/src/styles/ScrollAreaStyle.qml +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtQuick.Controls 1.0 - -/*! - \qmltype ScrollAreaStyle - \internal - \inqmlmodule QtQuick.Controls.Styles 1.0 -*/ -Rectangle { - height:20 - width: 20 - anchors.fill: parent - color: "white" - border.color: "gray" -} diff --git a/src/styles/styles.pro b/src/styles/styles.pro index a7a72793..70c6ba1e 100644 --- a/src/styles/styles.pro +++ b/src/styles/styles.pro @@ -9,7 +9,6 @@ QML_FILES = \ MenuStyle.qml \ ProgressBarStyle.qml \ RadioButtonStyle.qml \ - ScrollAreaStyle.qml \ ScrollBarStyle.qml \ Settings.js \ SliderStyle.qml \ @@ -30,7 +29,6 @@ QML_FILES += \ Desktop/MenuStyle.qml \ Desktop/ProgressBarStyle.qml \ Desktop/RadioButtonStyle.qml \ - Desktop/ScrollAreaStyle.qml \ Desktop/ScrollBarStyle.qml \ Desktop/SliderStyle.qml \ Desktop/SpinBoxStyle.qml \ diff --git a/tests/auto/controls/controls.pro b/tests/auto/controls/controls.pro index 20ee603a..cbd7150f 100644 --- a/tests/auto/controls/controls.pro +++ b/tests/auto/controls/controls.pro @@ -18,7 +18,7 @@ OTHER_FILES += \ $$PWD/data/tst_spinbox.qml \ $$PWD/data/tst_tableview.qml \ $$PWD/data/tst_rangemodel.qml \ - $$PWD/data/tst_scrollarea.qml \ + $$PWD/data/tst_scrollview.qml \ $$PWD/data/tst_menu.qml \ $$PWD/data/tst_textfield.qml \ $$PWD/data/tst_textarea.qml \ diff --git a/tests/auto/controls/data/tst_scrollarea.qml b/tests/auto/controls/data/tst_scrollview.qml index 427f98ea..95c6cccf 100644 --- a/tests/auto/controls/data/tst_scrollarea.qml +++ b/tests/auto/controls/data/tst_scrollview.qml @@ -44,7 +44,7 @@ import QtQuick.Controls 1.0 TestCase { id: testCase - name: "Tests_ScrollArea" + name: "Tests_ScrollView" when:windowShown width:400 height:400 @@ -55,54 +55,54 @@ TestCase { Item { id: bigItem } Component { - id: scrollAreaComponent - ScrollArea { } + id: scrollViewComponent + ScrollView { } } function test_scroll() { - var component = scrollAreaComponent - var scrollArea = component.createObject(testCase); - verify(scrollArea !== null, "table created is null") + var component = scrollViewComponent + var scrollView = component.createObject(testCase); + verify(scrollView !== null, "table created is null") - scrollArea.contentItem = bigItem - scrollArea.visible = true - verify(scrollArea.flickableItem, "flickableItem should not be null") - verify(scrollArea.flickableItem !== scrollArea.contentItem) - verify(scrollArea.flickableItem.contentHeight === 0, "ContentHeight not set") + scrollView.contentItem = bigItem + scrollView.visible = true + verify(scrollView.flickableItem, "flickableItem should not be null") + verify(scrollView.flickableItem !== scrollView.contentItem) + verify(scrollView.flickableItem.contentHeight === 0, "ContentHeight not set") bigItem.height = 222 bigItem.width = 333 - verify(scrollArea.flickableItem.contentHeight === 222, "ContentHeight not set") - verify(scrollArea.flickableItem.contentWidth === 333, "ContentHeight not set") + verify(scrollView.flickableItem.contentHeight === 222, "ContentHeight not set") + verify(scrollView.flickableItem.contentWidth === 333, "ContentHeight not set") - scrollArea.flickableItem.contentY = 200 - verify(scrollArea.flickableItem.contentY === 200, "ContentY not set") + scrollView.flickableItem.contentY = 200 + verify(scrollView.flickableItem.contentY === 200, "ContentY not set") - scrollArea.flickableItem.contentX = 300 - verify(scrollArea.flickableItem.contentX === 300, "ContentX not set") + scrollView.flickableItem.contentX = 300 + verify(scrollView.flickableItem.contentX === 300, "ContentX not set") } function test_viewport() { - var component = scrollAreaComponent - var scrollArea = component.createObject(testCase); - verify(scrollArea !== null, "table created is null") - - scrollArea.forceActiveFocus(); - verify(scrollArea.viewport, "Viewport not defined") - verify(!scrollArea.contentItem, "contentItem should be null") - verify(!scrollArea.flickableItem, "flickableItem should be null") - verify(!scrollArea.frame, "Frame should be false") - - scrollArea.contentItem = textArea - verify(scrollArea.viewport, "Viewport should be defined") - verify(scrollArea.contentItem, "contentItem should not be null") - verify(scrollArea.flickableItem, "flickableItem should not be null") - verify(scrollArea.flickableItem.contentHeight === textArea.height, "Content height not set") - - var prevViewportWidth = scrollArea.viewport.width - scrollArea.frame = true - verify(scrollArea.frame, "Frame should be true") - verify(scrollArea.viewport.width < prevViewportWidth, "Viewport should be smaller with frame") + var component = scrollViewComponent + var scrollView = component.createObject(testCase); + verify(scrollView !== null, "table created is null") + + scrollView.forceActiveFocus(); + verify(scrollView.viewport, "Viewport not defined") + verify(!scrollView.contentItem, "contentItem should be null") + verify(!scrollView.flickableItem, "flickableItem should be null") + verify(!scrollView.frame, "Frame should be false") + + scrollView.contentItem = textArea + verify(scrollView.viewport, "Viewport should be defined") + verify(scrollView.contentItem, "contentItem should not be null") + verify(scrollView.flickableItem, "flickableItem should not be null") + verify(scrollView.flickableItem.contentHeight === textArea.height, "Content height not set") + + var prevViewportWidth = scrollView.viewport.width + scrollView.frame = true + verify(scrollView.frame, "Frame should be true") + verify(scrollView.viewport.width < prevViewportWidth, "Viewport should be smaller with frame") } } diff --git a/tests/manual/scrollbars.qml b/tests/manual/scrollbars.qml index 01609906..4ce169da 100644 --- a/tests/manual/scrollbars.qml +++ b/tests/manual/scrollbars.qml @@ -88,7 +88,7 @@ ApplicationWindow { frame: false Tab { title: "Rectangle" - ScrollArea { + ScrollView { anchors.fill: parent anchors.margins:4 frame: frameCheck.checked @@ -100,7 +100,7 @@ ApplicationWindow { } Tab { title: "Image" - ScrollArea { + ScrollView { anchors.fill: parent anchors.margins:4 frame: frameCheck.checked @@ -114,7 +114,7 @@ ApplicationWindow { } Tab { title: "Flickable" - ScrollArea{ + ScrollView{ anchors.fill: parent anchors.margins:4 frame: true @@ -142,7 +142,7 @@ ApplicationWindow { } Tab { title: "ListView" - ScrollArea{ + ScrollView{ anchors.fill: parent anchors.margins:4 frame: true diff --git a/tests/manual/testbench/content/Components.qml b/tests/manual/testbench/content/Components.qml index cb020596..06483882 100644 --- a/tests/manual/testbench/content/Components.qml +++ b/tests/manual/testbench/content/Components.qml @@ -54,7 +54,7 @@ Item { property Component toolbar: ToolBar { } property Component statusbar: StatusBar { } property Component tableview: TableView { model: testDataModel ; TableViewColumn {title: "Column 1"}} - property Component scrollarea: ScrollArea { + property Component scrollview: ScrollView { Rectangle { color: "#eee" width: 1000 @@ -111,7 +111,7 @@ Item { append({ name: "ToolBar", component: toolbar}); append({ name: "StatusBar", component: statusbar}); append({ name: "TableView", component: tableview}); - append({ name: "ScrollArea", component: scrollarea}); + append({ name: "ScrollView", component: scrollview}); } } } diff --git a/tests/manual/testbench/main.qml b/tests/manual/testbench/main.qml index c0f64b76..78248d7f 100644 --- a/tests/manual/testbench/main.qml +++ b/tests/manual/testbench/main.qml @@ -367,8 +367,8 @@ ApplicationWindow { id: sidebar color : syspal.window width: 300 - ScrollArea { - id: scrollArea + ScrollView { + id: scrollView anchors.fill: parent flickableItem.flickableDirection: Flickable.VerticalFlick Column { @@ -376,7 +376,7 @@ ApplicationWindow { anchors.left: parent ? parent.left : undefined anchors.top: parent ? parent.top : undefined anchors.margins: 10 - width: scrollArea.viewport.width - 20 + width: scrollView.viewport.width - 20 spacing: 8 Repeater { model: ["Boolean", "String","Int", "Real", "ReadOnly", "Enum"] |