Skip to content

Commit

Permalink
qml signal handlers - fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mlowczynski committed Dec 22, 2023
1 parent f9b13ae commit 6147354
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 34 deletions.
28 changes: 13 additions & 15 deletions qmlui/qml/IconButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -153,23 +153,21 @@ Button
}
}
]

MouseArea
}
MouseArea
{
id: ctrlMouseArea
anchors.fill: parent
onClicked:
{
if (control.checkable)
{
id: ctrlMouseArea
anchors.fill: parent
onClicked:
{
if (checkable)
{
control.toggle()
control.toggled()
}
else
control.clicked()
}
control.toggle()
control.toggled()
}
else
control.clicked()
}

}
}

9 changes: 5 additions & 4 deletions qmlui/qml/TreeNodeDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,11 @@ Column

drag.target: dragItem

onPressed: nodeContainer.mouseEvent(App.Pressed, cRef ? cRef.id : -1, nodeContainer.itemType,
nodeContainer, mouse.modifiers)
onClicked:
{
onPressed: function (mouse) {
nodeContainer.mouseEvent(App.Pressed, cRef ? cRef.id : -1, nodeContainer.itemType,
nodeContainer, mouse.modifiers)
}
onClicked: function (mouse) {
nodeLabel.forceActiveFocus()
nodeContainer.mouseEvent(App.Clicked, cRef ? cRef.id : -1, nodeContainer.itemType,
nodeContainer, mouse.modifiers)
Expand Down
3 changes: 1 addition & 2 deletions qmlui/qml/fixturesfunctions/2DView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,7 @@ Rectangle
drag.threshold: 10
drag.target: parent

onReleased:
{
onReleased: function (mouse) {
if (drag.active)
{
var units = View2D.gridUnits === MonitorProperties.Meters ? 1000.0 : 304.8
Expand Down
3 changes: 1 addition & 2 deletions qmlui/qml/fixturesfunctions/Fixture2DItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,7 @@ Rectangle
onEntered: fixtureLabel.visible = true
onExited: showLabel ? fixtureLabel.visible = true : fixtureLabel.visible = false

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

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

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

onContentLoaded:
{
onContentLoaded: function (item, ID) {
item.width = Qt.binding(function() { return leftSidePanel.width - collapseWidth })
item.height = Qt.binding(function() { return leftSidePanel.height })
}
Expand Down

0 comments on commit 6147354

Please sign in to comment.