ukui-menu/qml/AppControls2/AppItem.qml

76 lines
2.4 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
states: State {
when: control.activeFocus
PropertyChanges {
target: controlBase
alpha: 0.55
}
}
StyleBackground {
id: controlBase
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
2023-04-17 17:23:08 +08:00
property bool recentInsatlled: (recentInstall === undefined) ? false : recentInstall
property bool fixToTop: (toTop !== undefined) && (toTop !== 0)
visible: fixToTop || recentInsatlled
2023-04-12 17:13:28 +08:00
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: tag.fixToTop ? tagImage : tag.recentInsatlled ? tagPoint : null
2023-04-12 17:13:28 +08:00
}
2023-02-14 09:34:15 +08:00
}
}
}