#include "cl_smoke_qt.h" #include #include #include /** @file * @brief Qt support functions */ #include static void terminate() { qFatal("caught an exception."); } extern "C" { /** Registers a callback to be invoked for every QEvent. * @see QCoreApplication::notifyInternal * * @param callback the callback * * @return @c true on success and @c false otherwise */ CL_SMOKE_QT_EXPORT int cl_smoke_register_event_notify(void* callback) { Q_ASSERT(callback); std::set_terminate(terminate); return QInternal::registerCallback(QInternal::EventNotifyCallback, reinterpret_cast(callback)); } /** Returns the most specific QMetaObject of the QObject instance @a object. * Used to determine the actual class of an object. Smoke can not be used since it calls the * metaObject() of the class the method was called for. * * @param object A QObject * * @return QMetaObject */ CL_SMOKE_QT_EXPORT void* cl_smoke_meta_object(void* object) { Q_ASSERT(object); static_cast(object)->metaObject(); } } // extern "C"