Sayonara Player
Loading...
Searching...
No Matches
EventFilter.h
1/* EventFilter.h */
2
3/* Copyright (C) 2011-2024 Michael Lugmair (Lucio Carreras)
4 *
5 * This file is part of sayonara player
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef EVENTFILTER_H
22#define EVENTFILTER_H
23
24#include <QObject>
25#include <QEvent>
26#include <QList>
27
28class QAction;
29class QMouseEvent;
30
31namespace Gui
32{
38 public QObject
39 {
40 Q_OBJECT
41
42 signals:
43 void sigEvent(QEvent::Type);
44
45 private:
46 QList<QEvent::Type> m_types;
47
48 public:
49 explicit GenericFilter(const QEvent::Type& type, QObject* parent = nullptr);
50 explicit GenericFilter(const QList<QEvent::Type>& types, QObject* parent = nullptr);
51
52 protected:
53 bool eventFilter(QObject* o, QEvent* e);
54 };
55
61 public QObject
62 {
63 Q_OBJECT
64
65 public:
66 explicit KeyPressFilter(QObject* parent = nullptr);
67
68 signals:
69 void setKeyPressed(int key);
70
71 protected:
72 bool eventFilter(QObject* o, QEvent* e);
73 };
74
80 public QObject
81 {
82 Q_OBJECT
83
84 public:
85 explicit ContextMenuFilter(QObject* parent = nullptr);
86
87 signals:
88 // directly connect this signal to QMenu::popup
89 void sigContextMenu(const QPoint& p, QAction* action);
90
91 protected:
92 bool eventFilter(QObject* o, QEvent* e);
93 };
94
100 public QObject
101 {
102 Q_OBJECT
103
104 public:
105 explicit MouseMoveFilter(QObject* parent = nullptr);
106
107 signals:
108 void sigMouseMoved(QMouseEvent* e);
109
110 protected:
111 bool eventFilter(QObject* o, QEvent* e);
112 };
113
119 public QObject
120 {
121 Q_OBJECT
122
123 public:
124 explicit MousePressedFilter(QObject* parent = nullptr);
125
126 signals:
127 void sigMousePressed(QMouseEvent* e);
128
129 protected:
130 bool eventFilter(QObject* o, QEvent* e);
131 };
132
138 public QObject
139 {
140 Q_OBJECT
141
142 public:
143 explicit MouseReleasedFilter(QObject* parent = nullptr);
144
145 signals:
146 void sigMouseReleased(QMouseEvent* e);
147
148 protected:
149 bool eventFilter(QObject* o, QEvent* e);
150 };
151
157 public QObject
158 {
159 Q_OBJECT
160
161 public:
162 explicit MouseEnterFilter(QObject* parent = nullptr);
163
164 signals:
165 void sigMouseEntered();
166
167 protected:
168 bool eventFilter(QObject* o, QEvent* e);
169 };
170
176 public QObject
177 {
178 Q_OBJECT
179
180 public:
181 explicit MouseLeaveFilter(QObject* parent = nullptr);
182
183 signals:
184 void sigMouseLeft();
185
186 protected:
187 bool eventFilter(QObject* o, QEvent* e);
188 };
189
195 public QObject
196 {
197 Q_OBJECT
198
199 public:
200 explicit HideFilter(QObject* parent = nullptr);
201
202 signals:
203 void sigHidden();
204
205 protected:
206 bool eventFilter(QObject* o, QEvent* e);
207 };
208
214 public QObject
215 {
216 Q_OBJECT
217
218 public:
219 explicit ShowFilter(QObject* parent = nullptr);
220
221 signals:
222 void sigShown();
223
224 protected:
225 bool eventFilter(QObject* o, QEvent* e);
226 };
227
233 public QObject
234 {
235 Q_OBJECT
236
237 public:
238 explicit ResizeFilter(QObject* parent = nullptr);
239
240 signals:
241 void sigResized(const QSize& newSize);
242
243 protected:
244 bool eventFilter(QObject* o, QEvent* e);
245 };
246
252 public QObject
253 {
254 Q_OBJECT
255
256 public:
257 explicit PaintFilter(QObject* parent = nullptr);
258
259 signals:
260 void sigPainted();
261
262 protected:
263 bool eventFilter(QObject* o, QEvent* e);
264 };
265}
266
267#endif // EVENTFILTER_H
The ContextMenuFilter class.
Definition EventFilter.h:81
The GenericFilter class.
Definition EventFilter.h:39
The HideFilter class.
Definition EventFilter.h:196
The KeyPressFilter class.
Definition EventFilter.h:62
The MouseEnterFilter class.
Definition EventFilter.h:158
The MouseLeaveFilter class.
Definition EventFilter.h:177
The MouseMoveFilter class.
Definition EventFilter.h:101
The MouseMoveFilter class.
Definition EventFilter.h:120
The MouseMoveFilter class.
Definition EventFilter.h:139
The PaintFilter class.
Definition EventFilter.h:253
The ShowFilter class.
Definition EventFilter.h:234
The ShowFilter class.
Definition EventFilter.h:215
Definition EngineUtils.h:33