67 lines
1.8 KiB
QML
67 lines
1.8 KiB
QML
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.items 1.0 as UkuiItems
|
|
|
|
MouseArea {
|
|
id: control
|
|
hoverEnabled: true
|
|
ToolTip {
|
|
property bool isVisible: control.containsMouse
|
|
id: tip
|
|
x: mouseX + 15
|
|
y: mouseY + 15
|
|
text: comment
|
|
visible: control.containsMouse
|
|
delay: 500
|
|
}
|
|
onPositionChanged: {
|
|
if (tip.isVisible) {
|
|
if (tip.visible) {
|
|
tip.hide();
|
|
} else {
|
|
tip.show(comment);
|
|
}
|
|
}
|
|
}
|
|
states: State {
|
|
when: control.activeFocus
|
|
PropertyChanges {
|
|
target: controlBase
|
|
borderColor: Palette.Highlight
|
|
border.width: 2
|
|
}
|
|
}
|
|
StyleBackground {
|
|
id: controlBase
|
|
anchors.fill: parent
|
|
radius: UkuiItems.Theme.minRadius
|
|
useStyleTransparent: false
|
|
alpha: control.containsPress ? 0.82 : control.containsMouse ? 0.55 : 0.00
|
|
|
|
RowLayout {
|
|
anchors.fill: parent
|
|
StyleText {
|
|
Layout.preferredHeight: parent.height
|
|
Layout.preferredWidth: contentWidth
|
|
Layout.leftMargin: 12
|
|
|
|
horizontalAlignment: Qt.AlignLeft
|
|
verticalAlignment: Qt.AlignVCenter
|
|
font.bold: true
|
|
text: name
|
|
}
|
|
|
|
Image {
|
|
visible: control.containsMouse
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
|
Layout.preferredWidth: 24
|
|
Layout.preferredHeight: 24
|
|
Layout.rightMargin: 16
|
|
source: "image://appicon/open-menu-symbolic"
|
|
}
|
|
}
|
|
}
|
|
}
|