Shouldn't on<PropertyName>Changed() signal pass the property value as parameter ?
In QML, a signal is created for every declared property.
I have not found in the documentation whether the signal (on<PropertyName>Changed) passes or not the new property value.
That would be convenient when connecting such signal with slots that don't know where the signal comes from.
I don't see any drawback to that option (besides naming scope).
Any thoughts ?
C++ property change signals pass the new property value, but QML property change signals do not. The C++ QSlider has a valueChanged(int) signal, but the QML Slider only has a valueChanged() signal.
I agree that it would be nice if QML signals are like C++ signals. I'm guessing that it has been designed this way because QML property change signal handlers are usually in the object that owns the property, so it's easy to access them anyway. It would be interesting to know how often these signals are connected to external objects.
You can bring this idea to Qt engineers my posting to https://bugreports.qt-project.org/ or http://lists.qt-project.org/mailman/listinfo/development (you need to create an account for the first one, and subscribe for the second one). However, I don't know if it's possible to make this change without breaking existing programs, and without cluttering QML objects with extra signals. Implementing this might have to wait until Qt 6.
Note: on<PropertyName>Changed() is the signal handler (slot). The signal is <propertyName>Changed()