44 import
"private/AppManager.js" as Utils
45 import org.kde.plasma.core 0.1 as PlasmaCore
63 property bool checked: (
internal.tabGroup == null) ? (
internal.tabBar.currentTab == root) : (
internal.tabGroup.currentTab == tab)
68 property
bool pressed: mouseArea.pressed ==
true && mouseArea.containsMouse
74 property alias text: label.text
82 property alias iconSource: imageLoader.source
89 implicitWidth: label.implicitWidth + (
internal.portrait ? 0 : (iconSource != null ? 16 : 0))
90 implicitHeight: label.implicitHeight + (
internal.portrait ? (iconSource != null ? 16 : 0) : 0)
92 opacity: enabled ? 1 : 0.6
98 internal.tabBar.currentTab = root
99 internal.tabBar.forceActiveFocus()
102 if (
internal.tabGroup) {
103 internal.tabGroup.currentTab = tab
106 internal.tabBar.currentTab = root
108 onVisibleChanged: root.parent.childrenChanged()
114 property Item tabBar: Utils.findParent(root,
"currentTab")
115 property Item tabGroup: Utils.findParent(tab,
"currentTab")
116 property bool portrait: root.height >= label.paintedHeight + 16
120 if (
internal.tabGroup) {
121 internal.tabGroup.currentTab = tab
125 Component.onCompleted: {
126 if (
internal.tabGroup &&
internal.tabGroup.currentTab == tab) {
127 internal.tabGroup.currentTab = tab
138 top:
internal.portrait && iconSource != null ? imageLoader.bottom : parent.top
139 left:
internal.portrait || iconSource == null ? parent.left : imageLoader.right
140 leftMargin: iconSource == null ? 0 : theme.defaultFont.mSize.width
142 bottom: parent.bottom
145 elide:
Text.ElideRight
146 horizontalAlignment: !
internal.portrait && iconSource != null ?
Text.AlignLeft :
Text.AlignHCenter
147 verticalAlignment:
Text.AlignVCenter
149 color: root.checked ? theme.buttonTextColor : theme.textColor
152 PlasmaCore.IconItem {
155 implicitWidth:
internal.portrait ? Math.max(theme.smallIconSize, root.height - (label.text ? label.height : 0)) : Math.max(theme.smallIconSize, root.height)
156 implicitHeight: implicitWidth
159 left:
internal.portrait ? undefined : parent.left
160 horizontalCenter:
internal.portrait ? parent.horizontalCenter : undefined
161 verticalCenter:
internal.portrait ? undefined : parent.verticalCenter
168 onClicked: root.clicked()
This is a label which uses the plasma theme.