diff options
Diffstat (limited to 'client/macro.cc')
-rw-r--r-- | client/macro.cc | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/client/macro.cc b/client/macro.cc index ec520f0..654557d 100644 --- a/client/macro.cc +++ b/client/macro.cc @@ -28,10 +28,22 @@ #include "builder.h" #include "sendrecieve.h" #include <QDomDocument> +#include <QApplication> + +#define MY_EVENT_ID 65432 + +class MyEvent : public QEvent { +public: + MyEvent(QString macro) : QEvent((QEvent::Type)MY_EVENT_ID) + { + this->macro = macro; + } + QString macro; +}; static QDomDocument xml_request(QString name); -void macro(QString name) +void create_macro(QString name) { // Build the XML request QDomDocument xml_req = xml_request(name); @@ -55,6 +67,26 @@ void macro(QString name) Builder *builder = new Builder(&xml_doc); } +bool MyEventHandler::eventFilter( QObject *o, QEvent *e ) +{ + + if ( e->type() == MY_EVENT_ID ) { + MyEvent *event = (MyEvent*)e; + create_macro(event->macro); + // ... DO SOMETHING WITH EVENT + return TRUE; // eat event + } else { + // standard event processing + return FALSE; + } +} + +void new_macro(QString macro) +{ + MyEvent *event = new MyEvent(macro); + qApp->postEvent(qApp, event); +} + static QDomDocument xml_request(QString name) { // Create the xml request array |