Commit 664ca7fa authored by Sergey Chupligin's avatar Sergey Chupligin

[ScrollDecorator] add ScrollDecorator

parent 8c5339a4
...@@ -228,6 +228,7 @@ ApplicationWindow { ...@@ -228,6 +228,7 @@ ApplicationWindow {
} }
ListView { ListView {
id: mainList
model: pageModel model: pageModel
anchors.fill: parent anchors.fill: parent
clip: true clip: true
...@@ -236,6 +237,10 @@ ApplicationWindow { ...@@ -236,6 +237,10 @@ ApplicationWindow {
label: title label: title
onClicked: pageItem.Stack.view.push(Qt.resolvedUrl(page)) onClicked: pageItem.Stack.view.push(Qt.resolvedUrl(page))
} }
ScrollDecorator{
flickable: mainList
}
} }
} }
} }
...@@ -25,6 +25,7 @@ QML_FILES += \ ...@@ -25,6 +25,7 @@ QML_FILES += \
qml/InverseMouseArea.qml \ qml/InverseMouseArea.qml \
qml/IconButton.qml \ qml/IconButton.qml \
qml/DatePicker.qml \ qml/DatePicker.qml \
qml/ScrollDecorator.qml \
qml/dialogs/QueryDialog.qml qml/dialogs/QueryDialog.qml
OTHER_FILES += qmldir \ OTHER_FILES += qmldir \
......
...@@ -8,10 +8,8 @@ ListView { ...@@ -8,10 +8,8 @@ ListView {
signal hideAllActions(int hideIndex) signal hideAllActions(int hideIndex)
property bool showDecorator: false
property color delegateColor: Theme.backgroundColor property color delegateColor: Theme.backgroundColor
property color bottomGradientColor: Theme.backgroundColor property color bottomGradientColor: Theme.backgroundColor
property color scrollerDecoratorColor: Theme.accentColor
section.criteria: ViewSection.FullString section.criteria: ViewSection.FullString
section.delegate: Component{ section.delegate: Component{
...@@ -67,20 +65,5 @@ ListView { ...@@ -67,20 +65,5 @@ ListView {
} }
} }
Rectangle{
id: scrollerDecorator
visible: (listView.showDecorator && listView.contentHeight > listView.height)
color: scrollerDecoratorColor
width: Theme.itemSpacingExtraSmall
height: listView.height*listView.height/listView.contentHeight
y: (listView.height)/listView.contentHeight*listView.contentY
anchors{
right: listView.right
rightMargin: Theme.itemSpacingExtraSmall / 2
}
}
} }
/****************************************************************************************
**
** Copyright (C) 2017 Chupligin Sergey <neochapay@gmail.com>
** All rights reserved.
**
** You may use this file under the terms of 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 the author 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 HOLDERS 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.
**
****************************************************************************************/
import QtQuick 2.6
import QtQuick.Controls 1.0 //needed for the Stack attached property
import QtQuick.Controls.Nemo 1.0
Rectangle{
id: scroolDecorator
property var flickable
visible: (flickable.contentHeight > flickable.height)
color: Theme.accentColor
width: Theme.itemSpacingExtraSmall
height: flickable.height*flickable.height/flickable.contentHeight
y: (flickable.height)/flickable.contentHeight*flickable.contentY
anchors{
right: flickable.right
rightMargin: Theme.itemSpacingExtraSmall / 2
}
}
...@@ -26,6 +26,7 @@ GlacierRollerItem 1.0 GlacierRollerItem.qml ...@@ -26,6 +26,7 @@ GlacierRollerItem 1.0 GlacierRollerItem.qml
InverseMouseArea 1.0 InverseMouseArea.qml InverseMouseArea 1.0 InverseMouseArea.qml
IconButton 1.0 IconButton.qml IconButton 1.0 IconButton.qml
DatePicker 1.0 DatePicker.qml DatePicker 1.0 DatePicker.qml
ScrollDecorator 1.0 ScrollDecorator.qml
# MIRRORED CONTROLS: # MIRRORED CONTROLS:
# These are the controls that we take directly from official QQC. # These are the controls that we take directly from official QQC.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment