feat(StatusSpellcheckingMenuItems): Add spellchecking menu

Closes: #398
This commit is contained in:
B.Melnik 2021-09-14 15:53:35 +03:00 committed by Michał Cieślak
parent 48bd006d05
commit 79769c165e
4 changed files with 97 additions and 0 deletions

View File

@ -63,6 +63,11 @@ Column {
onClicked: modalWithHeaderPopupMenu.open()
}
StatusButton {
text: "Spellchecking menu"
onClicked: spellMenu.open()
}
StatusModal {
id: simpleModal
anchors.centerIn: parent
@ -309,4 +314,10 @@ CExPynn1gWf9bx498P7/nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2I
ListElement{name: "Account 1"; iconName: "filled-account"}
ListElement{name: "Account 2"; iconName: "filled-account"}
}
StatusSpellcheckingMenuItems {
id: spellMenu
anchors.centerIn: parent
suggestions: ["suggestion1", "suggestion2", "suggestion3", "suggestion4"]
}
}

View File

@ -0,0 +1,84 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
StatusPopupMenu {
id: root
property alias suggestions: suggestionsMenu.model
signal addToUserDict()
signal disableSpellchecking()
Repeater {
id: suggestionsMenu
delegate: Loader {
sourceComponent: root.delegate
onLoaded: {
item.action.text = modelData
}
}
}
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()
}
}
}

View File

@ -9,3 +9,4 @@ StatusSearchPopup 0.1 StatusSearchPopup.qml
StatusModalDivider 0.1 StatusModalDivider.qml
StatusSearchPopupMenuItem 0.1 StatusSearchPopupMenuItem.qml
StatusSearchLocationMenu 0.1 StatusSearchLocationMenu.qml
StatusSpellcheckingMenuItems 0.1 StatusSpellcheckingMenuItems.qml

View File

@ -268,5 +268,6 @@
<file>src/StatusQ/Controls/StatusSwitchTabBar.qml</file>
<file>src/StatusQ/Components/StatusExpandableItem.qml</file>
<file>src/assets/img/icons/snt.svg</file>
<file>src/StatusQ/Popups/StatusSpellcheckingMenuItems.qml</file>
</qresource>
</RCC>