12 #include <source_location> 21 using std::runtime_error::runtime_error;
26 [[noreturn, gnu::cold, gnu::noinline]]
33 template<
typename Target, std::derived_from<QObject> Src>
34 requires (!std::is_pointer_v<Target>)
35 decltype (auto) qobject_ref_cast (Src *obj,
std::source_location
loc =
std::source_location::current ())
37 if (
const auto result = qobject_cast<Target*> (obj))
43 template<
typename Target, std::derived_from<QObject> Src>
44 requires (!std::is_pointer_v<Target>)
45 decltype (
auto) qobject_ref_cast (Src& obj,
std::source_location
loc =
std::source_location::current ())
47 return qobject_ref_cast<Target> (&obj,
loc);
void NotifyCastError(const QObject *object, const char *target, const std::source_location &loc)
requires(!std::is_pointer_v< Target >) decltype(auto) qobject_ref_cast(Src *obj