Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-111865

Add conversion QPropertyChangeHandler<T> to QPropertyNotifier

    XMLWordPrintable

Details

    • All

    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(...));
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            fabiankosmale Fabian Kosmale
            xylosper Byoung-young Lee
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes