fixed notifications font rendering
This commit is contained in:
@@ -239,6 +239,130 @@ Item {
|
||||
|
||||
QsMenuOpener { id: rootMenuOpener }
|
||||
|
||||
Component {
|
||||
id: trayMenuItemComponent
|
||||
|
||||
Item {
|
||||
id: menuItem
|
||||
required property var modelData
|
||||
readonly property bool isSep: modelData.isSeparator
|
||||
|
||||
width: parent.width
|
||||
height: isSep ? 5 : 32
|
||||
|
||||
Rectangle {
|
||||
visible: isSep
|
||||
anchors {
|
||||
left: parent.left; right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
anchors.leftMargin: 8; anchors.rightMargin: 8
|
||||
height: 1
|
||||
color: root.tmSeparator
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
visible: !isSep
|
||||
anchors.fill: parent
|
||||
anchors.margins: 2
|
||||
radius: 10
|
||||
readonly property bool active: menuMouse.containsMouse
|
||||
|| (submenuCard.visible
|
||||
&& trayMenuPopup._submenuParentRef === menuItem)
|
||||
color: active ? root.tmHover : "transparent"
|
||||
Behavior on color { ColorAnimation { duration: 120 } }
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 8; anchors.rightMargin: 8
|
||||
spacing: 8
|
||||
|
||||
Item {
|
||||
Layout.preferredWidth: 16
|
||||
Layout.preferredHeight: 16
|
||||
visible: !isSep
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
visible: modelData.buttonType === QsMenuButtonType.CheckBox
|
||||
&& modelData.checkState === Qt.Checked
|
||||
text: "✓"; color: root.tmCheck
|
||||
font.pixelSize: 14
|
||||
}
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
visible: modelData.buttonType === QsMenuButtonType.RadioButton
|
||||
&& modelData.checkState === Qt.Checked
|
||||
text: "●"; color: root.tmCheck
|
||||
font.pixelSize: 9
|
||||
}
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
visible: modelData.buttonType === QsMenuButtonType.RadioButton
|
||||
&& modelData.checkState !== Qt.Checked
|
||||
text: "○"; color: root.tmDim
|
||||
font.pixelSize: 11
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
visible: !isSep && modelData.icon !== ""
|
||||
source: modelData.icon
|
||||
width: 16; height: 16
|
||||
sourceSize: Qt.size(16, 16)
|
||||
fillMode: Image.PreserveAspectFit
|
||||
}
|
||||
|
||||
Text {
|
||||
text: modelData.text
|
||||
color: modelData.enabled ? root.tmText : root.tmDim
|
||||
font.pixelSize: 13
|
||||
Layout.fillWidth: true
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
Text {
|
||||
visible: !isSep && modelData.hasChildren
|
||||
text: "▶"
|
||||
color: root.tmDim
|
||||
font.pixelSize: 9
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: menuMouse
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
enabled: !isSep && modelData.enabled
|
||||
|
||||
onClicked: {
|
||||
if (modelData.hasChildren) {
|
||||
closeSubmenuTimer.stop()
|
||||
submenuDelayTimer.itemRef = menuItem
|
||||
submenuDelayTimer.restart()
|
||||
} else {
|
||||
modelData.triggered()
|
||||
trayMenuPopup.close()
|
||||
}
|
||||
}
|
||||
onEntered: {
|
||||
if (modelData.hasChildren) {
|
||||
closeSubmenuTimer.stop()
|
||||
submenuDelayTimer.itemRef = menuItem
|
||||
submenuDelayTimer.restart()
|
||||
} else {
|
||||
closeSubmenuTimer.stop()
|
||||
submenuCard.visible = false
|
||||
}
|
||||
}
|
||||
onExited: {
|
||||
if (modelData.hasChildren)
|
||||
closeSubmenuTimer.restart()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: menuCardWrapper
|
||||
@@ -301,133 +425,7 @@ Item {
|
||||
|
||||
Repeater {
|
||||
model: rootMenuOpener.children
|
||||
|
||||
delegate: Item {
|
||||
id: menuDelegate
|
||||
required property var modelData
|
||||
property bool isSep: modelData.isSeparator
|
||||
|
||||
width: menuCol.width
|
||||
height: isSep ? 5 : 32
|
||||
|
||||
Rectangle {
|
||||
visible: isSep
|
||||
anchors {
|
||||
left: parent.left; right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
anchors.leftMargin: 8
|
||||
anchors.rightMargin: 8
|
||||
height: 1
|
||||
color: root.tmSeparator
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: itemBg
|
||||
visible: !isSep
|
||||
anchors.fill: parent
|
||||
anchors.margins: 2
|
||||
radius: 10
|
||||
property bool active: itemMouse.containsMouse
|
||||
|| (submenuCard.visible
|
||||
&& trayMenuPopup._submenuParentRef === menuDelegate)
|
||||
color: active ? root.tmHover : "transparent"
|
||||
Behavior on color { ColorAnimation { duration: 120 } }
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 8
|
||||
anchors.rightMargin: 8
|
||||
spacing: 8
|
||||
|
||||
Item {
|
||||
Layout.preferredWidth: 16
|
||||
Layout.preferredHeight: 16
|
||||
visible: !isSep
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
visible: modelData.buttonType === QsMenuButtonType.CheckBox
|
||||
&& modelData.checkState === Qt.Checked
|
||||
text: "✓"
|
||||
color: root.tmCheck
|
||||
font.pixelSize: 14
|
||||
}
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
visible: modelData.buttonType === QsMenuButtonType.RadioButton
|
||||
&& modelData.checkState === Qt.Checked
|
||||
text: "●"
|
||||
color: root.tmCheck
|
||||
font.pixelSize: 9
|
||||
}
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
visible: modelData.buttonType === QsMenuButtonType.RadioButton
|
||||
&& modelData.checkState !== Qt.Checked
|
||||
text: "○"
|
||||
color: root.tmDim
|
||||
font.pixelSize: 11
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
visible: !isSep && modelData.icon !== ""
|
||||
source: modelData.icon
|
||||
width: 16; height: 16
|
||||
sourceSize: Qt.size(16, 16)
|
||||
fillMode: Image.PreserveAspectFit
|
||||
}
|
||||
|
||||
Text {
|
||||
text: modelData.text
|
||||
color: modelData.enabled ? root.tmText : root.tmDim
|
||||
font.pixelSize: 13
|
||||
Layout.fillWidth: true
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
Text {
|
||||
visible: !isSep && modelData.hasChildren
|
||||
text: "▶"
|
||||
color: root.tmDim
|
||||
font.pixelSize: 9
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: itemMouse
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
enabled: !isSep && modelData.enabled
|
||||
|
||||
onClicked: {
|
||||
if (modelData.hasChildren) {
|
||||
closeSubmenuTimer.stop()
|
||||
submenuDelayTimer.itemRef = menuDelegate
|
||||
submenuDelayTimer.restart()
|
||||
} else {
|
||||
modelData.triggered()
|
||||
trayMenuPopup.close()
|
||||
}
|
||||
}
|
||||
onEntered: {
|
||||
if (modelData.hasChildren) {
|
||||
closeSubmenuTimer.stop()
|
||||
submenuDelayTimer.itemRef = menuDelegate
|
||||
submenuDelayTimer.restart()
|
||||
} else {
|
||||
closeSubmenuTimer.stop()
|
||||
submenuCard.visible = false
|
||||
}
|
||||
}
|
||||
onExited: {
|
||||
if (modelData.hasChildren)
|
||||
closeSubmenuTimer.restart()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
delegate: trayMenuItemComponent
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -515,96 +513,7 @@ Item {
|
||||
|
||||
Repeater {
|
||||
model: subMenuOpener.children
|
||||
|
||||
delegate: Item {
|
||||
required property var modelData
|
||||
property bool isSep: modelData.isSeparator
|
||||
|
||||
width: submenuCol.width
|
||||
height: isSep ? 5 : 32
|
||||
|
||||
Rectangle {
|
||||
visible: isSep
|
||||
anchors {
|
||||
left: parent.left; right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
anchors.leftMargin: 8; anchors.rightMargin: 8
|
||||
height: 1
|
||||
color: root.tmSeparator
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: subBg
|
||||
visible: !isSep
|
||||
anchors.fill: parent
|
||||
anchors.margins: 2
|
||||
radius: 10
|
||||
color: subMouse.containsMouse ? root.tmHover : "transparent"
|
||||
Behavior on color { ColorAnimation { duration: 120 } }
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 8; anchors.rightMargin: 8
|
||||
spacing: 8
|
||||
|
||||
Item {
|
||||
Layout.preferredWidth: 16
|
||||
Layout.preferredHeight: 16
|
||||
visible: !isSep
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
visible: modelData.buttonType === QsMenuButtonType.CheckBox
|
||||
&& modelData.checkState === Qt.Checked
|
||||
text: "✓"; color: root.tmCheck
|
||||
font.pixelSize: 14
|
||||
}
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
visible: modelData.buttonType === QsMenuButtonType.RadioButton
|
||||
&& modelData.checkState === Qt.Checked
|
||||
text: "●"; color: root.tmCheck
|
||||
font.pixelSize: 9
|
||||
}
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
visible: modelData.buttonType === QsMenuButtonType.RadioButton
|
||||
&& modelData.checkState !== Qt.Checked
|
||||
text: "○"; color: root.tmDim
|
||||
font.pixelSize: 11
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
visible: !isSep && modelData.icon !== ""
|
||||
source: modelData.icon
|
||||
width: 16; height: 16
|
||||
sourceSize: Qt.size(16, 16)
|
||||
fillMode: Image.PreserveAspectFit
|
||||
}
|
||||
|
||||
Text {
|
||||
text: modelData.text
|
||||
color: modelData.enabled ? root.tmText : root.tmDim
|
||||
font.pixelSize: 13
|
||||
Layout.fillWidth: true
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: subMouse
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
enabled: !isSep && modelData.enabled
|
||||
onClicked: {
|
||||
modelData.triggered()
|
||||
trayMenuPopup.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
delegate: trayMenuItemComponent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user