mcallegari / qlcplus

Q Light Controller Plus (QLC+) is a free and cross-platform software to control DMX or analog lighting systems like moving heads, dimmers, scanners etc. This project is a fork of the great QLC project written by Heikki Junnila that aims to continue the QLC development and to introduce new features.
Apache License 2.0
991 stars 356 forks source link

VC Click & Go Gobo control on limited-range knobs and sliders #1537

Closed hjtappe closed 5 months ago

hjtappe commented 6 months ago

Originally, I came from the v4 issue that having a gobo knot which is limited to values for static gobos only did not select the correct gobo values when clicking on the CnG Gobo entry.

Please find attached the simple workspace showing an example setup: "Midi" input (simulated on an Artnet universe) --> Range- limited knob --> Fixture

gobo-vc.qxw.txt

Along the way when also trying the example in v5, I cam across a few otherv5 knob / slider limitations which are fixed in this patch:

I think, the functionality only applies to the Gobo / CnGPresets CnG type, not the CngColors type. Please review if that is correct.

I hope this helps. Please review carefully as this is my first QML patch.

coveralls commented 6 months ago

Coverage Status

coverage: 32.077% (-0.004%) from 32.081% when pulling 22a5798c86aeecd21eeaee28e82bf0041fd8f265 on hjtappe:limited-gobo-control into 7e2ec932451b3beab6547a0c468928b6ac259536 on mcallegari:master.

mcallegari commented 6 months ago

@hjtappe thanks for this First comment: I saw you added a MosueArea to the Knob item just to handle mouse wheel. It seems Dial has a wheelEnabled property inherited from Control. Can you please try that? It would simplify the code

EDIT: I tested wheelEnable and it works OK. Just set stepSize to 1.0

hjtappe commented 6 months ago

Hello @mcallegari, yes, I also tried that in a first attempt. It saves a lot of MouseArea code.

+ wheelEnabled: true + stepSize: 1.0

It turns the knob, but it does not trigger the onMoved in VCSliderItem.qml or if I add this into QLCPlusKnob.qml.

- onMoved: if (sliderObj) sliderObj.value = value // position * 255 + onMoved: { + console.log("onMoved: " + value) + if (sliderObj) sliderObj.value = 23 //value // position * 255 + }

Consequently, it does not update the sliderObj.value and thus does not update the other connected sliders.

Do you have an idea what blocks the onMoved event?

I have no idea why this event is not triggered when the knob turns through the mouse wheel (but only when dragged).

onMoved was introduced in QtQuick.Controls 2.2 (Qt 5.9), but even updating the file to 2.2 does not seem to help.

mcallegari commented 6 months ago

We might have stumbled on a Qt bug, since onMoved works correctly with the Slider item. I tried onValueChanged and it works with mouse wheel. However I'm not sure if it has specific drawbacks. For sure it's not "interactive user move" but it involves also values changed programmatically.

hjtappe commented 6 months ago

I have now tried a few things to try to make it work and increased the imported version. But the onMoved might work only with a more recent QT version. So with onValueChanged it now works with less code, even though the event is triggered twice for each change. Nevertheless, in total, it should be faster to execute and works like this. Should we add some hint that this workaround might need attention in a later version?

mcallegari commented 5 months ago

@hjtappe unfortunately the qml part was not entirely ok The preset capability item referenced the slider object even when no slider was involved, so it broke all the usages outside the VC slider click & go one. Proper fix is to define the range low/high limit in the main preset tool and then determine the visibility of each capability at construction time. Can you please verify that my last change still works with C&G limited range? Thanks

hjtappe commented 5 months ago

@mcallegari thanks for your review and fix. I confirm that the current master works on v4 and v5 both on Windows and Linux AppImage.