-
Notifications
You must be signed in to change notification settings - Fork 0
/
karbedo_app.h
49 lines (38 loc) · 1.19 KB
/
karbedo_app.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef KARBEDO_APP_H
#define KARBEDO_APP_H
#include <QApplication>
#include <QEvent>
#include <typeinfo>
#include <QDebug>
#include <parsingexception.h>
/**
* @class karbedo_app
* @brief Application with reimplemented notify() method.
*/
class karbedo_app final : public QApplication
{
Q_OBJECT
public:
karbedo_app(int &argc, char **argv) : QApplication(argc, argv) {}
/**
* @brief Handles some possible Event System exceptions.
* @param receiver - event receiving object.
* @param event - object delivered to the receiver.
*/
bool notify(QObject *receiver, QEvent *event) override
{
try {
return QApplication::notify(receiver, event);
} catch (QException &e) {
qDebug("Exception <%s>: sending event %s to %s <%s> failed",
e.what(), typeid(*event).name(), qPrintable(receiver->objectName()),
typeid(*receiver).name());
} catch (...) {
qDebug("Exception: sending event %s to %s <%s> failed",
typeid(*event).name(), qPrintable(receiver->objectName()),
typeid(*receiver).name());
}
return false;
}
};
#endif // KARBEDO_APP_H