2021-11-25 20:27:58 +01:00
|
|
|
import QtQuick 2.8
|
2022-09-05 22:54:28 +02:00
|
|
|
import QtQuick.Templates 2.15 as T
|
2021-11-25 20:27:58 +01:00
|
|
|
import QtQuick.Layouts 1.1
|
|
|
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
|
|
|
import org.kde.plasma.components 3.0 as PlasmaComponents3
|
2022-09-05 22:54:28 +02:00
|
|
|
import org.kde.kirigami 2.5 as Kirigami
|
2021-11-25 20:27:58 +01:00
|
|
|
|
|
|
|
PlasmaComponents3.TabButton {
|
|
|
|
id: root
|
2021-12-01 18:53:23 +01:00
|
|
|
spacing: 0
|
2022-09-05 22:54:28 +02:00
|
|
|
|
|
|
|
property bool showTabText: plasmoid.nativeInterface.showTabTexts
|
|
|
|
property string tooltip: ""
|
|
|
|
|
|
|
|
PlasmaComponents3.ToolTip {
|
|
|
|
id: tooltip
|
|
|
|
text: root.tooltip !== "" ? root.tooltip : (root.showTabText ? "" : root.text)
|
|
|
|
visible: text !== "" && parent instanceof T.AbstractButton && (Kirigami.Settings.tabletMode ? parent.pressed : parent.hovered)
|
|
|
|
}
|
|
|
|
|
2021-11-25 20:27:58 +01:00
|
|
|
contentItem: RowLayout {
|
|
|
|
spacing: label.visible ? units.smallSpacing : 0
|
|
|
|
PlasmaCore.ColorScope.inherit: true
|
2021-12-01 18:53:23 +01:00
|
|
|
width: parent.width
|
|
|
|
Item {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
2021-11-25 20:27:58 +01:00
|
|
|
Image {
|
|
|
|
id: image
|
|
|
|
Layout.preferredHeight: height
|
|
|
|
source: root.icon.source
|
2022-02-05 21:31:53 +01:00
|
|
|
cache: false
|
2021-11-25 20:27:58 +01:00
|
|
|
height: units.iconSizes.small
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
}
|
|
|
|
PlasmaComponents3.Label {
|
|
|
|
id: label
|
|
|
|
visible: text.length > 0
|
2022-09-05 22:54:28 +02:00
|
|
|
text: root.showTabText ? root.text : ""
|
2021-11-25 20:27:58 +01:00
|
|
|
color: PlasmaCore.ColorScope.textColor
|
|
|
|
elide: Text.ElideRight
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
2021-12-01 18:53:23 +01:00
|
|
|
Item {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
2021-11-25 20:27:58 +01:00
|
|
|
}
|
|
|
|
}
|