QmlDesigner: Fix context menu looks

Change-Id: I6d8a87354456ced6420b62f6a8bfa73a81ce6228
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Henning Gruendl
2019-07-25 14:27:41 +02:00
committed by Henning Gründl
parent ef95a19a5f
commit 0e159760e5
3 changed files with 12 additions and 19 deletions

View File

@@ -24,20 +24,19 @@
****************************************************************************/
import QtQuick 2.12
import QtQuick.Controls 2.12 as Controls2
Menu {
id: contextMenu
property Item myTextEdit
Controls2.MenuItem {
MenuItem {
text: "Undo"
enabled: myTextEdit.canUndo
onTriggered: myTextEdit.undo()
/* shortcut: StandardKey.Undo Shortcuts in QQC2 seem to override global shortcuts */
}
Controls2.MenuItem {
MenuItem {
text: "Redo"
enabled: myTextEdit.canRedo
onTriggered: myTextEdit.redo()
@@ -47,32 +46,32 @@ Menu {
MenuSeparator {
}
Controls2.MenuItem {
MenuItem {
text: "Copy"
enabled: myTextEdit.selectedText !== ""
onTriggered: myTextEdit.copy()
/* shortcut: StandardKey.Copy Shortcuts in QQC2 seem to override global shortcuts */
}
Controls2.MenuItem {
MenuItem {
text: "Cut"
enabled: myTextEdit.selectedText !== "" && !myTextEdit.readOnly
onTriggered: myTextEdit.cut()
/* shortcut: StandardKey.Cut Shortcuts in QQC2 seem to override global shortcuts */
}
Controls2.MenuItem {
MenuItem {
text: "Paste"
enabled: myTextEdit.canPaste
onTriggered: myTextEdit.paste()
/* shortcut: StandardKey.Paste Shortcuts in QQC2 seem to override global shortcuts */
}
Controls2.MenuItem {
MenuItem {
text: "Delete"
enabled: myTextEdit.selectedText !== ""
onTriggered: myTextEdit.remove(myTextEdit.selectionStart,
myTextEdit.selectionEnd)
/* shortcut: StandardKey.Delete Shortcuts in QQC2 seem to override global shortcuts */
}
Controls2.MenuItem {
MenuItem {
text: "Clear"
enabled: myTextEdit.text !== ""
onTriggered: myTextEdit.clear()
@@ -82,7 +81,7 @@ Menu {
MenuSeparator {
}
Controls2.MenuItem {
MenuItem {
text: "Select All"
enabled: myTextEdit.text !== ""
&& myTextEdit.selectedText !== myTextEdit.text

View File

@@ -46,11 +46,6 @@ T.MenuItem {
action: Action {}
contentItem: Item {
id: menuItem
width: control.menu.width
height: StudioTheme.Values.height
Text {
id: textLabel
text: control.text
@@ -77,11 +72,11 @@ T.MenuItem {
background: Rectangle {
implicitWidth: textLabel.implicitWidth + control.labelSpacing + shortcutLabel.implicitWidth
+ control.leftPadding + control.rightPadding // TODO
+ control.leftPadding + control.rightPadding
implicitHeight: StudioTheme.Values.height
x: StudioTheme.Values.border
y: StudioTheme.Values.border
width: control.width - (StudioTheme.Values.border * 2)
width: control.menu.width - (StudioTheme.Values.border * 2)
height: control.height - (StudioTheme.Values.border * 2)
color: control.down ? control.palette.midlight : control.highlighted ? StudioTheme.Values.themeInteraction : "transparent"
}

View File

@@ -36,11 +36,10 @@ T.MenuSeparator {
implicitContentHeight + topPadding + bottomPadding)
padding: 0
verticalPadding: padding
contentItem: Rectangle {
implicitWidth: 10
implicitHeight: StudioTheme.Values.border
width: control.parent.width
height: StudioTheme.Values.border
color: StudioTheme.Values.themeControlOutline
}
}