fix keyboard navigation
This commit is contained in:
parent
5880e5315c
commit
60db3ff72d
@ -201,5 +201,6 @@ Item {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onPressed: internal.pressButton()
|
onPressed: internal.pressButton()
|
||||||
onReleased: internal.releaseButton()
|
onReleased: internal.releaseButton()
|
||||||
|
onCanceled: internal.releaseButton()
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -49,7 +49,7 @@ Item {
|
|||||||
property alias layout: tabBarLayout
|
property alias layout: tabBarLayout
|
||||||
|
|
||||||
//Plasma extension
|
//Plasma extension
|
||||||
property Item currentItem
|
property Item currentTab
|
||||||
|
|
||||||
implicitWidth: tabBarLayout.implicitWidth + backgroundFrame.margins.left + backgroundFrame.margins.right + (buttonFrame.margins.left + buttonFrame.margins.right)*tabBarLayout.children.length
|
implicitWidth: tabBarLayout.implicitWidth + backgroundFrame.margins.left + backgroundFrame.margins.right + (buttonFrame.margins.left + buttonFrame.margins.right)*tabBarLayout.children.length
|
||||||
implicitHeight: tabBarLayout.implicitHeight + backgroundFrame.margins.top + backgroundFrame.margins.bottom + buttonFrame.margins.top + buttonFrame.margins.bottom
|
implicitHeight: tabBarLayout.implicitHeight + backgroundFrame.margins.top + backgroundFrame.margins.bottom + buttonFrame.margins.top + buttonFrame.margins.bottom
|
||||||
@ -65,10 +65,10 @@ Item {
|
|||||||
PlasmaCore.FrameSvgItem {
|
PlasmaCore.FrameSvgItem {
|
||||||
id: buttonFrame
|
id: buttonFrame
|
||||||
|
|
||||||
x: currentItem.x + backgroundFrame.margins.left
|
x: currentTab.x + backgroundFrame.margins.left
|
||||||
y: backgroundFrame.margins.top
|
y: backgroundFrame.margins.top
|
||||||
width: currentItem.width + buttonFrame.margins.left + buttonFrame.margins.right
|
width: currentTab.width + buttonFrame.margins.left + buttonFrame.margins.right
|
||||||
height: currentItem.height + buttonFrame.margins.top + buttonFrame.margins.bottom
|
height: currentTab.height + buttonFrame.margins.top + buttonFrame.margins.bottom
|
||||||
imagePath: "widgets/button"
|
imagePath: "widgets/button"
|
||||||
prefix: "normal"
|
prefix: "normal"
|
||||||
Behavior on x {
|
Behavior on x {
|
||||||
|
@ -53,15 +53,18 @@ Item {
|
|||||||
Keys.onPressed: {
|
Keys.onPressed: {
|
||||||
if (event.key == Qt.Key_Right || event.key == Qt.Key_Left) {
|
if (event.key == Qt.Key_Right || event.key == Qt.Key_Left) {
|
||||||
if (event.key == Qt.Key_Right || priv.mirrored) {
|
if (event.key == Qt.Key_Right || priv.mirrored) {
|
||||||
var oldIndex = priv.currentButtonIndex()
|
var oldIndex = priv.currentButtonIndex();
|
||||||
|
|
||||||
if (oldIndex != root.children.length - 1) {
|
if (oldIndex != root.children.length - 1) {
|
||||||
priv.tabGroup.currentTab = root.children[oldIndex + 1].tab
|
priv.tabGroup.currentTab = root.children[oldIndex + 1].tab
|
||||||
|
root.parent.currentTab = root.children[oldIndex + 1]
|
||||||
event.accepted = true
|
event.accepted = true
|
||||||
}
|
}
|
||||||
} else if (event.key == Qt.Key_Left || priv.mirrored) {
|
} else if (event.key == Qt.Key_Left || priv.mirrored) {
|
||||||
var oldIndex = priv.currentButtonIndex()
|
var oldIndex = priv.currentButtonIndex()
|
||||||
if (oldIndex != 0) {
|
if (oldIndex != 0) {
|
||||||
priv.tabGroup.currentTab = root.children[oldIndex - 1].tab
|
priv.tabGroup.currentTab = root.children[oldIndex - 1].tab
|
||||||
|
root.parent.currentTab = root.children[oldIndex - 1]
|
||||||
event.accepted = true
|
event.accepted = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,7 +77,7 @@ Item {
|
|||||||
id: priv
|
id: priv
|
||||||
property Item firstButton: root.children.length > 0 ? root.children[0] : null
|
property Item firstButton: root.children.length > 0 ? root.children[0] : null
|
||||||
property Item firstTab: firstButton ? (firstButton.tab != null ? firstButton.tab : null) : null
|
property Item firstTab: firstButton ? (firstButton.tab != null ? firstButton.tab : null) : null
|
||||||
property Item tabGroup: firstTab ? (firstTab.parent ? firstTab.parent.parent : null) : null
|
property Item tabGroup: firstTab ? (firstTab.parent ? firstTab.parent.parent.parent : null) : null
|
||||||
property bool mirrored: root.LayoutMirroring.enabled
|
property bool mirrored: root.LayoutMirroring.enabled
|
||||||
|
|
||||||
onMirroredChanged: layoutChildren()
|
onMirroredChanged: layoutChildren()
|
||||||
|
@ -63,7 +63,7 @@ Item {
|
|||||||
target: root
|
target: root
|
||||||
onPressedChanged: {
|
onPressedChanged: {
|
||||||
//TabBar is the granparent
|
//TabBar is the granparent
|
||||||
root.parent.parent.currentItem = root
|
root.parent.parent.currentTab = root
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ Item {
|
|||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (internal.tabGroup.currentTab == tab) {
|
if (internal.tabGroup.currentTab == tab) {
|
||||||
parent.parent.currentItem = root
|
parent.parent.currentTab = root
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ Item {
|
|||||||
internal.tabGroup.currentTab = tab
|
internal.tabGroup.currentTab = tab
|
||||||
}
|
}
|
||||||
//TabBar is the granparent, done here too in case of no tabgroup
|
//TabBar is the granparent, done here too in case of no tabgroup
|
||||||
root.parent.parent.currentItem = root
|
root.parent.parent.currentTab = root
|
||||||
}
|
}
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user