ukui-menu/qml/AppControls2/LabelItem.qml

51 lines
1.4 KiB
QML
Raw Normal View History

2023-02-14 09:34:15 +08:00
import QtQuick 2.0
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.5
import org.ukui.menu.core 1.0
import org.ukui.quick.platform 1.0 as Platform
import org.ukui.quick.items 1.0 as UkuiItems
2024-01-09 10:08:53 +08:00
MouseArea {
id: control
hoverEnabled: true
2024-01-09 10:08:53 +08:00
property alias displayName: labelText.text
2024-01-09 10:08:53 +08:00
// ToolTip.text: comment
// ToolTip.visible: control.containsMouse
// ToolTip.delay: 500
UkuiItems.StyleBackground {
2023-02-14 09:34:15 +08:00
anchors.fill: parent
radius: Platform.Theme.minRadius
useStyleTransparency: false
2024-01-09 10:08:53 +08:00
paletteRole: Platform.Theme.Text
alpha: control.containsPress ? 0.15 : control.containsMouse ? 0.08 : 0.00
2023-02-14 09:34:15 +08:00
RowLayout {
anchors.fill: parent
UkuiItems.StyleText {
id: labelText
2024-01-09 07:31:27 +08:00
Layout.fillWidth: true
Layout.fillHeight: true
Layout.leftMargin: 12
2023-02-14 09:34:15 +08:00
horizontalAlignment: Qt.AlignLeft
verticalAlignment: Qt.AlignVCenter
font.bold: true
2024-01-09 07:31:27 +08:00
elide: Text.ElideRight
}
2024-01-09 07:31:27 +08:00
UkuiItems.Icon {
visible: control.containsMouse
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
Layout.preferredWidth: 24
Layout.preferredHeight: 24
Layout.rightMargin: 16
2024-01-09 07:31:27 +08:00
mode: UkuiItems.Icon.AutoHighlight
source: "open-menu-symbolic"
}
2023-02-14 09:34:15 +08:00
}
}
}