TrayMenu: improved look + fixed error
This commit is contained in:
parent
ccd5fbba3a
commit
f29fd7b555
1 changed files with 11 additions and 7 deletions
|
|
@ -98,7 +98,8 @@ PopupWindow {
|
||||||
required property var modelData
|
required property var modelData
|
||||||
|
|
||||||
width: listView.width
|
width: listView.width
|
||||||
height: (modelData?.isSeparator) ? 8 * scaling : 32 * scaling
|
height: (modelData?.isSeparator) ? 8 * scaling : Math.max(32 * scaling,
|
||||||
|
text.height + 8)
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
property var subMenu: null
|
property var subMenu: null
|
||||||
|
|
@ -123,6 +124,7 @@ PopupWindow {
|
||||||
spacing: Style.marginSmall * scaling
|
spacing: Style.marginSmall * scaling
|
||||||
|
|
||||||
NText {
|
NText {
|
||||||
|
id: text
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
color: (modelData?.enabled
|
color: (modelData?.enabled
|
||||||
?? true) ? (mouseArea.containsMouse ? Colors.onAccent : Colors.textPrimary) : Colors.textDisabled
|
?? true) ? (mouseArea.containsMouse ? Colors.onAccent : Colors.textPrimary) : Colors.textDisabled
|
||||||
|
|
@ -144,7 +146,7 @@ PopupWindow {
|
||||||
Text {
|
Text {
|
||||||
text: modelData?.hasChildren ? "menu" : ""
|
text: modelData?.hasChildren ? "menu" : ""
|
||||||
font.family: "Material Symbols Outlined"
|
font.family: "Material Symbols Outlined"
|
||||||
font.pointSize: Colors.fontSizeMedium * scaling
|
font.pointSize: Colors.fontSizeSmall * scaling
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
visible: modelData?.hasChildren ?? false
|
visible: modelData?.hasChildren ?? false
|
||||||
color: Colors.textPrimary
|
color: Colors.textPrimary
|
||||||
|
|
@ -307,7 +309,7 @@ PopupWindow {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: bg
|
id: bg
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: Colors.backgroundPrimary
|
color: Colors.backgroundSecondary
|
||||||
border.color: Colors.outline
|
border.color: Colors.outline
|
||||||
border.width: Math.max(1, Style.borderThin * scaling)
|
border.width: Math.max(1, Style.borderThin * scaling)
|
||||||
radius: Style.radiusMedium * scaling
|
radius: Style.radiusMedium * scaling
|
||||||
|
|
@ -332,7 +334,8 @@ PopupWindow {
|
||||||
required property var modelData
|
required property var modelData
|
||||||
|
|
||||||
width: listView.width
|
width: listView.width
|
||||||
height: (modelData?.isSeparator) ? 8 * scaling : 32 * scaling
|
height: (modelData?.isSeparator) ? 8 * scaling : Math.max(32 * scaling,
|
||||||
|
subText.height + 8)
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
property var subMenu: null
|
property var subMenu: null
|
||||||
|
|
@ -358,6 +361,7 @@ PopupWindow {
|
||||||
spacing: Style.spacingSmall * scaling
|
spacing: Style.spacingSmall * scaling
|
||||||
|
|
||||||
NText {
|
NText {
|
||||||
|
id: subText
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
color: (modelData?.enabled ?? true) ? bg.hoverTextColor : Colors.textDisabled
|
color: (modelData?.enabled ?? true) ? bg.hoverTextColor : Colors.textDisabled
|
||||||
text: modelData?.text ?? ""
|
text: modelData?.text ?? ""
|
||||||
|
|
@ -378,7 +382,7 @@ PopupWindow {
|
||||||
NText {
|
NText {
|
||||||
text: modelData?.hasChildren ? "\uE5CC" : ""
|
text: modelData?.hasChildren ? "\uE5CC" : ""
|
||||||
font.family: "Material Symbols Outlined"
|
font.family: "Material Symbols Outlined"
|
||||||
font.pointSize: Colors.fontSizeMedium * scaling
|
font.pointSize: Colors.fontSizeSmall * scaling
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
visible: modelData?.hasChildren ?? false
|
visible: modelData?.hasChildren ?? false
|
||||||
}
|
}
|
||||||
|
|
@ -388,7 +392,7 @@ PopupWindow {
|
||||||
id: mouseArea
|
id: mouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
enabled: (modelData?.enabled ?? true) && !(modelData?.isSeparator ?? false) && subMenu.visible
|
enabled: (modelData?.enabled ?? true) && !(modelData?.isSeparator ?? false)
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (modelData && !modelData.isSeparator) {
|
if (modelData && !modelData.isSeparator) {
|
||||||
|
|
@ -401,7 +405,7 @@ PopupWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
onEntered: {
|
onEntered: {
|
||||||
if (!subMenu.visible) {
|
if (subMenu && !subMenu.visible) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue