fix(StatusSpellcheckingMenuItems): Exact menu items order

This commit is contained in:
B.Melnik 2021-09-22 17:15:33 +03:00 committed by Pascal Precht
parent 654bd9f284
commit 478177f25e
1 changed files with 86 additions and 63 deletions

View File

@ -13,72 +13,95 @@ StatusPopupMenu {
signal addToUserDict() signal addToUserDict()
signal disableSpellchecking() signal disableSpellchecking()
Repeater { Column {
id: suggestionsMenu
delegate: Loader { Repeater {
sourceComponent: root.delegate id: suggestionsMenu
onLoaded: {
item.action.text = modelData delegate: MenuItem {
id: variants
implicitWidth: parent ? parent.width : 0
implicitHeight: 38
contentItem: StatusBaseText {
rightPadding: 8
leftPadding: 4
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
text: modelData
color: Theme.palette.directColor1
font.pixelSize: 13
elide: Text.ElideRight
}
background: Rectangle {
color: variants.hovered ? Theme.palette.statusPopupMenu.hoverBackgroundColor
: "transparent"
}
onTriggered: {
root.menuItemClicked(index)
}
}
}
StatusMenuSeparator { visible: !!suggestionsMenu.model && suggestionsMenu.model.length !== 0}
MenuItem {
id: ignoreWord
implicitWidth: parent ? parent.width : 0
implicitHeight: 38
contentItem: StatusBaseText {
rightPadding: 8
leftPadding: 4
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
text: qsTr("Add to dictionary")
color: Theme.palette.directColor1
font.pixelSize: 13
elide: Text.ElideRight
}
background: Rectangle {
color: ignoreWord.hovered ? Theme.palette.statusPopupMenu.hoverBackgroundColor
: "transparent"
}
onTriggered: {
root.addToUserDict()
}
}
MenuItem {
id: disableSpellchecking
implicitWidth: parent ? parent.width : 0
implicitHeight: 38
contentItem: StatusBaseText {
rightPadding: 8
leftPadding: 4
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
text: qsTr("Disable Spellchecking")
color: Theme.palette.directColor1
font.pixelSize: 13
elide: Text.ElideRight
}
background: Rectangle {
color: disableSpellchecking.hovered ? Theme.palette.statusPopupMenu.hoverBackgroundColor
: "transparent"
}
onTriggered: {
root.disableSpellchecking()
} }
} }
} }
StatusMenuSeparator {}
MenuItem {
id: ignoreWord
implicitWidth: parent ? parent.width : 0
implicitHeight: 38
contentItem: StatusBaseText {
rightPadding: 8
leftPadding: 4
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
text: qsTr("Add to dictionary")
color: Theme.palette.directColor1
font.pixelSize: 13
elide: Text.ElideRight
}
background: Rectangle {
color: ignoreWord.hovered ? Theme.palette.statusPopupMenu.hoverBackgroundColor
: "transparent"
}
onTriggered: {
root.addToUserDict()
}
}
MenuItem {
id: disableSpellchecking
implicitWidth: parent ? parent.width : 0
implicitHeight: 38
contentItem: StatusBaseText {
rightPadding: 8
leftPadding: 4
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
text: qsTr("Disable Spellchecking")
color: Theme.palette.directColor1
font.pixelSize: 13
elide: Text.ElideRight
}
background: Rectangle {
color: disableSpellchecking.hovered ? Theme.palette.statusPopupMenu.hoverBackgroundColor
: "transparent"
}
onTriggered: {
root.disableSpellchecking()
}
}
} }