Details
-
Technical task
-
Resolution: Won't Do
-
P3: Somewhat important
-
None
-
None
-
None
Description
QProperty (or rather QPropertyValueStorage) uses operator== to compare the new and the old value (for instance in setValueAndReturnTrueIfChanged). While this is fine in most cases, there are some where this behavior is questionable: Consider for instance QProperty<float>. When comparing floating point numbers, we often do not want strict equality, but rather the behaviour of qFuzzyCompare.
Currently the only way to support custom comparisons for the type T in QProperty<T> is to create a wrapper struct around T, and to give it a comparison operator with the desired properties. However, the property does not return and take T in that case, but aforementioned wrapper, causing issues down the line.
As a way to avoid this, we might want to add a comparison policy template parameter to QProperty.