Overte C++ Documentation
KeyEvent.h
1 //
2 // KeyEvent.h
3 // script-engine/src
4 //
5 // Created by Stephen Birarda on 2014-10-27.
6 // Copyright 2014 High Fidelity, Inc.
7 // Copyright 2023 Overte e.V.
8 //
9 // Distributed under the Apache License, Version 2.0.
10 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
11 // SPDX-License-Identifier: Apache-2.0
12 //
13 
16 
17 #ifndef hifi_KeyEvent_h
18 #define hifi_KeyEvent_h
19 
20 #include <QKeyEvent>
21 
22 #include "ScriptValue.h"
23 
24 class ScriptEngine;
25 
27 class KeyEvent {
28 public:
29  KeyEvent();
30  KeyEvent(const QKeyEvent& event);
31  bool operator==(const KeyEvent& other) const;
32  operator QKeySequence() const;
33 
34  static ScriptValue toScriptValue(ScriptEngine* engine, const KeyEvent& event);
35  static bool fromScriptValue(const ScriptValue& object, KeyEvent& event);
36 
37  int key;
38  QString text;
39  bool isShifted;
40  bool isControl;
41  bool isMeta;
42  bool isAlt;
43  bool isKeypad;
44  bool isValid;
45  bool isAutoRepeat;
46 };
47 
48 Q_DECLARE_METATYPE(KeyEvent)
49 
50 #endif // hifi_KeyEvent_h
51 
Represents a keyboard event to the scripting engine. Exposed as KeyEvent
Definition: KeyEvent.h:27
Provides an engine-independent interface for a scripting engine.
Definition: ScriptEngine.h:93
[ScriptInterface] Provides an engine-independent interface for QScriptValue
Definition: ScriptValue.h:40