KTextEditor

keyparser.h
1 /*
2  SPDX-FileCopyrightText: 2008 Erlend Hamberg <[email protected]>
3  SPDX-FileCopyrightText: 2008 Evgeniy Ivanov <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef KATEVI_KEY_PARSER_H
9 #define KATEVI_KEY_PARSER_H
10 
11 #include <QChar>
12 #include <QHash>
13 #include <QString>
14 #include <ktexteditor_export.h>
15 
16 class QKeyEvent;
17 
18 namespace KateVi
19 {
24 class KTEXTEDITOR_EXPORT KeyParser
25 {
26 private:
27  KeyParser();
28 
29 public:
30  static KeyParser *self();
31  ~KeyParser()
32  {
33  m_instance = nullptr;
34  }
35  KeyParser(const KeyParser &) = delete;
36  KeyParser &operator=(const KeyParser &) = delete;
37 
38  const QString encodeKeySequence(const QString &keys) const;
39  const QString decodeKeySequence(const QString &keys) const;
40  QString qt2vi(int key) const;
41  int vi2qt(const QString &keypress) const;
42  int encoded2qt(const QString &keypress) const;
43  const QChar KeyEventToQChar(const QKeyEvent &keyEvent);
44 
45 private:
46  void initKeyTables();
47 
48  QHash<int, QString> m_qt2katevi;
49  QHash<QString, int> m_katevi2qt;
50  QHash<QString, int> m_nameToKeyCode;
51  QHash<int, QString> m_keyCodeToName;
52 
53  static KeyParser *m_instance;
54 };
55 
56 }
57 
58 #endif /* KATEVI_KEY_PARSER_H */
for encoding keypresses w/ modifiers into an internal QChar representation and back again to a descri...
Definition: keyparser.h:24
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Sep 23 2020 22:58:24 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.