diff --git a/examples/gallery/content/Panel.qml b/examples/gallery/content/Panel.qml index 6ea8e5562756213eac097e361dadac78a3485c56..f6081d0bdef941de86ed2623888da3af641f726c 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 similarity index 92% rename from src/controls/ScrollArea.qml rename to src/controls/ScrollView.qml index 5bdba3b5ccd6ebf80b888b54cd9ca4a4897fc119..21812b5a8e2afa4bcb20e46f8c6ea2dbc50cac5e 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 2f200c3ab21aecfeabc30e5b62ed8616be18d4b2..d61c9945b1bfbac255bc7d6d231181aa4ec140a2 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 6a39c73ca816435e9720726287dd598d5cd95f9d..f697581f8f19455467ac4e33f408fcf900657728 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 7af5a965f195d33a6af2ad7565394496935ac78b..1324aa51dfcc8df624feea76c925d79efdea8234 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 b3de1110b71dcc24d3d18ca3a27357251b2cdd2d..6543c8ae933bf95f3449a08e3e491d3adebdd8a4 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 similarity index 99% rename from src/private/ScrollAreaHelper.qml rename to src/private/ScrollViewHelper.qml index 40187b982d9f2859f2a2cb47b9ed1d5494a0f4fe..0386213a791a9eed01faf5c1ac572cf6cb692e38 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 23381d0e8f012e5208fdeea653bf7d96f4a9f865..6f4caaaf90d48a897eb4099135ca5142d9bc7526 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 d4589068df1e133724f26308a917ffe16c3ded5b..788e341e2ff518c56a32a35dede8ff7291567b6e 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 a86e9ecb20a9450ba7103b95aa7b23a24b069805..0000000000000000000000000000000000000000 --- 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 46e9a480a24b4cdac6c4d3cf6672317e9f0d5ab8..0000000000000000000000000000000000000000 --- 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 a7a7279383ed9c9deb1e0a06eab2e1e48ef15bfe..70c6ba1eb2fff45d9625a0f219dcb6c38eedf743 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 20ee603a6d80af79921f36a9f76cef295bfe9f24..cbd7150f23e4e2fb70b22e9d565e3a831c2a2195 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 similarity index 58% rename from tests/auto/controls/data/tst_scrollarea.qml rename to tests/auto/controls/data/tst_scrollview.qml index 427f98ea5e74166d2ce83393c2e91d30e59e8d8d..95c6cccfe0dc0b7c7575a8065b806452480227e2 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 0160990672eb0417bab409a274497e5563573bdc..4ce169da0e8b12ba55e6e77d5238b6e02ec01e2b 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 cb020596602746168682d3803a2fd880b5ed4e33..06483882dc414f8dc4ba9be218a15f3fbc5457c5 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 c0f64b76eca56ae8b32af9479af5f27a80ae0125..78248d7fa7e2e43792058d3caf4496b49a467080 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"]