15#include <rppqt/sources/fwd.hpp>
16#include <rpp/subjects/publish_subject.hpp>
20IMPLEMENTATION_FILE(from_signal_qt_tag);
22namespace rppqt::observable::details
24template<
typename Value>
28 using Subscriber =
decltype(std::declval<Subject>().get_subscriber());
31 : subscriber{subscriber} {}
34 : subscriber{std::move(subscriber)} {}
36 Subscriber subscriber;
39template<
typename... Args>
42 template<
typename ...Vals>
43 void operator()(Vals&&... vals)
const
52 template<rpp::constra
int::decayed_same_as<Arg> Val>
53 void operator()(Val&& val)
const
62 void operator()()
const
64 subscriber.on_next(rpp::utils::none{});
69namespace rppqt::observable
82template<std::derived_from<QObject> TSignalQObject, std::derived_from<TSignalQObject> TObject,
typename R,
typename ...Args>
83auto from_signal(
const TObject&
object, R (TSignalQObject::*signal)(Args...)) requires rpp::details::is_header_included<rpp::details::from_signal_qt_tag, TObject, R, Args...>
86 const auto subj =
typename on_next_impl::Subject{};
88 const auto subscriber = subj.get_subscriber();
89 QObject::connect(&
object, signal, on_next_impl{subscriber});
90 QObject::connect(&
object, &QObject::destroyed, [subscriber] { subscriber.on_completed(); });
92 return subj.get_observable();
Subject which just multicasts values to observers subscribed on it. It contains two parts: subscriber...
Definition: publish_subject.hpp:78
auto from_signal(const TObject &object, R(TSignalQObject::*signal)(Args...))
Creates rpp::specific_observable that emits a items from provided QT signal.
Definition: from_signal.hpp:83
Definition: from_signal.hpp:26
Definition: from_signal.hpp:41