Sine Striker
2023-12-13 bbd0f1932fcf7a730d8ab9410e158f2b1035bc23
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
#ifndef EVENTFILTER_P_H
#define EVENTFILTER_P_H
 
#include <QtGui/QtEvents>
 
#include <QWKCore/qwkglobal.h>
 
namespace QWK {
 
    class EventDispatcher;
 
    class QWK_CORE_EXPORT EventObserver {
    public:
        EventObserver();
        virtual ~EventObserver();
 
    protected:
        virtual bool observe(QEvent *event) = 0;
 
    protected:
        EventDispatcher *m_dispatcher;
 
        Q_DISABLE_COPY(EventObserver)
 
        friend class EventDispatcher;
    };
 
    class QWK_CORE_EXPORT EventDispatcher {
    public:
        EventDispatcher();
        virtual ~EventDispatcher();
 
        virtual bool dispatch(QEvent *event);
 
    public:
        void addObserver(EventObserver *observer);
        void removeObserver(EventObserver *observer);
 
    protected:
        QVector<EventObserver *> m_observers;
 
        Q_DISABLE_COPY(EventDispatcher)
    };
 
}
 
#endif // EVENTFILTER_P_H