2 #include <qobjectdefs.h>
11 template <
typename T,
typename... Args>
12 QMetaObject::Connection con(
const T& t, Args&&... args)
14 return T::connect(&t, std::forward<Args>(args)...);
17 template <
typename T,
typename Property,
typename U,
typename Slot,
typename... Args>
18 QMetaObject::Connection
19 bind(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)...);
27 template <
typename Entities,
typename Presenter>
28 void 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);