| 1 |
import QtQuick 2.0 |
| 2 |
import QMLTermWidget 1.0 |
| 3 |
|
| 4 |
Item { |
| 5 |
property QMLTermWidget terminal |
| 6 |
|
| 7 |
property int value: terminal.scrollbarCurrentValue |
| 8 |
property int minimum: terminal.scrollbarMinimum |
| 9 |
property int maximum: terminal.scrollbarMaximum |
| 10 |
property int lines: terminal.lines |
| 11 |
property int totalLines: lines + maximum |
| 12 |
|
| 13 |
anchors.right: terminal.right |
| 14 |
|
| 15 |
opacity: 0.0 |
| 16 |
|
| 17 |
height: terminal.height * (lines / (totalLines - minimum)) |
| 18 |
y: (terminal.height / (totalLines)) * (value - minimum) |
| 19 |
|
| 20 |
Behavior on opacity { |
| 21 |
NumberAnimation { duration: 300; easing.type: Easing.OutCubic } |
| 22 |
} |
| 23 |
|
| 24 |
function showScrollbar() { |
| 25 |
opacity = 1.0; |
| 26 |
hideTimer.restart(); |
| 27 |
} |
| 28 |
|
| 29 |
Connections { |
| 30 |
target: terminal |
| 31 |
onScrollbarValueChanged: showScrollbar() |
| 32 |
} |
| 33 |
|
| 34 |
Timer { |
| 35 |
id: hideTimer |
| 36 |
onTriggered: parent.opacity = 0; |
| 37 |
} |
| 38 |
} |