feat: add signal handler for status-go

This commit is contained in:
Richard Ramos 2020-05-16 21:27:26 -04:00
parent 4d0d6a353c
commit 3ecf2595f1
No known key found for this signature in database
GPG Key ID: 80D4B01265FDFE8F
2 changed files with 11 additions and 0 deletions

View File

@ -90,6 +90,10 @@ DOS_API void DOS_CALL dos_qapplication_create(void);
/// \note A QApplication should have been already created through dos_qapplication_create()
DOS_API void DOS_CALL dos_qapplication_exec(void);
/// \brief Invokes a QObject's slot by passing a string containing a signal
/// \note This method was created because status-go has a non-QT event loop
DOS_API void DOS_CALL dos_signal(DosQObject *vptr, const char *signal, const char *slot);
/// \brief Calls the QApplication::quit() function of the current QGuiApplication
/// \note A QApplication should have been already created through dos_qapplication_create()
DOS_API void DOS_CALL dos_qapplication_quit(void);

View File

@ -28,6 +28,7 @@
#include <QtCore/QResource>
#include <QtGui/QGuiApplication>
#include <QtQml/QQmlContext>
#include <QtCore>
#include <QtQml/QQmlApplicationEngine>
#include <QtQuick/QQuickView>
#include <QtQuick/QQuickImageProvider>
@ -717,6 +718,12 @@ bool dos_qurl_isValid(const ::DosQUrl *vptr)
return new DOS::DosIQMetaObjectHolder(std::move(metaObject));
}
void dos_signal(::DosQObject *vptr, const char *signal, const char *slot) //
{
auto qobject = static_cast<QObject *>(vptr);
QMetaObject::invokeMethod(qobject, slot, Qt::QueuedConnection, Q_ARG(QString, signal));
}
void dos_qmetaobject_delete(::DosQMetaObject *vptr)
{
auto factory = static_cast<DOS::DosIQMetaObjectHolder *>(vptr);