ScrollDecorator is removed in favor of ScrollView. upstream/5.2.1 upstream/5.2.2
authorTomasz Olszak <olszak.tomasz@gmail.com>
Tue, 3 Dec 2013 21:04:52 +0000 (22:04 +0100)
committerTomasz Olszak <olszak.tomasz@gmail.com>
Tue, 3 Dec 2013 21:52:19 +0000 (22:52 +0100)
ScrollView can be used as decorator. ScrollViewStyle provided.

Change-Id: I6c4c8bc90e2ac95567a066d5f1d9235cce124a74
Reviewed-by: Jarosław Staniek <staniek@kde.org>
examples/touch/main.qml
src/controls/ScrollDecorator.qml [deleted file]
src/controls/controls.pro
src/controls/qmldir
src/styles/FocusFrameStyle.qml [new file with mode: 0644]
src/styles/ScrollDecoratorStyle.qml [deleted file]
src/styles/ScrollViewStyle.qml [new file with mode: 0644]
src/styles/qmldir
src/styles/styles.pro

index 8be4bea..95dd99b 100644 (file)
@@ -121,21 +121,20 @@ ApplicationWindow {
                     width: parent.width
                     height: parent.height
 
-
-                    ListView {
-                        id:listView
-                        model: pageModel
+                    ScrollView {
                         anchors.fill: parent
-                        clip:true
+                        ListView {
+                            id:listView
+                            model: pageModel
 
-                        delegate: AndroidDelegate {
-                            text: title
-                            onClicked: {
-                                content.titleBar.subText = Qt.binding(function() {return pageStack.depth > 1 ? title: "Main Page"})
-                                pageStack.push(Qt.resolvedUrl(page))
+                            delegate: AndroidDelegate {
+                                text: title
+                                onClicked: {
+                                    content.titleBar.subText = Qt.binding(function() {return pageStack.depth > 1 ? title: "Main Page"})
+                                    pageStack.push(Qt.resolvedUrl(page))
+                                }
                             }
                         }
-                        ScrollDecorator {flickableItem: listView}
                     }
                 }
             }
diff --git a/src/controls/ScrollDecorator.qml b/src/controls/ScrollDecorator.qml
deleted file mode 100644 (file)
index 89f34bb..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2013 Tomasz Olszak <olszak.tomasz@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-import QtQuick 2.1
-import QtQuick.Controls 1.0
-import QtQuick.Controls.Private 1.0
-
-Item {
-    id: root
-
-    anchors.fill: flickableItem
-
-    property Flickable flickableItem
-
-    property Component style: Qt.createComponent(Settings.style + "/ScrollDecoratorStyle.qml", root)
-
-    Loader {
-        id: styleLoader
-        property Item __control: root
-        sourceComponent: style
-    }
-
-    Loader {
-        id: decorationLoader
-        sourceComponent: parent.anchors.fill === flickableItem && styleLoader.item.decoration ? styleLoader.item.decoration: null
-    }
-}
index 4ba4a42..e52190b 100644 (file)
@@ -9,7 +9,6 @@ QML_FILES += \
     DetailButton.qml\
     ContextMenu.qml\
     SplitView.qml\
-    ScrollDecorator.qml\
     Popup.qml\
     DateEdit.qml\
     TimeEdit.qml \
index 81fb7f5..65b4a63 100644 (file)
@@ -5,7 +5,6 @@ plugin tizencontrolsplugin
 DetailButton 1.0 DetailButton.qml
 ContextMenu 1.0 ContextMenu.qml
 SplitView 1.0 SplitView.qml
-ScrollDecorator 1.0 ScrollDecorator.qml
 Popup 1.0 Popup.qml
 DateEdit 1.0 DateEdit.qml
 TitleBar 1.0 TitleBar.qml
diff --git a/src/styles/FocusFrameStyle.qml b/src/styles/FocusFrameStyle.qml
new file mode 100644 (file)
index 0000000..763dd7f
--- /dev/null
@@ -0,0 +1,5 @@
+import QtQuick 2.2
+
+Item {
+    property int margin: -3
+}
diff --git a/src/styles/ScrollDecoratorStyle.qml b/src/styles/ScrollDecoratorStyle.qml
deleted file mode 100644 (file)
index 9c41020..0000000
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Copyright (C) 2013 Tomasz Olszak <olszak.tomasz@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-import QtQuick 2.1
-import QtQuick.Controls 1.0
-import QtQuick.Controls.Private 1.0
-import QtQuick.Controls.Tizen 1.0
-import QtQuick.Controls.Styles.Tizen 1.0
-
-Style {
-    id: style
-
-    property ScrollDecorator control: __control
-
-    property Component decoration: Item {
-        width: control.width
-        height: control.height
-
-        property Flickable flickableItem: control.flickableItem
-
-        QtObject {
-            id: horizontalHelper
-            property real positionRatio: flickableItem ? flickableItem.visibleArea.xPosition : 0
-            property real sizeRatio: flickableItem ? flickableItem.visibleArea.widthRatio : 0
-            property real maxPosition: flickableItem ? flickableItem.width : 0
-            property real minSize: TizenConfig.scroll.handler.horizontal.minimumWidth
-
-            property real sizeUnderflow: (sizeRatio * maxPosition) < minSize ? minSize - (sizeRatio * maxPosition) : 0
-
-            // raw start and end position considering minimum size
-            property real rawStartPos: positionRatio * (maxPosition - sizeUnderflow)
-            property real rawEndPos: (positionRatio + sizeRatio) * (maxPosition - sizeUnderflow) + sizeUnderflow
-
-            // overshoot amount at start and end
-            property real overshootStart: rawStartPos < 0 ? -rawStartPos : 0
-            property real overshootEnd: rawEndPos > maxPosition ? rawEndPos - maxPosition : 0
-
-            // overshoot adjusted start and end
-            property real adjStartPos: rawStartPos + overshootStart
-            property real adjEndPos: rawEndPos - overshootStart - overshootEnd
-
-            // final position and size of thumb
-            property int position: 0.5 + (adjStartPos + minSize > maxPosition ? maxPosition - minSize : adjStartPos)
-            property int size: 0.5 + ((adjEndPos - position) < minSize ? minSize : (adjEndPos - position))
-        }
-
-        QtObject {
-            id: verticalHelper
-            property real positionRatio: flickableItem ? flickableItem.visibleArea.yPosition : 0
-            property real sizeRatio: flickableItem ? flickableItem.visibleArea.heightRatio : 0
-            property real maxPosition: flickableItem ? flickableItem.height : 0
-            property real minSize: TizenConfig.scroll.handler.vertical.minimumHeight
-
-            property real sizeUnderflow: (sizeRatio * maxPosition) < minSize ? minSize - (sizeRatio * maxPosition) : 0
-
-            // raw start and end position considering minimum size
-            property real rawStartPos: positionRatio * (maxPosition - sizeUnderflow)
-            property real rawEndPos: (positionRatio + sizeRatio) * (maxPosition - sizeUnderflow) + sizeUnderflow
-
-            // overshoot amount at start and end
-            property real overshootStart: rawStartPos < 0 ? -rawStartPos : 0
-            property real overshootEnd: rawEndPos > maxPosition ? rawEndPos - maxPosition : 0
-
-            // overshoot adjusted start and end
-            property real adjStartPos: rawStartPos + overshootStart
-            property real adjEndPos: rawEndPos - overshootStart - overshootEnd
-
-            // final position and size of thumb
-            property int position: 0.5 + (adjStartPos + minSize > maxPosition ? maxPosition - minSize : adjStartPos)
-            property int size: 0.5 + ((adjEndPos - position) < minSize ? minSize : (adjEndPos - position))
-        }
-
-        BorderImage {
-            id: overscrollingTop
-            anchors.left: parent.left
-            anchors.top: parent.top
-            anchors.right: parent.right
-            height: TizenConfig.scroll.overscrolling.top.height
-            source: TizenConfig.scroll.overscrolling.top.source
-            opacity:0
-            states: State {
-                name:"visible"
-                when: flickableItem.atYBeginning && flickableItem.movingVertically
-                PropertyChanges {
-                    target:overscrollingTop
-                    opacity: 1
-                }
-            }
-            transitions: [
-                Transition {
-                    to: "visible"
-                    NumberAnimation {
-                        property: "opacity"
-                        duration: 150
-                    }
-                },
-                Transition {
-                    from: "visible"
-                    NumberAnimation {
-                        property: "opacity"
-                        duration: 500
-                    }
-                }
-            ]
-        }
-        BorderImage {
-            id: overscrollingBottom
-            anchors.left: parent.left
-            anchors.bottom: parent.bottom
-            anchors.right: parent.right
-            height: TizenConfig.scroll.overscrolling.bottom.height
-            source: TizenConfig.scroll.overscrolling.bottom.source
-            opacity:0
-            states: State {
-                name:"visible"
-                when: flickableItem.atYEnd && flickableItem.movingVertically
-                PropertyChanges {
-                    target:overscrollingBottom
-                    opacity: 1
-                }
-            }
-            transitions: [
-                Transition {
-                    to: "visible"
-                    NumberAnimation {
-                        property: "opacity"
-                        duration: 150
-                    }
-                },
-                Transition {
-                    from: "visible"
-                    NumberAnimation {
-                        property: "opacity"
-                        duration: 500
-                    }
-                }
-            ]
-        }
-        BorderImage {
-            id: overscrollingRight
-            anchors.top: parent.top
-            anchors.bottom: parent.bottom
-            anchors.right: parent.right
-            width: TizenConfig.scroll.overscrolling.left.right
-            source: TizenConfig.scroll.overscrolling.right.source
-            opacity:0
-            states: State {
-                name:"visible"
-                when: flickableItem.atXEnd && flickableItem.movingHorizontally
-                PropertyChanges {
-                    target:overscrollingRight
-                    opacity: 1
-                }
-            }
-            transitions: [
-                Transition {
-                    to: "visible"
-                    NumberAnimation {
-                        property: "opacity"
-                        duration: 150
-                    }
-                },
-                Transition {
-                    from: "visible"
-                    NumberAnimation {
-                        property: "opacity"
-                        duration: 500
-                    }
-                }
-            ]
-        }
-        TizenBorderImage {
-            id: overscrollingLeft
-            anchors.top: parent.top
-            anchors.bottom: parent.bottom
-            anchors.left: parent.left
-            width: TizenConfig.scroll.overscrolling.left.width
-            source: TizenConfig.scroll.overscrolling.left.source
-            opacity:0
-            states: State {
-                name:"visible"
-                when: flickableItem.atXBeginning && flickableItem.movingHorizontally
-                PropertyChanges {
-                    target:overscrollingLeft
-                    opacity: 1
-                }
-            }
-            transitions: [
-                Transition {
-                    to: "visible"
-                    NumberAnimation {
-                        property: "opacity"
-                        duration: 150
-                    }
-                },
-                Transition {
-                    from: "visible"
-                    NumberAnimation {
-                        property: "opacity"
-                        duration: 500
-                    }
-                }
-            ]
-        }
-
-        TizenBorderImage {
-            id: horizontalIndicator
-            x: horizontalHelper.position
-            opacity: 0
-            width: horizontalHelper.size
-            anchors.bottom: parent.bottom
-            height: TizenConfig.scroll.handler.horizontal.minimumHeight
-            source: TizenConfig.scroll.handler.horizontal.source
-            backgroundColor: TizenConfig.scroll.handler.color
-            effectSource: TizenConfig.scroll.handler.horizontal.effectSource
-            states: State {
-                name: "visible"
-                when: flickableItem.movingHorizontally
-                PropertyChanges {
-                    target: horizontalIndicator
-                    opacity: 1
-                }
-            }
-            transitions: [
-                Transition {
-                    to: "visible"
-                    NumberAnimation {
-                        property: "opacity"
-                        duration: 150
-                    }
-                },
-                Transition {
-                    from: "visible"
-                    NumberAnimation {
-                        property: "opacity"
-                        duration: 500
-                    }
-                }
-            ]
-        }
-        TizenBorderImage {
-            id: verticalIndicator
-            y: verticalHelper.position
-            anchors.right: parent.right
-            opacity: 0
-            anchors.margins: TizenConfig.scroll.handler.vertical.margin
-            width: TizenConfig.scroll.handler.vertical.minimumWidth
-            height: verticalHelper.size
-            source: TizenConfig.scroll.handler.vertical.source
-            backgroundColor: TizenConfig.scroll.handler.color
-            effectSource: TizenConfig.scroll.handler.vertical.effectSource
-            states: State {
-                name: "visible"
-                when: flickableItem.movingVertically
-                PropertyChanges {
-                    target: verticalIndicator
-                    opacity: 1
-                }
-            }
-            transitions: [
-                Transition {
-                    to: "visible"
-                    NumberAnimation {
-                        property: "opacity"
-                        duration: 150
-                    }
-                },
-                Transition {
-                    from: "visible"
-                    NumberAnimation {
-                        property: "opacity"
-                        duration: 500
-                    }
-                }
-            ]
-        }
-    }
-}
diff --git a/src/styles/ScrollViewStyle.qml b/src/styles/ScrollViewStyle.qml
new file mode 100644 (file)
index 0000000..0738e1c
--- /dev/null
@@ -0,0 +1,203 @@
+/*
+ * Copyright (C) 2013 Tomasz Olszak <olszak.tomasz@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+import QtQuick 2.2
+import QtQuick.Controls.Styles 1.1
+import QtQuick.Controls.Styles.Tizen 1.0
+
+ScrollViewStyle {
+    transientScrollBars: true
+    Binding {
+        target: control.flickableItem
+        property: "interactive"
+        value: true
+    }
+    handle: TizenBorderImage {
+        id: verticalIndicator
+        anchors.margins: TizenConfig.scroll.handler.vertical.margin
+        source: TizenConfig.scroll.handler.vertical.source
+        backgroundColor: TizenConfig.scroll.handler.color
+        effectSource: TizenConfig.scroll.handler.vertical.effectSource
+        states: State {
+            name: "visible"
+            when: control.flickableItem.movingVertically
+            PropertyChanges {
+                target: verticalIndicator
+                opacity: 1
+            }
+        }
+        transitions: [
+            Transition {
+                to: "visible"
+                NumberAnimation {
+                    property: "opacity"
+                    duration: 150
+                }
+            },
+            Transition {
+                from: "visible"
+                NumberAnimation {
+                    property: "opacity"
+                    duration: 500
+                }
+            }
+        ]
+    }
+    corner: null
+    decrementControl: null
+    frame: Item {
+        width: control.width
+        height: control.height
+
+        BorderImage {
+            id: overscrollingTop
+            anchors.left: parent.left
+            anchors.top: parent.top
+            anchors.right: parent.right
+            height: TizenConfig.scroll.overscrolling.top.height
+            source: TizenConfig.scroll.overscrolling.top.source
+            opacity:0
+            states: State {
+                name:"visible"
+                when: control.flickableItem.atYBeginning && control.flickableItem.movingVertically
+                PropertyChanges {
+                    target:overscrollingTop
+                    opacity: 1
+                }
+            }
+            transitions: [
+                Transition {
+                    to: "visible"
+                    NumberAnimation {
+                        property: "opacity"
+                        duration: 150
+                    }
+                },
+                Transition {
+                    from: "visible"
+                    NumberAnimation {
+                        property: "opacity"
+                        duration: 500
+                    }
+                }
+            ]
+        }
+
+        BorderImage {
+            id: overscrollingBottom
+            anchors.left: parent.left
+            anchors.bottom: parent.bottom
+            anchors.right: parent.right
+            height: TizenConfig.scroll.overscrolling.bottom.height
+            source: TizenConfig.scroll.overscrolling.bottom.source
+            opacity:0
+            states: State {
+                name:"visible"
+                when: control.flickableItem.atYEnd && control.flickableItem.movingVertically
+                PropertyChanges {
+                    target:overscrollingBottom
+                    opacity: 1
+                }
+            }
+            transitions: [
+                Transition {
+                    to: "visible"
+                    NumberAnimation {
+                        property: "opacity"
+                        duration: 150
+                    }
+                },
+                Transition {
+                    from: "visible"
+                    NumberAnimation {
+                        property: "opacity"
+                        duration: 500
+                    }
+                }
+            ]
+        }
+        BorderImage {
+            id: overscrollingRight
+            anchors.top: parent.top
+            anchors.bottom: parent.bottom
+            anchors.right: parent.right
+            width: TizenConfig.scroll.overscrolling.left.right
+            source: TizenConfig.scroll.overscrolling.right.source
+            opacity:0
+            states: State {
+                name:"visible"
+                when: control.flickableItem.atXEnd && control.flickableItem.movingHorizontally
+                PropertyChanges {
+                    target:overscrollingRight
+                    opacity: 1
+                }
+            }
+            transitions: [
+                Transition {
+                    to: "visible"
+                    NumberAnimation {
+                        property: "opacity"
+                        duration: 150
+                    }
+                },
+                Transition {
+                    from: "visible"
+                    NumberAnimation {
+                        property: "opacity"
+                        duration: 500
+                    }
+                }
+            ]
+        }
+        TizenBorderImage {
+            id: overscrollingLeft
+            anchors.top: parent.top
+            anchors.bottom: parent.bottom
+            anchors.left: parent.left
+            width: TizenConfig.scroll.overscrolling.left.width
+            source: TizenConfig.scroll.overscrolling.left.source
+            opacity:0
+            states: State {
+                name:"visible"
+                when: control.flickableItem.atXBeginning && control.flickableItem.movingHorizontally
+                PropertyChanges {
+                    target:overscrollingLeft
+                    opacity: 1
+                }
+            }
+            transitions: [
+                Transition {
+                    to: "visible"
+                    NumberAnimation {
+                        property: "opacity"
+                        duration: 150
+                    }
+                },
+                Transition {
+                    from: "visible"
+                    NumberAnimation {
+                        property: "opacity"
+                        duration: 500
+                    }
+                }
+            ]
+        }
+    }
+    incrementControl: null
+}
index 4c6aace..be4cd25 100644 (file)
@@ -11,7 +11,6 @@ PanelStyle 1.0 PanelStyle.qml
 Floater 1.0 Floater.qml
 SwitchStyle 1.0 SwitchStyle.qml
 DetailButtonStyle 1.0 DetailButtonStyle.qml
-ScrollDecoratorStyle 1.0 ScrollDecoratorStyle.qml
 ContextMenuStyle 1.0 ContextMenuStyle.qml
 PopupStyle 1.0 PopupStyle.qml
 BusyIndicatorStyle 1.0 BusyIndicatorStyle.qml
@@ -22,3 +21,5 @@ ToolBarStyle 1.0 ToolBarStyle.qml
 ToolBarButton 1.0 ToolBarButton.qml
 ViewStyle 1.0 ViewStyle.qml
 RadioButtonStyle 1.0 RadioButtonStyle.qml
+ScrollViewStyle 1.0 ScrollViewStyle.qml
+
index ed66891..90ef5d7 100644 (file)
@@ -17,7 +17,6 @@ QML_FILES = \
     Floater.qml \
     SwitchStyle.qml\
     DetailButtonStyle.qml\
-    ScrollDecoratorStyle.qml\
     ContextMenuStyle.qml\
     PopupStyle.qml\
     BusyIndicatorStyle.qml \
@@ -28,7 +27,9 @@ QML_FILES = \
     ToolBarStyle.qml \
     ToolBarButton.qml \
     PanelStyle.qml \
-    RadioButtonStyle.qml
+    RadioButtonStyle.qml \
+    FocusFrameStyle.qml \
+    ScrollViewStyle.qml
 
 QML_FILES += \
     private/DateEditField.qml\