Skip to content

Commit

Permalink
- Fixes some binding loops (QML).
Browse files Browse the repository at this point in the history
- Fixes some deprecated callback uses (QML).
- Fixes missing namespace (QML).
- Fixes warnings on potential null values (QML).
  • Loading branch information
Ledjlale committed Sep 18, 2024
1 parent 606b850 commit 63f1ce2
Show file tree
Hide file tree
Showing 32 changed files with 84 additions and 74 deletions.
2 changes: 2 additions & 0 deletions qmlui/js/Math3DView.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ function lookAt(eye, center, up)

function getLightDirection(transform, panTransform, tiltTransform)
{
if (!transform) return Qt.vector3d(0.0,0.0,0.0)

var m = transform.matrix;
if (panTransform) {
m = transform.matrix.times(panTransform.matrix);
Expand Down
2 changes: 2 additions & 0 deletions qmlui/qml/ActionsMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ Popup
CustomPopupDialog
{
id: saveFirstPopup
width: menuRoot.width // Set width to avoid binding loops on implicit sizes
title: qsTr("Your project has changes")
message: qsTr("Do you wish to save the current project first?\nChanges will be lost if you don't save them.")
standardButtons: Dialog.Yes | Dialog.No | Dialog.Cancel
Expand Down Expand Up @@ -581,6 +582,7 @@ Popup
PopupAbout
{
id: infoPopup
width: menuRoot.width // Set width to avoid binding loops on implicit sizes
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion qmlui/qml/CustomComboBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ ComboBox
delegate:
ItemDelegate
{
width: parent.width
width: parent?.width
implicitHeight: delegateHeight
highlighted: control.highlightedIndex === index
hoverEnabled: control.hoverEnabled
Expand Down
6 changes: 3 additions & 3 deletions qmlui/qml/FunctionDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ Rectangle

drag.target: dragItem

onPressed: funcDelegate.mouseEvent(App.Pressed, cRef.id, cRef.type, funcDelegate, mouse.modifiers)
onClicked: funcDelegate.mouseEvent(App.Clicked, cRef.id, cRef.type, funcDelegate, mouse.modifiers)
onDoubleClicked: funcDelegate.mouseEvent(App.DoubleClicked, cRef.id, cRef.type, funcDelegate, mouse.modifiers)
onPressed: (mouse) => funcDelegate.mouseEvent(App.Pressed, cRef.id, cRef.type, funcDelegate, mouse.modifiers)
onClicked: (mouse) => funcDelegate.mouseEvent(App.Clicked, cRef.id, cRef.type, funcDelegate, mouse.modifiers)
onDoubleClicked: (mouse) => funcDelegate.mouseEvent(App.DoubleClicked, cRef.id, cRef.type, funcDelegate, mouse.modifiers)
}

DropArea
Expand Down
2 changes: 1 addition & 1 deletion qmlui/qml/GenericButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Rectangle
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: btnRoot.clicked(mouse.button)
onClicked: (mouse) => btnRoot.clicked(mouse.button)
onPressAndHold:
{
if (repetition == true)
Expand Down
2 changes: 1 addition & 1 deletion qmlui/qml/SimpleDesk.qml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Rectangle
id: channelToolLoader
z: 2

onValueChanged: simpleDesk.setValue(fixtureID, channelIndex, value)
onValueChanged: (fixtureID, channelIndex, value) => simpleDesk.setValue(fixtureID, channelIndex, value)
}

SplitView
Expand Down
6 changes: 3 additions & 3 deletions qmlui/qml/TreeNodeDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ Column

drag.target: dragItem

onPressed: nodeContainer.mouseEvent(App.Pressed, cRef ? cRef.id : -1, nodeContainer.itemType,
onPressed: (mouse) => nodeContainer.mouseEvent(App.Pressed, cRef ? cRef.id : -1, nodeContainer.itemType,
nodeContainer, mouse.modifiers)
onClicked:
onClicked: (mouse) =>
{
nodeLabel.forceActiveFocus()
nodeContainer.mouseEvent(App.Clicked, cRef ? cRef.id : -1, nodeContainer.itemType,
Expand All @@ -143,7 +143,7 @@ Column
anchors.fill: parent
keys: [ nodeContainer.dropKeys ]

onDropped:
onDropped: (drop) =>
{
console.log("Item dropped here. x: " + drop.x + " y: " + drop.y + ", items: " + drop.source.itemsList.length)
nodeContainer.itemsDropped(nodePath)
Expand Down
8 changes: 5 additions & 3 deletions qmlui/qml/fixtureeditor/FixtureEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ Rectangle
id: openDialog
visible: false
title: qsTr("Open a fixture definition")
currentFolder: "file://" + fixtureEditor.workingPath
// fixtureEditor may be null on exit
currentFolder: "file://" + fixtureEditor?.workingPath
nameFilters: [ qsTr("Fixture definition files") + " (*.qxf)", qsTr("All files") + " (*)" ]

onAccepted:
Expand All @@ -70,7 +71,8 @@ Rectangle
id: saveDialog
visible: false
title: qsTr("Save definition as...")
currentFolder: "file://" + fixtureEditor.workingPath
// fixtureEditor may be null on exit
currentFolder: "file://" + fixtureEditor?.workingPath
fileMode: FileDialog.SaveFile
nameFilters: [ qsTr("Fixture definition files") + " (*.qxf)", qsTr("All files") + " (*)" ]
defaultSuffix: "qxf"
Expand Down Expand Up @@ -266,7 +268,7 @@ Rectangle
id: editorsRepeater
model: fixtureEditor ? fixtureEditor.editorsList : null

onItemAdded: item.clicked()
onItemAdded: (index,item) => item.clicked()

delegate:
MenuBarEntry
Expand Down
10 changes: 5 additions & 5 deletions qmlui/qml/fixturesfunctions/2DView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ Rectangle
property int initialXPos
property int initialYPos

onPressed:
onPressed: (mouse) =>
{
console.log("button: " + mouse.button + ", mods: " + mouse.modifiers)
var itemID = View2D.itemIDAtPos(Qt.point(mouse.x, mouse.y))
Expand Down Expand Up @@ -256,7 +256,7 @@ Rectangle
}
}

onPositionChanged:
onPositionChanged: (mouse) =>
{
if (selectionRect.visible == true)
{
Expand Down Expand Up @@ -294,7 +294,7 @@ Rectangle
}
}

onReleased:
onReleased: (mouse) =>
{
if (selectionRect.visible === true && selectionRect.width && selectionRect.height)
{
Expand All @@ -317,7 +317,7 @@ Rectangle
}
}

onWheel:
onWheel: (wheel)=>
{
//console.log("Wheel delta: " + wheel.angleDelta.y)
if (wheel.angleDelta.y > 0)
Expand Down Expand Up @@ -353,7 +353,7 @@ Rectangle
drag.threshold: 10
drag.target: parent

onReleased:
onReleased: (mouse) =>
{
if (drag.active)
{
Expand Down
10 changes: 5 additions & 5 deletions qmlui/qml/fixturesfunctions/3DView/3DView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ Rectangle

projectionType: CameraLens.PerspectiveProjection
fieldOfView: 45
aspectRatio: viewSize.width / viewSize.height
aspectRatio: viewCamera.width / viewCamera.height
nearPlane: 1.0
farPlane: 1000.0
position: View3D.cameraPosition
Expand Down Expand Up @@ -360,15 +360,15 @@ Rectangle
property int selGenericCount: View3D.genericSelectedCount

sourceDevice: mDevice
onPressed:
onPressed: (mouse) =>
{
directionCounter = 0
dx = 0
dy = 0
startPoint = Qt.point(mouse.x, mouse.y)
}

onPositionChanged:
onPositionChanged: (mouse) =>
{
if (directionCounter < 3)
{
Expand Down Expand Up @@ -444,7 +444,7 @@ Rectangle
if (!mouse.modifiers || (mouse.modifiers & Qt.ShiftModifier && direction == Qt.Horizontal))
viewCamera.panAboutViewCenter(-xDelta, Qt.vector3d(0, 1, 0))
if (!mouse.modifiers || (mouse.modifiers & Qt.ShiftModifier && direction == Qt.Vertical))
viewCamera.tiltAboutViewCenter(yDelta, Qt.vector3d(1, 0, 0))
viewCamera.tiltAboutViewCenter(yDelta)

View3D.cameraPosition = viewCamera.position
View3D.cameraUpVector = viewCamera.upVector
Expand All @@ -464,7 +464,7 @@ Rectangle
startPoint = Qt.point(mouse.x, mouse.y)
}

onWheel:
onWheel: (wheel) =>
{
if (wheel.angleDelta.y > 0)
viewCamera.setZoom(-1)
Expand Down
13 changes: 7 additions & 6 deletions qmlui/qml/fixturesfunctions/3DView/Fixture3DItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ Entity
readonly property Layer spotlightScatteringLayer: Layer { }

property real coneBottomRadius: distCutoff * Math.tan(cutoffAngle) + coneTopRadius
property real coneTopRadius: (0.24023 / 2) * transform.scale3D.x * 0.7 // (diameter / 2) * scale * magic number
property real coneTopRadius: !transform ? 0.0 : (0.24023 / 2) * transform.scale3D.x * 0.7 // (diameter / 2) * scale * magic number

property real headLength:
{
if(!transform) return 0.0;
switch(meshType)
{
case MainView3D.NoMeshType: return 0;
Expand Down Expand Up @@ -232,14 +233,14 @@ Entity
{
id: panAnim
running: false
easing.type: Easing.Linear
easing.type: QQ2.Easing.Linear
}

QQ2.NumberAnimation on tiltRotation
{
id: tiltAnim
running: false
easing.type: Easing.Linear
easing.type: QQ2.Easing.Linear
}

property Texture2D depthTex:
Expand Down Expand Up @@ -292,7 +293,7 @@ Entity
id: goboAnim
running: false
duration: 0
easing.type: Easing.Linear
easing.type: QQ2.Easing.Linear
from: 0
to: 360
loops: QQ2.Animation.Infinite
Expand Down Expand Up @@ -323,7 +324,7 @@ Entity
{
id: eSceneLoader

onStatusChanged:
onStatusChanged: (status) =>
{
if (status === SceneLoader.Ready)
View3D.initializeFixture(itemID, fixtureEntity, eSceneLoader)
Expand All @@ -341,7 +342,7 @@ Entity

property var lastPos

onClicked:
onClicked: (pick) =>
{
console.log("3D item clicked")
isSelected = !isSelected
Expand Down
2 changes: 1 addition & 1 deletion qmlui/qml/fixturesfunctions/3DView/Generic3DItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Entity
id: eObjectPicker
dragEnabled: true

onClicked:
onClicked: (pick) =>
{
console.log("3D item clicked")
isSelected = !isSelected
Expand Down
6 changes: 3 additions & 3 deletions qmlui/qml/fixturesfunctions/3DView/MultiBeams3DItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ Entity
effect: sceneEffect

parameters: [
Parameter { name: "diffuse"; value: "gray" },
Parameter { name: "specular"; value: "black" },
Parameter { name: "diffuse"; value: Qt.color("gray") },
Parameter { name: "specular"; value: Qt.color("black") },
Parameter { name: "shininess"; value: 1.0 },
Parameter { name: "bloom"; value: 0 }
]
Expand Down Expand Up @@ -275,7 +275,7 @@ Entity

property var lastPos

onClicked:
onClicked: (pick) =>
{
console.log("3D item clicked")
isSelected = !isSelected
Expand Down
8 changes: 4 additions & 4 deletions qmlui/qml/fixturesfunctions/3DView/PixelBar3DItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ Entity
effect: sceneEffect

parameters: [
Parameter { name: "diffuse"; value: "gray" },
Parameter { name: "specular"; value: "black" },
Parameter { name: "diffuse"; value: Qt.color("gray") },
Parameter { name: "specular"; value: Qt.color("black") },
Parameter { name: "shininess"; value: 1.0 },
Parameter { name: "bloom"; value: 0 }
]
Expand Down Expand Up @@ -154,7 +154,7 @@ Entity
name: "diffuse"
value: Qt.rgba(lightColor.r * lightIntensity, lightColor.g * lightIntensity, lightColor.b * lightIntensity, 1)
},
Parameter { name: "specular"; value: "black" },
Parameter { name: "specular"; value: Qt.color("black") },
Parameter { name: "shininess"; value: 1.0 },
Parameter { name: "bloom"; value: 1 }
]
Expand All @@ -177,7 +177,7 @@ Entity

property var lastPos

onClicked:
onClicked: (pick) =>
{
console.log("3D item clicked")
isSelected = !isSelected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ LayerFilter
RenderPassFilter
{
id: geometryPass
matchAny: FilterKey { name: "pass"; value: { return fixtureItem.lightIntensity ? "shadows" : "invalid" } }
matchAny: FilterKey { name: "pass"; value: { return fixtureItem && fixtureItem.lightIntensity ? "shadows" : "invalid" } }

parameters: [
Parameter { name: "lightViewMatrix"; value: fixtureItem ? fixtureItem.lightViewMatrix : Qt.matrix4x4() },
Expand Down
2 changes: 1 addition & 1 deletion qmlui/qml/fixturesfunctions/3DView/SelectionEntity.qml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Entity

parameters: [
Parameter { name: "diffuse"; value: color },
Parameter { name: "specular"; value: "black" },
Parameter { name: "specular"; value: Qt.color("black") },
Parameter { name: "shininess"; value: 1.0 },
Parameter { name: "bloom"; value: 0 }
]
Expand Down
2 changes: 0 additions & 2 deletions qmlui/qml/fixturesfunctions/3DView/SelectionGeometry.qml
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,12 @@ GeometryRenderer
Buffer
{
id: vertexBuffer
type: Buffer.VertexBuffer
data: vertexBufferData()
}

Buffer
{
id: indexBuffer
type: Buffer.IndexBuffer
data: indexBufferData()
}

Expand Down
4 changes: 2 additions & 2 deletions qmlui/qml/fixturesfunctions/3DView/SpotlightConeEntity.qml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ Entity
property Entity fxItem: null

parameters: [
Parameter { name: "diffuse"; value: "blue" },
Parameter { name: "specular"; value: "black" },
Parameter { name: "diffuse"; value: Qt.color("blue") },
Parameter { name: "specular"; value: Qt.color("black") },
Parameter { name: "shininess"; value: 1.0 },
Parameter { name: "bloom"; value: 0 },

Expand Down
Loading

0 comments on commit 63f1ce2

Please sign in to comment.