ukui-menu/qml/AppControls2/AppItem.qml

68 lines
2.1 KiB
QML
Raw Normal View History

2023-02-20 17:23:08 +08:00
import QtQuick 2.12
2023-02-14 09:34:15 +08:00
import QtQuick.Layouts 1.12
2023-02-20 17:23:08 +08:00
import QtQuick.Controls 2.5
import org.ukui.menu.core 1.0
2023-02-14 09:34:15 +08:00
MouseArea {
id: control
hoverEnabled: true
2023-02-14 09:34:15 +08:00
StyleBackground {
2023-02-20 17:23:08 +08:00
anchors.fill: parent
radius: 4
useStyleTransparent: false
alpha: control.containsPress ? 0.82 : control.containsMouse ? 0.55 : 0.00
ToolTip.visible: content.textTruncated && control.containsMouse
ToolTip.text: name
2023-02-14 09:34:15 +08:00
2023-04-12 17:13:28 +08:00
RowLayout {
anchors.fill: parent
2023-04-12 17:13:28 +08:00
spacing: 2
IconLabel {
id: content
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
Layout.fillWidth: true
Layout.fillHeight: true
iconHeight: 32; iconWidth: iconHeight
appName: name; appIcon: icon
display: Display.TextBesideIcon
spacing: 12
}
Loader {
id: tag
property bool recentInsatlled: false
visible: (toTop !== 0) || recentInsatlled
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
Layout.fillWidth: true
Layout.fillHeight: true
Layout.maximumWidth: visible ? 16 : 0
Layout.maximumHeight: width
Layout.rightMargin: visible ? 25 : 0
Component {
id: tagImage
Image {
source: "image://appicon/ukui-fixed-symbolic"
}
}
Component {
id: tagPoint
Item {
Rectangle {
anchors.centerIn: parent
width: 8; height: width
radius: width / 2
color: themePalette.paletteColor(Palette.Highlight)
}
}
}
sourceComponent: (toTop === 0) ? tag.recentInsatlled ? tagPoint : null : tagImage
}
2023-02-14 09:34:15 +08:00
}
}
}