Add keyboard events support in ScrollBar
Pressing up/down/left/right keys makes the ScrollBar move Signed-off-by: Daker Fernandes Pinheiro <dakerfp@gmail.com>
This commit is contained in:
parent
aada03fb18
commit
decf76214c
@ -48,6 +48,47 @@ Item {
|
||||
|
||||
visible: flickableItem && handle.width < contents.width
|
||||
|
||||
Keys.onUpPressed: {
|
||||
if (!_isVertical)
|
||||
return;
|
||||
|
||||
if (_inverted)
|
||||
range.value -= stepSize;
|
||||
else
|
||||
range.value += stepSize;
|
||||
}
|
||||
|
||||
Keys.onDownPressed: {
|
||||
if (!_isVertical)
|
||||
return;
|
||||
|
||||
if (_inverted)
|
||||
range.value += stepSize;
|
||||
else
|
||||
range.value -= stepSize;
|
||||
}
|
||||
|
||||
Keys.onLeftPressed: {
|
||||
if (_isVertical)
|
||||
return;
|
||||
|
||||
if (_inverted)
|
||||
range.value += stepSize;
|
||||
else
|
||||
range.value -= stepSize;
|
||||
}
|
||||
|
||||
Keys.onRightPressed: {
|
||||
if (_isVertical)
|
||||
return;
|
||||
|
||||
if (_inverted)
|
||||
range.value -= stepSize;
|
||||
else
|
||||
range.value += stepSize;
|
||||
}
|
||||
|
||||
|
||||
Item {
|
||||
|
||||
width: _isVertical ? scrollbar.height : scrollbar.width
|
||||
@ -90,6 +131,7 @@ Item {
|
||||
running: parent.pressed
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
scrollbar.forceActiveFocus();
|
||||
if (_inverted)
|
||||
_value += stepSize;
|
||||
else
|
||||
@ -129,6 +171,7 @@ Item {
|
||||
running: parent.pressed;
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
scrollbar.forceActiveFocus();
|
||||
if (_inverted)
|
||||
_value -= stepSize
|
||||
else
|
||||
|
@ -31,6 +31,7 @@ Rectangle {
|
||||
anchors.fill: parent
|
||||
contentWidth: 2200
|
||||
contentHeight: 600
|
||||
contentX: 500
|
||||
|
||||
Row {
|
||||
x: 30
|
||||
@ -168,6 +169,7 @@ Rectangle {
|
||||
PlasmaComponents.BusyIndicator {
|
||||
id: busy
|
||||
running: mouse.pressed
|
||||
smoothAnimation: true
|
||||
MouseArea {
|
||||
id: mouse
|
||||
anchors.fill: parent
|
||||
@ -318,6 +320,8 @@ Rectangle {
|
||||
PlasmaComponents.ScrollBar {
|
||||
id: verticalScrollBar
|
||||
|
||||
stepSize: 30
|
||||
|
||||
orientation: Qt.Vertical
|
||||
flickableItem: page
|
||||
animated: true
|
||||
|
Loading…
x
Reference in New Issue
Block a user