• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kde-runtime API Reference
  • KDE Home
  • Contact Us
 

PlasmaComponents

  • sources
  • kde-4.12
  • kde-runtime
  • plasma
  • declarativeimports
  • plasmacomponents
  • qml
  • private
ScrollDecoratorDelegate.qml
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@gmail.com>
3 * Copyright (C) 2011 Marco Martin <mart@kde.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Library General Public License as
7 * published by the Free Software Foundation; either version 2, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20 
21 import QtQuick 1.1
22 import org.kde.plasma.core 0.1 as PlasmaCore
23 
24 
25 PlasmaCore.FrameSvgItem {
26  id: background
27  anchors.fill: parent
28  imagePath:"widgets/scrollbar"
29  prefix: internalLoader.isVertical ? "background-vertical" : "background-horizontal"
30 
31  property int implicitWidth: scrollbarSvg.hasElement("hint-scrollbar-size") ? scrollbarSvg.elementSize("hint-scrollbar-size").width : 12
32  property int implicitHeight: scrollbarSvg.hasElement("hint-scrollbar-size") ? scrollbarSvg.elementSize("hint-scrollbar-size").height : 12
33 
34  opacity: 0
35  Behavior on opacity {
36  NumberAnimation {
37  duration: 250
38  easing.type: Easing.OutQuad
39  }
40  }
41 
42  PlasmaCore.Svg {
43  id: scrollbarSvg
44  imagePath: "widgets/scrollbar"
45  }
46 
47  property Item handle: handle
48 
49  property Item contents: contents
50  Item {
51  id: contents
52  anchors.fill: parent
53 
54  PlasmaCore.FrameSvgItem {
55  id: handle
56  imagePath:"widgets/scrollbar"
57  prefix: "slider"
58 
59  function length()
60  {
61  var nh, ny;
62 
63  if (internalLoader.isVertical) {
64  nh = flickableItem.visibleArea.heightRatio * internalLoader.height
65  } else {
66  nh = flickableItem.visibleArea.widthRatio * internalLoader.width
67  }
68 
69  if (internalLoader.isVertical) {
70  ny = flickableItem.visibleArea.yPosition * internalLoader.height
71  } else {
72  ny = flickableItem.visibleArea.xPosition * internalLoader.width
73  }
74 
75  if (ny > 3) {
76  var t
77 
78  if (internalLoader.isVertical) {
79  t = Math.ceil(internalLoader.height - 3 - ny)
80  } else {
81  t = Math.ceil(internalLoader.width - 3 - ny)
82  }
83 
84  if (nh > t) {
85  return t
86  } else {
87  return nh
88  }
89  } else {
90  return nh + ny
91  }
92  }
93 
94  width: internalLoader.isVertical ? parent.width : length()
95  height: internalLoader.isVertical ? length() : parent.height
96  }
97  }
98 
99  property MouseArea mouseArea: null
100 
101  Connections {
102  target: flickableItem
103  onMovingChanged: {
104  if (flickableItem.moving) {
105  opacityTimer.running = false
106  background.opacity = 1
107  } else {
108  opacityTimer.restart()
109  }
110  }
111  }
112  Timer {
113  id: opacityTimer
114  interval: 500
115  repeat: false
116  running: false
117  onTriggered: {
118  background.opacity = 0
119  }
120  }
121 }
122 
Item
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:02:47 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

PlasmaComponents

Skip menu "PlasmaComponents"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List

kde-runtime API Reference

Skip menu "kde-runtime API Reference"
  • KCMShell
  • KNotify
  • Plasma Runtime
  •     PlasmaCore
  •     DragAndDrop
  •     PlasmaComponents
  •     PlasmaExtraComponents
  •     QtExtraComponents

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal