1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** Copyright (C) 2012 Christophe CHAPUIS <chris.chapuis _at_ gmail _dot_ com>
9 ** This package is free software; you can redistribute it and/or modify
10 ** it under the terms of the GNU General Public License as published by
11 ** the Free Software Foundation; either version 2 of the License, or
12 ** (at your option) any later version.
14 ** This package is distributed in the hope that it will be useful,
15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ** GNU General Public License for more details.
19 ** You should have received a copy of the GNU General Public License
20 ** along with this package; if not, write to the Free Software
21 ** Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 ****************************************************************************/
30 property variant scrollArea
31 property variant orientation: Qt.Vertical
38 if (container.orientation == Qt.Vertical)
39 ny = scrollArea.visibleArea.yPosition * container.height;
41 ny = scrollArea.visibleArea.xPosition * container.width;
42 if (ny > 2) return ny; else return 2;
49 if (container.orientation == Qt.Vertical)
50 nh = scrollArea.visibleArea.heightRatio * container.height;
52 nh = scrollArea.visibleArea.widthRatio * container.width;
54 if (container.orientation == Qt.Vertical)
55 ny = scrollArea.visibleArea.yPosition * container.height;
57 ny = scrollArea.visibleArea.xPosition * container.width;
61 if (container.orientation == Qt.Vertical)
62 t = Math.ceil(container.height - 3 - ny);
64 t = Math.ceil(container.width - 3 - ny);
65 if (nh > t) return t; else return nh;
66 } else return nh + ny;
69 Rectangle { anchors.fill: parent; color: "Black"; opacity: 0.3 }
72 source: "../images/scrollbar.png"
73 border { left: 1; right: 1; top: 1; bottom: 1 }
74 x: container.orientation == Qt.Vertical ? 2 : position()
75 width: container.orientation == Qt.Vertical ? container.width - 4 : size()
76 y: container.orientation == Qt.Vertical ? position() : 2
77 height: container.orientation == Qt.Vertical ? size() : container.height - 4
82 when: container.orientation == Qt.Vertical ? scrollArea.movingVertically : scrollArea.movingHorizontally
83 PropertyChanges { target: container; opacity: 1.0 }
86 transitions: Transition {
87 from: "visible"; to: ""
88 NumberAnimation { properties: "opacity"; duration: 600 }