mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 03:09:04 +08:00
Add context menu actions for objects and empty space
This commit is contained in:
parent
7e2bd91359
commit
3d5788a6c2
24
Printer.qml
24
Printer.qml
@ -226,10 +226,29 @@ UM.MainWindow {
|
|||||||
settings.onTriggered: { preferences.visible = true; preferences.setPage(1); }
|
settings.onTriggered: { preferences.visible = true; preferences.setPage(1); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Menu {
|
||||||
|
id: objectContextMenu;
|
||||||
|
|
||||||
|
property variant id: -1;
|
||||||
|
|
||||||
|
MenuItem { action: actions.centerObject; }
|
||||||
|
MenuItem { action: actions.deleteObject; }
|
||||||
|
MenuItem { action: actions.multiplyObject; }
|
||||||
|
MenuItem { action: actions.splitObject; }
|
||||||
|
MenuSeparator { }
|
||||||
|
MenuItem { action: actions.deleteAll; }
|
||||||
|
MenuItem { action: actions.reloadAll; }
|
||||||
|
MenuItem { action: actions.resetAllTranslation; }
|
||||||
|
MenuItem { action: actions.resetAll; }
|
||||||
|
}
|
||||||
|
|
||||||
Menu {
|
Menu {
|
||||||
id: contextMenu;
|
id: contextMenu;
|
||||||
|
|
||||||
MenuItem { action: actions.deleteSelection; }
|
MenuItem { action: actions.deleteAll; }
|
||||||
|
MenuItem { action: actions.reloadAll; }
|
||||||
|
MenuItem { action: actions.resetAllTranslation; }
|
||||||
|
MenuItem { action: actions.resetAll; }
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
@ -237,6 +256,9 @@ UM.MainWindow {
|
|||||||
onContextMenuRequested: {
|
onContextMenuRequested: {
|
||||||
if(id == 0) {
|
if(id == 0) {
|
||||||
contextMenu.popup();
|
contextMenu.popup();
|
||||||
|
} else {
|
||||||
|
objectContextMenu.id = id;
|
||||||
|
objectContextMenu.popup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,17 @@ Item {
|
|||||||
property alias undo: undoAction;
|
property alias undo: undoAction;
|
||||||
property alias redo: redoAction;
|
property alias redo: redoAction;
|
||||||
|
|
||||||
property alias deleteSelection: deleteAction;
|
property alias deleteSelection: deleteSelectionAction;
|
||||||
|
|
||||||
|
property alias deleteObject: deleteObjectAction;
|
||||||
|
property alias centerObject: centerObjectAction;
|
||||||
|
property alias multiplyObject: multiplyObjectAction;
|
||||||
|
property alias splitObject: splitObjectAction;
|
||||||
|
|
||||||
property alias deleteAll: deleteAllAction;
|
property alias deleteAll: deleteAllAction;
|
||||||
|
property alias reloadAll: reloadAllAction;
|
||||||
|
property alias resetAllTranslation: resetAllTranslationAction;
|
||||||
|
property alias resetAll: resetAllAction;
|
||||||
|
|
||||||
property alias addMachine: addMachineAction;
|
property alias addMachine: addMachineAction;
|
||||||
property alias settings: settingsAction;
|
property alias settings: settingsAction;
|
||||||
@ -79,13 +88,39 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Action {
|
Action {
|
||||||
id: deleteAction;
|
id: deleteSelectionAction;
|
||||||
//: Delete selection action
|
//: Delete selection action
|
||||||
text: qsTr("Delete Selection");
|
text: qsTr("Delete Selection");
|
||||||
iconName: "edit-delete";
|
iconName: "edit-delete";
|
||||||
shortcut: StandardKey.Delete;
|
shortcut: StandardKey.Delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: deleteObjectAction;
|
||||||
|
//: Delete object action
|
||||||
|
text: qsTr("Delete Object");
|
||||||
|
iconName: "edit-delete";
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: centerObjectAction;
|
||||||
|
//: Center object action
|
||||||
|
text: qsTr("Center Object on Platform");
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: multiplyObjectAction;
|
||||||
|
//: Duplicate object action
|
||||||
|
text: qsTr("Duplicate Object");
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: splitObjectAction;
|
||||||
|
//: Split object action
|
||||||
|
text: qsTr("Split Object into Parts");
|
||||||
|
enabled: false;
|
||||||
|
}
|
||||||
|
|
||||||
Action {
|
Action {
|
||||||
id: deleteAllAction;
|
id: deleteAllAction;
|
||||||
//: Clear build platform action
|
//: Clear build platform action
|
||||||
@ -93,6 +128,24 @@ Item {
|
|||||||
iconName: "edit-clear";
|
iconName: "edit-clear";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: reloadAllAction;
|
||||||
|
//: Reload all objects action
|
||||||
|
text: qsTr("Reload All Objects");
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: resetAllTranslationAction;
|
||||||
|
//: Reset all positions action
|
||||||
|
text: qsTr("Reset All Object Positions");
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: resetAllAction;
|
||||||
|
//: Reset all positions action
|
||||||
|
text: qsTr("Reset All Object Transformations");
|
||||||
|
}
|
||||||
|
|
||||||
Action {
|
Action {
|
||||||
id: openAction;
|
id: openAction;
|
||||||
//: Open file action
|
//: Open file action
|
||||||
|
Loading…
x
Reference in New Issue
Block a user