applets/activitybar: follow Plasma QML style

wilder-5.26
Fushan Wen 4 years ago
parent 3e769ff430
commit 0df153f30e
No known key found for this signature in database
GPG Key ID: 2E48D1487C91DCAA
  1. 15
      applets/activitybar/contents/ui/main.qml

@ -6,20 +6,24 @@
import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents // PC3 Tabbar only has top and bottom tab positions, not left and right
import org.kde.activities 0.1 as Activities
Item {
Layout.minimumWidth: tabBar.implicitWidth
Layout.minimumHeight: tabBar.implicitHeight
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
PlasmaComponents.TabBar {
id: tabBar
anchors.fill: parent
tabPosition: {
switch (Plasmoid.location) {
case PlasmaCore.Types.LeftEdge:
@ -40,9 +44,11 @@ Item {
}
delegate: PlasmaComponents.TabButton {
id: tab
checked: model.current
text: model.name
activeFocusOnTab: true
Keys.onPressed: {
switch (event.key) {
case Qt.Key_Space:
@ -57,15 +63,18 @@ Item {
Accessible.name: model.name
Accessible.description: i18n("Switch to activity %1", model.name)
Accessible.role: Accessible.Button
onClicked: {
activityModel.setCurrentActivity(model.id, function() {});
}
Component.onCompleted: {
onCheckedChanged: {
if(model.current) {
tabBar.currentTab = tab;
}
}
onCheckedChanged: {
Component.onCompleted: {
if(model.current) {
tabBar.currentTab = tab;
}

Loading…
Cancel
Save