Fixed up keyboard switcher for smaller panels.

This commit is contained in:
wackyideas 2023-09-25 00:29:42 +02:00
parent 9db6a5fcc3
commit 8e2d11fbc7

View file

@ -23,10 +23,17 @@ Item {
function actionTriggered(selectedLayout) { function actionTriggered(selectedLayout) {
layoutSelected(selectedLayout) layoutSelected(selectedLayout)
} }
PlasmaCore.FrameSvgItem {
id: panelSvg
visible: false
imagePath: "widgets/panel-background"
}
Plasmoid.preferredRepresentation: Plasmoid.compactRepresentation Plasmoid.preferredRepresentation: Plasmoid.compactRepresentation
Plasmoid.compactRepresentation: KeyboardLayoutSwitcher { Plasmoid.compactRepresentation: KeyboardLayoutSwitcher {
id: keySwitcher
Plasmoid.toolTipSubText: layoutNames.longName Plasmoid.toolTipSubText: layoutNames.longName
Plasmoid.status: hasMultipleKeyboardLayouts ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.HiddenStatus Plasmoid.status: hasMultipleKeyboardLayouts ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.HiddenStatus
@ -72,22 +79,25 @@ Item {
} }
PlasmaComponents3.Label { PlasmaComponents3.Label {
id: keyLabel
text: layoutNames.displayName || layoutNames.shortName text: layoutNames.displayName || layoutNames.shortName
visible: !icon.visible visible: !icon.visible
anchors.fill: parent anchors.fill: parent
anchors.margins: PlasmaCore.Units.smallSpacing*2 anchors.margins: PlasmaCore.Units.smallSpacing*2
//anchors.bottomMargin: PlasmaCore.Units.smallSpacing
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
fontSizeMode: Text.Fit fontSizeMode: Text.Fit
minimumPointSize: 9; minimumPointSize: 8;
rightPadding: PlasmaCore.Units.smallSpacing rightPadding: PlasmaCore.Units.smallSpacing
leftPadding: PlasmaCore.Units.smallSpacing leftPadding: PlasmaCore.Units.smallSpacing
font.pointSize: height font.pointSize: height
font.capitalization: Font.AllUppercase font.capitalization: Font.AllUppercase
}
MouseArea { MouseArea {
id: ma id: ma
anchors.fill: parent anchors.fill: parent
anchors.margins: PlasmaCore.Units.smallSpacing+((0.3*keySwitcher.height) - 6.8)
hoverEnabled: true hoverEnabled: true
propagateComposedEvents: true propagateComposedEvents: true
onClicked: { onClicked: {
@ -98,6 +108,7 @@ Item {
id: decorationButton id: decorationButton
z: -1 z: -1
anchors.fill: parent anchors.fill: parent
anchors.margins: PlasmaCore.Units.smallSpacing+((0.3*keySwitcher.height) - 6.8)
imagePath: Qt.resolvedUrl("svgs/button.svg") imagePath: Qt.resolvedUrl("svgs/button.svg")
visible: ma.containsMouse visible: ma.containsMouse
prefix: { prefix: {
@ -108,6 +119,4 @@ Item {
} }
} }
} }
}
} }