Skip to content

Commit

Permalink
make qml handlers functions consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
mlowczynski committed May 2, 2024
1 parent 8ff40aa commit 51c3031
Show file tree
Hide file tree
Showing 26 changed files with 49 additions and 49 deletions.
2 changes: 1 addition & 1 deletion qmlui/qml/+qt5/ActionsMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Popup

property string action: ""

onClicked: function (role) {
onClicked: (role) => {
if (role === Dialog.Yes)
{
if (qlcplus.fileName())
Expand Down
2 changes: 1 addition & 1 deletion qmlui/qml/ActionsMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Popup

property string action: ""

onClicked: function (role) {
onClicked: (role) => {
if (role === Dialog.Yes)
{
if (qlcplus.fileName())
Expand Down
4 changes: 2 additions & 2 deletions qmlui/qml/CustomDoubleSpinBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ CustomSpinBox
top: Math.max(controlRoot.from, controlRoot.to)
}

textFromValue: function(value, locale) {
textFromValue: (value, locale) => {
return Number(value / Math.pow(10, decimals)).toLocaleString(locale, 'f', decimals) + suffix
}

valueFromText: function(text, locale) {
valueFromText: (text, locale) => {
return Number.fromLocaleString(locale, text.replace(suffix, "")) * Math.pow(10, decimals)
}

Expand Down
4 changes: 2 additions & 2 deletions qmlui/qml/CustomSpinBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ SpinBox
if (focus) contentItem.selectAll()
}

textFromValue: function(value) {
textFromValue: (value) => {
return value + suffix
}

valueFromText: function(text) {
valueFromText: (text) => {
return parseInt(text.replace(suffix, ""))
}

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,13 +103,13 @@ Rectangle

drag.target: dragItem

onPressed: function(mouse) {
onPressed: (mouse) => {
funcDelegate.mouseEvent(App.Pressed, cRef.id, cRef.type, funcDelegate, mouse.modifiers)
}
onClicked: function(mouse) {
onClicked: (mouse) => {
funcDelegate.mouseEvent(App.Clicked, cRef.id, cRef.type, funcDelegate, mouse.modifiers)
}
onDoubleClicked: function(mouse) {
onDoubleClicked: (mouse) => {
funcDelegate.mouseEvent(App.DoubleClicked, cRef.id, cRef.type, funcDelegate, mouse.modifiers)
}
}
Expand Down
4 changes: 2 additions & 2 deletions 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: function (fixtureID, channelIndex, value) {
onValueChanged: (fixtureID, channelIndex, value) => {
simpleDesk.setValue(fixtureID, channelIndex, value)
}
}
Expand Down Expand Up @@ -87,7 +87,7 @@ Rectangle
padding: 0
model: simpleDesk.universesListModel
currValue: simpleDesk.universeFilter
onValueChanged: function (value) {
onValueChanged: (value) => {
simpleDesk.universeFilter = value
}
}
Expand Down
4 changes: 2 additions & 2 deletions qmlui/qml/TreeNodeDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ Column

drag.target: dragItem

onPressed: function (mouse) {
onPressed: (mouse) => {
nodeContainer.mouseEvent(App.Pressed, cRef ? cRef.id : -1, nodeContainer.itemType,
nodeContainer, mouse.modifiers)
}
onClicked: function (mouse) {
onClicked: (mouse) => {
nodeLabel.forceActiveFocus()
nodeContainer.mouseEvent(App.Clicked, cRef ? cRef.id : -1, nodeContainer.itemType,
nodeContainer, mouse.modifiers)
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: function (mouse) {
onPressed: (mouse) => {
console.log("button: " + mouse.button + ", mods: " + mouse.modifiers)
var itemID = View2D.itemIDAtPos(Qt.point(mouse.x, mouse.y))

Expand Down Expand Up @@ -255,7 +255,7 @@ Rectangle
}
}

onPositionChanged: function (mouse) {
onPositionChanged: (mouse) => {
if (selectionRect.visible == true)
{
if (mouse.x !== initialXPos || mouse.y !== initialYPos)
Expand Down Expand Up @@ -292,7 +292,7 @@ Rectangle
}
}

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

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

onReleased: function (mouse) {
onReleased: (mouse) => {
if (drag.active)
{
var units = View2D.gridUnits === MonitorProperties.Meters ? 1000.0 : 304.8
Expand Down
6 changes: 3 additions & 3 deletions qmlui/qml/fixturesfunctions/3DView/3DView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -372,14 +372,14 @@ Rectangle
property int selGenericCount: View3D.genericSelectedCount

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

onPositionChanged: function (mouse) {
onPositionChanged: (mouse) => {
if (directionCounter < 3)
{
dx += (Math.abs(mouse.x - startPoint.x))
Expand Down Expand Up @@ -474,7 +474,7 @@ Rectangle
startPoint = Qt.point(mouse.x, mouse.y)
}

onWheel: function (wheel) {
onWheel: (wheel) => {
if (wheel.angleDelta.y > 0)
viewCamera.setZoom(-1)
else
Expand Down
4 changes: 2 additions & 2 deletions qmlui/qml/fixturesfunctions/3DView/Fixture3DItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ Entity
{
id: eSceneLoader

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

property var lastPos

onClicked: function (pick) {
onClicked: (pick) => {
console.log("3D item clicked")
isSelected = !isSelected
contextManager.setItemSelection(itemID, isSelected, pick.modifiers)
Expand Down
4 changes: 2 additions & 2 deletions qmlui/qml/fixturesfunctions/3DView/Generic3DItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Entity
{
id: eSceneLoader

onStatusChanged: function (status) {
onStatusChanged: (status) => {
if (status === SceneLoader.Ready)
View3D.initializeItem(itemID, genericEntity, eSceneLoader)
}
Expand All @@ -54,7 +54,7 @@ Entity
id: eObjectPicker
dragEnabled: true

onClicked: function (pick) {
onClicked: (pick) => {
console.log("3D item clicked")
isSelected = !isSelected
View3D.setItemSelection(itemID, isSelected, pick.modifiers)
Expand Down
2 changes: 1 addition & 1 deletion qmlui/qml/fixturesfunctions/3DView/MultiBeams3DItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ Entity

property var lastPos

onClicked: function (pick) {
onClicked: (pick) => {
console.log("3D item clicked")
isSelected = !isSelected
contextManager.setItemSelection(itemID, isSelected, pick.modifiers)
Expand Down
4 changes: 2 additions & 2 deletions qmlui/qml/fixturesfunctions/3DView/PixelBar3DItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Entity
id: headsRepeater
//model: fixtureEntity.headsNumber

onObjectAdded: function (index, object) {
onObjectAdded: (index, object) => {
console.log("Head " + index + " added ----------------")
if (index == fixtureEntity.headsNumber - 1)
View3D.initializeFixture(itemID, fixtureEntity, null)
Expand Down Expand Up @@ -166,7 +166,7 @@ Entity

property var lastPos

onClicked: function (pick) {
onClicked: (pick) => {
console.log("3D item clicked")
isSelected = !isSelected
contextManager.setItemSelection(itemID, isSelected, pick.modifiers)
Expand Down
8 changes: 4 additions & 4 deletions qmlui/qml/fixturesfunctions/3DView/StageBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Entity
ObjectPicker
{
id: groundPicker
onClicked: function(pick) {
onClicked: (pick) => {
contextManager.setPositionPickPoint(pick.worldIntersection)
}
}
Expand All @@ -100,7 +100,7 @@ Entity
ObjectPicker
{
id: leftPicker
onClicked: function (pick) {
onClicked: (pick) => {
contextManager.setPositionPickPoint(pick.worldIntersection)
}
}
Expand All @@ -123,7 +123,7 @@ Entity
ObjectPicker
{
id: rightPicker
onClicked: function (pick) {
onClicked: (pick) => {
contextManager.setPositionPickPoint(pick.worldIntersection)
}
}
Expand All @@ -146,7 +146,7 @@ Entity
ObjectPicker
{
id: backPicker
onClicked: function (pick) {
onClicked: (pick) => {
contextManager.setPositionPickPoint(pick.worldIntersection)
}
}
Expand Down
2 changes: 1 addition & 1 deletion qmlui/qml/fixturesfunctions/3DView/StageRock.qml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ Entity
ObjectPicker
{
id: stagePicker
onClicked: function (pick) {
onClicked: (pick) => {
contextManager.setPositionPickPoint(pick.worldIntersection)
}
}
Expand Down
2 changes: 1 addition & 1 deletion qmlui/qml/fixturesfunctions/3DView/StageSimple.qml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Entity
ObjectPicker
{
id: stagePicker
onClicked: function (pick) {
onClicked: (pick) => {
contextManager.setPositionPickPoint(pick.worldIntersection)
}
}
Expand Down
2 changes: 1 addition & 1 deletion qmlui/qml/fixturesfunctions/3DView/StageTheatre.qml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ Entity
ObjectPicker
{
id: stagePicker
onClicked: function (pick) {
onClicked: (pick) => {
contextManager.setPositionPickPoint(pick.worldIntersection)
}
}
Expand Down
2 changes: 1 addition & 1 deletion qmlui/qml/fixturesfunctions/Fixture2DItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ Rectangle
onEntered: fixtureLabel.visible = true
onExited: showLabel ? fixtureLabel.visible = true : fixtureLabel.visible = false

onPressed: function (mouse) {
onPressed: (mouse) => {
// do not accept this event to propagate it to the drag rectangle
mouse.accepted = false
}
Expand Down
4 changes: 2 additions & 2 deletions qmlui/qml/fixturesfunctions/FixtureBrowser.qml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Rectangle
width: modelsList.width - (manufScroll.visible ? manufScroll.width : 0)
isManufacturer: true
textLabel: modelData
onMouseEvent: function (type, iID, iType, qItem, mouseMods) {
onMouseEvent: (type, iID, iType, qItem, mouseMods) => {
if (type == App.Clicked)
{
mfText.label = modelData
Expand Down Expand Up @@ -238,7 +238,7 @@ Rectangle
manufacturer: fixtureBrowser.selectedManufacturer
textLabel: modelData

onMouseEvent: function (type, iID, iType, qItem, mouseMods) {
onMouseEvent: (type, iID, iType, qItem, mouseMods) => {
if (type == App.Clicked)
{
modelsList.currentIndex = index
Expand Down
8 changes: 4 additions & 4 deletions qmlui/qml/fixturesfunctions/FixtureBrowserDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -111,25 +111,25 @@ Item
id: fxMouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: function (mouse) {
onClicked: (mouse) => {
fxDraggableItem.mouseEvent(App.Clicked, 0, 0, fxDraggableItem, mouse.modifiers)
}
drag.target: FixtureDragItem { }
drag.threshold: 30

onPressed: function (mouse) {
onPressed: (mouse) => {
if (fxDraggableItem.isManufacturer == false)
{
fxDraggableItem.mouseEvent(App.Clicked, 0, 0, fxDraggableItem, mouse.modifiers)
forceActiveFocus()
FxDragJS.initProperties()
}
}
onPositionChanged: function (mouse) {
onPositionChanged: (mouse) => {
if (fxDraggableItem.isManufacturer == false && drag.active == true)
FxDragJS.handleDrag(mouse)
}
onReleased: function (mouse) {
onReleased: (mouse) => {
if (fxDraggableItem.isManufacturer == false && drag.active == true)
FxDragJS.endDrag(mouse)
}
Expand Down
2 changes: 1 addition & 1 deletion qmlui/qml/fixturesfunctions/LeftPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ SidePanel
anchors.leftMargin: 0
panelAlignment: Qt.AlignLeft

onContentLoaded: function (item, ID) {
onContentLoaded: (item, ID) => {
item.width = Qt.binding(function() { return leftSidePanel.width - collapseWidth })
item.height = Qt.binding(function() { return leftSidePanel.height })
}
Expand Down
2 changes: 1 addition & 1 deletion qmlui/qml/fixturesfunctions/RightPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ SidePanel
animatePanel(true)
}

onContentLoaded: function(item, ID) {
onContentLoaded: (item, ID) => {
if (item.hasOwnProperty("functionID"))
item.functionID = itemID
}
Expand Down
2 changes: 1 addition & 1 deletion qmlui/qml/fixturesfunctions/SceneEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Rectangle
id: toolbar
visible: !boundToSequence
text: sceneEditor ? sceneEditor.functionName : ""
onTextChanged: function(text) {
onTextChanged: (text) => {
sceneEditor.functionName = text
}

Expand Down
2 changes: 1 addition & 1 deletion qmlui/qml/popup/CustomPopupDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Dialog

contentItem.implicitHeight: UISettings.iconSizeDefault

onClicked: function (button) {
onClicked: (button) => {
if (button === standardButton(Dialog.Yes))
control.clicked(Dialog.Yes)
else if (button === standardButton(Dialog.No))
Expand Down
2 changes: 1 addition & 1 deletion qmlui/qml/showmanager/HeaderAndCursor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ Rectangle
{
enabled: showTimeMarkers
anchors.fill: parent
onClicked: function (mouse) {
onClicked: (mouse) => {
tlHeaderCursorLayer.clicked(mouse.x, mouse.y)
}
}
Expand Down
Loading

0 comments on commit 51c3031

Please sign in to comment.