forked from qt-creator/qt-creator
Context menu: improve right click
-Improve right click -Disable context pin menu with 0 pins Change-Id: I8f53710d85c09a624acdac370af980f3c0947190 Reviewed-by: spyro-adb <adb@spyro-soft.com>
This commit is contained in:
committed by
spyro-adb
parent
9651a7ca70
commit
1c64cff458
@@ -294,6 +294,19 @@ Item {
|
|||||||
graph.removeSelection();
|
graph.removeSelection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onNodeRightClicked: node => {
|
||||||
|
if (NodeGraphEditorBackend.nodeGraphEditorModel.currentFileName !== "") {
|
||||||
|
contextMenu.node = node;
|
||||||
|
var selectedNodes = graphView.graph.selectedNodes;
|
||||||
|
if (selectedNodes && selectedNodes.length > 0) {
|
||||||
|
contextMenu.node = selectedNodes.at(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
const factor = (1.0 / graphView.zoom);
|
||||||
|
contextMenu.newPosition = Qt.point(-graphView.containerItem.x * factor + node.item.x * factor, -graphView.containerItem.y * factor + node.item.y * factor);
|
||||||
|
contextMenu.popup();
|
||||||
|
}
|
||||||
|
}
|
||||||
onRightClicked: pos => {
|
onRightClicked: pos => {
|
||||||
if (NodeGraphEditorBackend.nodeGraphEditorModel.currentFileName !== "") {
|
if (NodeGraphEditorBackend.nodeGraphEditorModel.currentFileName !== "") {
|
||||||
contextMenu.node = null;
|
contextMenu.node = null;
|
||||||
|
@@ -113,7 +113,7 @@ StudioControls.Menu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StudioControls.Menu {
|
StudioControls.Menu {
|
||||||
enabled: node !== null
|
enabled: node !== null && pinRepeater.count > 0
|
||||||
title: "Pins"
|
title: "Pins"
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
|
Reference in New Issue
Block a user