Open-Typer
Open source typewriting tutor program
Loading...
Searching...
No Matches
KeyEvent.h
1/*
2 * KeyEvent.h
3 * This file is part of Open-Typer
4 *
5 * Copyright (C) 2023 - adazem009
6 *
7 * Open-Typer 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 2 of the License, or
10 * (at your option) any later version.
11 *
12 * Open-Typer 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 Open-Typer. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef KEYEVENT_H
22#define KEYEVENT_H
23
24#include <QObject>
25
26class QKeyEvent;
27
29{
30 Q_GADGET
31 Q_PROPERTY(Qt::Key key READ key)
32 Q_PROPERTY(QString text READ text)
33 Q_PROPERTY(Qt::KeyboardModifiers modifiers READ modifiers)
34 Q_PROPERTY(bool autoRepeat READ isAutoRepeat)
35 Q_PROPERTY(quint32 nativeScanCode READ nativeScanCode)
36 Q_PROPERTY(quint32 nativeVirtualKey READ nativeVirtualKey)
37 Q_PROPERTY(bool rightShift READ rightShift WRITE setRightShift)
38 public:
39 KeyEvent(Qt::Key key = Qt::Key_unknown, Qt::KeyboardModifiers modifiers = Qt::NoModifier, quint32 nativeScanCode = 0, quint32 nativeVirtualKey = 0, const QString &text = QString());
40 KeyEvent(QKeyEvent *keyEvent);
41
42 Qt::Key key() const;
43 const QString &text() const;
44 Qt::KeyboardModifiers modifiers() const;
45 bool isAutoRepeat() const;
46 quint32 nativeScanCode() const;
47 quint32 nativeVirtualKey() const;
48
49 bool rightShift() const;
50 void setRightShift(bool newRightShift);
51
52 private:
53 Qt::Key m_key = Qt::Key_unknown;
54 QString m_text;
55 Qt::KeyboardModifiers m_modifiers = Qt::NoModifier;
56 bool m_autoRepeat = false;
57 quint32 m_nativeScanCode = 0;
58 quint32 m_nativeVirtualKey = 0;
59 bool m_rightShift = false;
60};
61
62#endif // KEYEVENT_H
Definition KeyEvent.h:29