mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-04 20:01:58 +02:00
[qt6] Use JS functions format to declare explicit parameters in slots
This fixes all the "Injection of parameters into signal handlers is deprecated. Use JavaScript functions with formal parameters instead." warnings.
This commit is contained in:
parent
1b9e75cd4f
commit
6d845376eb
12 changed files with 94 additions and 77 deletions
|
@ -132,7 +132,7 @@ Item {
|
|||
return mapToItem(draggable, mouseArea.width / 2, mouseArea.height / 2)
|
||||
}
|
||||
|
||||
Keys.onPressed: {
|
||||
Keys.onPressed: function(event) {
|
||||
if (event.key === Qt.Key_F) {
|
||||
fit()
|
||||
} else if (event.key === Qt.Key_Delete) {
|
||||
|
@ -172,7 +172,7 @@ Item {
|
|||
drag.threshold: 0
|
||||
cursorShape: drag.target == draggable ? Qt.ClosedHandCursor : Qt.ArrowCursor
|
||||
|
||||
onWheel: {
|
||||
onWheel: function(wheel) {
|
||||
var zoomFactor = wheel.angleDelta.y > 0 ? factor : 1 / factor
|
||||
var scale = draggable.scale * zoomFactor
|
||||
scale = Math.min(Math.max(minZoom, scale), maxZoom)
|
||||
|
@ -185,7 +185,7 @@ Item {
|
|||
workspaceMoved()
|
||||
}
|
||||
|
||||
onPressed: {
|
||||
onPressed: function(mouse) {
|
||||
if (mouse.button != Qt.MiddleButton && mouse.modifiers == Qt.NoModifier) {
|
||||
uigraph.clearNodeSelection()
|
||||
}
|
||||
|
@ -200,17 +200,19 @@ Item {
|
|||
drag.target = draggable // start drag
|
||||
}
|
||||
}
|
||||
|
||||
onReleased: {
|
||||
drag.target = undefined // stop drag
|
||||
root.forceActiveFocus()
|
||||
workspaceClicked()
|
||||
}
|
||||
|
||||
onPositionChanged: {
|
||||
if (drag.active)
|
||||
workspaceMoved()
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
onClicked: function(mouse) {
|
||||
if (mouse.button == Qt.RightButton) {
|
||||
// store mouse click position in 'draggable' coordinates as new node spawn position
|
||||
newNodeMenu.spawnPosition = mouseArea.mapToItem(draggable, mouse.x, mouse.y)
|
||||
|
@ -335,7 +337,7 @@ Item {
|
|||
id: nodeMenuRepeater
|
||||
model: searchBar.text !== "" ? Object.values(newNodeMenu.menuKeys) : undefined
|
||||
|
||||
// create Menu items from available items
|
||||
// Create Menu items from available items
|
||||
delegate: menuItemDelegateComponent
|
||||
}
|
||||
|
||||
|
@ -343,8 +345,13 @@ Item {
|
|||
Instantiator {
|
||||
id: instantiator
|
||||
model: (searchBar.text === "") ? Object.keys(newNodeMenu.parseCategories()).sort() : undefined
|
||||
onObjectAdded: newNodeMenu.insertMenu(index + 1, object ) // add sub-menu under the search bar
|
||||
onObjectRemoved: newNodeMenu.removeMenu(object)
|
||||
onObjectAdded: function(index, object) {
|
||||
// Add sub-menu under the search bar
|
||||
newNodeMenu.insertMenu(index + 1, object)
|
||||
}
|
||||
onObjectRemoved: function(index, object) {
|
||||
newNodeMenu.removeMenu(object)
|
||||
}
|
||||
|
||||
delegate: Menu {
|
||||
title: modelData
|
||||
|
@ -352,8 +359,12 @@ Item {
|
|||
|
||||
Instantiator {
|
||||
model: newNodeMenu.visible ? newNodeMenu.parseCategories()[modelData] : undefined
|
||||
onObjectAdded: newNodeSubMenu.insertItem(index, object)
|
||||
onObjectRemoved: newNodeSubMenu.removeItem(object)
|
||||
onObjectAdded: function(index, object) {
|
||||
newNodeSubMenu.insertItem(index, object)
|
||||
}
|
||||
onObjectRemoved: function(index, object) {
|
||||
newNodeSubMenu.removeItem(object)
|
||||
}
|
||||
delegate: menuItemDelegateComponent
|
||||
}
|
||||
}
|
||||
|
@ -505,7 +516,7 @@ Item {
|
|||
point1y: isValidEdge ? src.globalY + src.outputAnchorPos.y : 0
|
||||
point2x: isValidEdge ? dst.globalX + dst.inputAnchorPos.x : 0
|
||||
point2y: isValidEdge ? dst.globalY + dst.inputAnchorPos.y : 0
|
||||
onPressed: {
|
||||
onPressed: function(event) {
|
||||
const canEdit = !edge.dst.node.locked
|
||||
|
||||
if (event.button) {
|
||||
|
@ -823,14 +834,14 @@ Item {
|
|||
selected: uigraph.selectedNodes.contains(node)
|
||||
hovered: uigraph.hoveredNode === node
|
||||
|
||||
onAttributePinCreated: registerAttributePin(attribute, pin)
|
||||
onAttributePinDeleted: unregisterAttributePin(attribute, pin)
|
||||
onAttributePinCreated: function(attribute, pin) { registerAttributePin(attribute, pin) }
|
||||
onAttributePinDeleted: function(attribute, pin) { unregisterAttributePin(attribute, pin) }
|
||||
|
||||
onPressed: {
|
||||
onPressed: function(mouse) {
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
if (mouse.modifiers & Qt.ControlModifier && !(mouse.modifiers & Qt.AltModifier)) {
|
||||
if (mainSelected && selected) {
|
||||
// left clicking a selected node twice with control will deselect it
|
||||
// Left clicking a selected node twice with control will deselect it
|
||||
uigraph.selectedNodes.remove(node)
|
||||
uigraph.selectedNodesChanged()
|
||||
selectNode(null)
|
||||
|
@ -854,14 +865,14 @@ Item {
|
|||
selectNode(node)
|
||||
}
|
||||
|
||||
onDoubleClicked: root.nodeDoubleClicked(mouse, node)
|
||||
onDoubleClicked: function(mouse) { root.nodeDoubleClicked(mouse, node) }
|
||||
|
||||
onMoved: uigraph.moveNode(node, position, uigraph.selectedNodes)
|
||||
onMoved: function(position) { uigraph.moveNode(node, position, uigraph.selectedNodes) }
|
||||
|
||||
onEntered: uigraph.hoveredNode = node
|
||||
onExited: uigraph.hoveredNode = null
|
||||
|
||||
onEdgeAboutToBeRemoved: {
|
||||
onEdgeAboutToBeRemoved: function(input) {
|
||||
/*
|
||||
Sometimes the signals are not in the right order
|
||||
because of weird Qt/QML update order (next DropArea
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue