Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
6.5.0 Beta3
-
None
Description
QPropertyNotifier is counterpart of type-erased QPropertyChangeHandler<T>.
Since QPropertyNotifier is implemented using std::function<void()> which can contain any functor type of QPropertyChangeHandler<T>, it is very obvious how to construct QPropertyNotifier from QPropertyChangeHandler<T>.
However, this cannot be done userside because those handler data area private.
For now, there does not exist counter part of subscribe() which returns QPropertyNotifier while onValueChanged() and addNotifier() are symmetric, and this is very inconvenient.
I think prividing implicit conversion from QPropertyChangeHandler<T> to QPropertyNotifier is best rather than adding counter part for type-erased version of subscribe().
Then, you can deprecate addNotifier() because one can use QPropertyNotifier explicity instead of auto if he or she wants to store type-erased handler, for instance,
this->notifiers.push_back(p1.onValueChanged(...)); this->notifiers.push_back(p2.subscribe(...));