Sayonara Player
Loading...
Searching...
No Matches
src
Gui
Utils
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
28
class
QAction;
29
class
QMouseEvent;
30
31
namespace
Gui
32
{
37
class
GenericFilter :
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
60
class
KeyPressFilter :
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
79
class
ContextMenuFilter :
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
99
class
MouseMoveFilter :
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
118
class
MousePressedFilter :
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
137
class
MouseReleasedFilter :
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
156
class
MouseEnterFilter :
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
175
class
MouseLeaveFilter :
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
194
class
HideFilter :
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
213
class
ShowFilter :
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
232
class
ResizeFilter :
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
251
class
PaintFilter :
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
QList
Definition
EngineUtils.h:33
Generated on Wed Apr 23 2025 00:00:00 for Sayonara Player by
1.13.2