Skip to content

Commit

Permalink
Add context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
DionysusBenstein committed Jul 1, 2018
1 parent ac16c0f commit a4c37d6
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion AppBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Rectangle {

Text {
id: headerText
text: "Counter v2.4.5"
text: "Counter v2.5.0"
font.family: robotoMediumFont.name
font.pointSize: 15
color: "white"
Expand Down
38 changes: 38 additions & 0 deletions main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,44 @@ ApplicationWindow {
wrapMode: Text.WrapAnywhere
placeholderText: qsTr("Введите текст...")
selectByMouse: true
anchors.fill: input

MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onPressed: mouse.button === Qt.RightButton ? firstContextMenu.popup() : input.forceActiveFocus()
}

Menu {
id: firstContextMenu
Action {
text: qsTr("Cut")
onTriggered: {
input.cut()
}
}

Action {
text: qsTr("Copy")
onTriggered: {
input.copy()
}
}

Action {
text: qsTr("Paste")
onTriggered: {
input.paste()
}
}

Action {
text: qsTr("Delete")
onTriggered: {
input.deleteLater()
}
}
}
}
}

Expand Down

0 comments on commit a4c37d6

Please sign in to comment.