2#include <qobjectdefs.h>
11template <
typename T,
typename... Args>
12QMetaObject::Connection con(
const T& t, Args&&... args)
14 return T::connect(&t, std::forward<Args>(args)...);
17template <
typename T,
typename Property,
typename U,
typename Slot,
typename... Args>
18QMetaObject::Connection
19bind(T& t,
const Property&,
const U* tgt, Slot&& slot, Args&&... args)
21 slot((t.*(Property::get))());
24 &t, Property::notify, tgt, std::forward<Slot>(slot), std::forward<Args>(args)...);
27template <
typename Entities,
typename Presenter>
28void bind(
const Entities& model, Presenter& presenter)
30 for(
auto& entity : model)
31 presenter.on_created(entity);
33 model.mutable_added.template connect<&Presenter::on_created>(presenter);
34 model.removed.template connect<&Presenter::on_removing>(presenter);