move keyboard interaction in the delegate

This commit is contained in:
Marco Martin 2011-11-09 15:11:22 +01:00
parent cd710f2658
commit 526b19f6ec
2 changed files with 43 additions and 43 deletions

View File

@ -56,46 +56,6 @@ Item {
bottom: flickableItem.bottom
}
Keys.onUpPressed: {
if (!interactive || !enabled || !_isVertical)
return;
if (inverted)
internalLoader.incrementValue(stepSize);
else
internalLoader.incrementValue(-stepSize);
}
Keys.onDownPressed: {
if (!interactive || !enabled || !_isVertical)
return;
if (inverted)
internalLoader.incrementValue(-stepSize);
else
internalLoader.incrementValue(stepSize);
}
Keys.onLeftPressed: {
if (!interactive || !enabled || _isVertical)
return;
if (inverted)
internalLoader.incrementValue(stepSize);
else
internalLoader.incrementValue(-stepSize);
}
Keys.onRightPressed: {
if (!interactive || !enabled || _isVertical)
return;
if (inverted)
internalLoader.incrementValue(-stepSize);
else
internalLoader.incrementValue(stepSize);
}
Loader {
id: internalLoader
anchors.fill: parent

View File

@ -28,6 +28,46 @@ PlasmaCore.FrameSvgItem {
imagePath:"widgets/scrollbar"
prefix: _isVertical ? "background-vertical" : "background-horizontal"
Keys.onUpPressed: {
if (!enabled || !_isVertical)
return;
if (inverted)
internalLoader.incrementValue(stepSize);
else
internalLoader.incrementValue(-stepSize);
}
Keys.onDownPressed: {
if (!enabled || !_isVertical)
return;
if (inverted)
internalLoader.incrementValue(-stepSize);
else
internalLoader.incrementValue(stepSize);
}
Keys.onLeftPressed: {
if (!enabled || _isVertical)
return;
if (inverted)
internalLoader.incrementValue(stepSize);
else
internalLoader.incrementValue(-stepSize);
}
Keys.onRightPressed: {
if (!enabled || _isVertical)
return;
if (inverted)
internalLoader.incrementValue(-stepSize);
else
internalLoader.incrementValue(stepSize);
}
property Item handle: handle
property Item contents: contents
@ -104,7 +144,7 @@ PlasmaCore.FrameSvgItem {
running: parent.pressed
repeat: true
onTriggered: {
scrollbar.forceActiveFocus()
background.forceActiveFocus()
if (inverted) {
internalLoader.incrementValue(stepSize);
} else {
@ -151,7 +191,7 @@ PlasmaCore.FrameSvgItem {
running: parent.pressed;
repeat: true
onTriggered: {
scrollbar.forceActiveFocus();
background.forceActiveFocus();
if (inverted)
internalLoader.incrementValue(-stepSize);
else
@ -204,7 +244,7 @@ PlasmaCore.FrameSvgItem {
}
}
scrollbar.forceActiveFocus();
background.forceActiveFocus();
}
}
}