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
|
|
|
|
2023-03-31 16:08:10 +08:00
|
|
|
MouseArea {
|
|
|
|
id: control
|
2023-05-04 15:09:52 +08:00
|
|
|
property bool isSelect: false
|
2023-03-31 16:08:10 +08:00
|
|
|
hoverEnabled: true
|
2023-04-26 17:04:22 +08:00
|
|
|
states: State {
|
|
|
|
when: control.activeFocus
|
|
|
|
PropertyChanges {
|
|
|
|
target: controlBase
|
2023-08-14 11:15:54 +08:00
|
|
|
borderColor: Palette.Highlight
|
|
|
|
border.width: 2
|
2023-04-26 17:04:22 +08:00
|
|
|
}
|
|
|
|
}
|
2023-12-05 09:22:08 +08:00
|
|
|
ToolTip {
|
|
|
|
property bool isVisible: controlBase.isTextTruncated && control.containsMouse
|
|
|
|
id: tip
|
|
|
|
x: mouseX + 15
|
|
|
|
y: mouseY + 15
|
|
|
|
text: name
|
|
|
|
visible: controlBase.isTextTruncated && control.containsMouse
|
|
|
|
delay: 500
|
|
|
|
}
|
|
|
|
onPositionChanged: {
|
|
|
|
if (tip.isVisible) {
|
|
|
|
if (tip.visible) {
|
|
|
|
tip.hide();
|
|
|
|
} else {
|
|
|
|
tip.show(name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-03-31 16:08:10 +08:00
|
|
|
StyleBackground {
|
2023-12-05 09:22:08 +08:00
|
|
|
property bool isTextTruncated: content.textTruncated
|
2023-04-26 17:04:22 +08:00
|
|
|
id: controlBase
|
2023-02-20 17:23:08 +08:00
|
|
|
anchors.fill: parent
|
2023-03-31 16:08:10 +08:00
|
|
|
radius: 4
|
|
|
|
useStyleTransparent: false
|
2023-06-27 16:19:40 +08:00
|
|
|
paletteRole: Palette.Light
|
2023-05-04 15:09:52 +08:00
|
|
|
alpha: isSelect ? 1.00 : control.containsPress ? 0.82 : control.containsMouse ? 0.55 : 0.00
|
2023-02-14 09:34:15 +08:00
|
|
|
|
2023-04-12 17:13:28 +08:00
|
|
|
RowLayout {
|
2023-03-31 16:08:10 +08:00
|
|
|
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
|
2023-04-14 10:09:15 +08:00
|
|
|
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 {
|
2023-11-30 17:10:17 +08:00
|
|
|
StyleBackground {
|
2023-04-12 17:13:28 +08:00
|
|
|
anchors.centerIn: parent
|
|
|
|
width: 8; height: width
|
|
|
|
radius: width / 2
|
2023-11-30 17:10:17 +08:00
|
|
|
paletteRole: Palette.Highlight
|
|
|
|
useStyleTransparent: false
|
2023-04-12 17:13:28 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-04-14 10:09:15 +08:00
|
|
|
sourceComponent: tag.fixToTop ? tagImage : tag.recentInsatlled ? tagPoint : null
|
2023-04-12 17:13:28 +08:00
|
|
|
}
|
2023-02-14 09:34:15 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|