diff --git a/declarativeimports/plasmacomponents/qml/Button.qml b/declarativeimports/plasmacomponents/qml/Button.qml index 1f75caa3a..c4c521b8d 100644 --- a/declarativeimports/plasmacomponents/qml/Button.qml +++ b/declarativeimports/plasmacomponents/qml/Button.qml @@ -201,5 +201,6 @@ Item { hoverEnabled: true onPressed: internal.pressButton() onReleased: internal.releaseButton() + onCanceled: internal.releaseButton() } } \ No newline at end of file diff --git a/declarativeimports/plasmacomponents/qml/TabBar.qml b/declarativeimports/plasmacomponents/qml/TabBar.qml index 1c17404b8..9a1acb381 100644 --- a/declarativeimports/plasmacomponents/qml/TabBar.qml +++ b/declarativeimports/plasmacomponents/qml/TabBar.qml @@ -49,7 +49,7 @@ Item { property alias layout: tabBarLayout //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 implicitHeight: tabBarLayout.implicitHeight + backgroundFrame.margins.top + backgroundFrame.margins.bottom + buttonFrame.margins.top + buttonFrame.margins.bottom @@ -65,10 +65,10 @@ Item { PlasmaCore.FrameSvgItem { id: buttonFrame - x: currentItem.x + backgroundFrame.margins.left + x: currentTab.x + backgroundFrame.margins.left y: backgroundFrame.margins.top - width: currentItem.width + buttonFrame.margins.left + buttonFrame.margins.right - height: currentItem.height + buttonFrame.margins.top + buttonFrame.margins.bottom + width: currentTab.width + buttonFrame.margins.left + buttonFrame.margins.right + height: currentTab.height + buttonFrame.margins.top + buttonFrame.margins.bottom imagePath: "widgets/button" prefix: "normal" Behavior on x { diff --git a/declarativeimports/plasmacomponents/qml/TabBarLayout.qml b/declarativeimports/plasmacomponents/qml/TabBarLayout.qml index 66b49db48..2602b1c1f 100644 --- a/declarativeimports/plasmacomponents/qml/TabBarLayout.qml +++ b/declarativeimports/plasmacomponents/qml/TabBarLayout.qml @@ -53,15 +53,18 @@ Item { Keys.onPressed: { if (event.key == Qt.Key_Right || event.key == Qt.Key_Left) { if (event.key == Qt.Key_Right || priv.mirrored) { - var oldIndex = priv.currentButtonIndex() + var oldIndex = priv.currentButtonIndex(); + if (oldIndex != root.children.length - 1) { priv.tabGroup.currentTab = root.children[oldIndex + 1].tab + root.parent.currentTab = root.children[oldIndex + 1] event.accepted = true } } else if (event.key == Qt.Key_Left || priv.mirrored) { var oldIndex = priv.currentButtonIndex() if (oldIndex != 0) { priv.tabGroup.currentTab = root.children[oldIndex - 1].tab + root.parent.currentTab = root.children[oldIndex - 1] event.accepted = true } } @@ -74,7 +77,7 @@ Item { id: priv property Item firstButton: root.children.length > 0 ? root.children[0] : 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 onMirroredChanged: layoutChildren() diff --git a/declarativeimports/plasmacomponents/qml/TabButton.qml b/declarativeimports/plasmacomponents/qml/TabButton.qml index 74f97fd99..00ef0db75 100644 --- a/declarativeimports/plasmacomponents/qml/TabButton.qml +++ b/declarativeimports/plasmacomponents/qml/TabButton.qml @@ -63,7 +63,7 @@ Item { target: root onPressedChanged: { //TabBar is the granparent - root.parent.parent.currentItem = root + root.parent.parent.currentTab = root } } @@ -82,7 +82,7 @@ Item { Component.onCompleted: { if (internal.tabGroup.currentTab == tab) { - parent.parent.currentItem = root + parent.parent.currentTab = root } } } @@ -126,7 +126,7 @@ Item { internal.tabGroup.currentTab = tab } //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