MythTV master
mythvirtualkeyboard.h
Go to the documentation of this file.
1#ifndef MYTHUIVIRTUALKEYBOARD_H_
2#define MYTHUIVIRTUALKEYBOARD_H_
3
4#include "mythscreentype.h"
5
6class QKeyEvent;
7
9enum PopupPosition : std::uint8_t
10{
16};
17
19{
20 QString name;
21 QString type;
23 QString up, down, left, right;
24};
25
26#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
27class KeyEventDefinition
28{
29 public:
30 int key() const { return keyCode; };
31 Qt::KeyboardModifiers keyboardModifiers() const { return modifiers; };
32
33 int keyCode {0};
34 Qt::KeyboardModifiers modifiers;
35};
36#endif
37
49{
50 Q_OBJECT
51
52 public:
53 MythUIVirtualKeyboard(MythScreenStack *parentStack, MythUITextEdit *m_parentEdit);
54 ~MythUIVirtualKeyboard() override = default;
55 bool Create(void) override; // MythScreenType
56 bool keyPressEvent(QKeyEvent *e) override; // MythScreenType
57
58 signals:
59 void keyPressed(QString key);
60
61 protected slots:
62 void charClicked(void);
63 void shiftClicked(void);
64 void delClicked(void);
65 void lockClicked(void);
66 void altClicked(void);
67 void compClicked(void);
68 void moveleftClicked(void);
69 void moverightClicked(void);
70 void backClicked(void);
71 void returnClicked(void);
72
73 private:
74 void loadKeyDefinitions(const QString &lang);
75 void parseKey(const QDomElement &element);
76 void updateKeys(bool connectSignals = false);
77 static QString decodeChar(QString c);
78 QString getKeyText(const KeyDefinition& key) const;
79 static void loadEventKeyDefinitions(
80#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
81 KeyEventDefinition *keyDef,
82#else
83 QKeyCombination *keyDef,
84#endif
85 const QString &action);
86
87 MythUITextEdit *m_parentEdit {nullptr};
89
90 QMap<QString, KeyDefinition> m_keyMap;
91
92 MythUIButton *m_lockButton {nullptr};
93 MythUIButton *m_altButton {nullptr};
94 MythUIButton *m_compButton {nullptr};
95 MythUIButton *m_shiftLButton {nullptr};
96 MythUIButton *m_shiftRButton {nullptr};
97
98 bool m_shift {false};
99 bool m_alt {false};
100 bool m_lock {false};
101
102 bool m_composing {false};
104
105#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
106 KeyEventDefinition m_upKey;
107 KeyEventDefinition m_downKey;
108 KeyEventDefinition m_leftKey;
109 KeyEventDefinition m_rightKey;
110 KeyEventDefinition m_newlineKey;
111#else
112 QKeyCombination m_upKey;
113 QKeyCombination m_downKey;
114 QKeyCombination m_leftKey;
115 QKeyCombination m_rightKey;
116 QKeyCombination m_newlineKey;
117#endif
118};
119
120#endif
Screen in which all other widgets are contained and rendered.
virtual bool Create(void)
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
A single button widget.
Definition: mythuibutton.h:22
A text entry and edit widget.
A popup onscreen keyboard for easy alphanumeric and text entry using a remote control or mouse.
void keyPressed(QString key)
~MythUIVirtualKeyboard() override=default
QMap< QString, KeyDefinition > m_keyMap
QKeyCombination m_newlineKey
#define MUI_PUBLIC
Definition: mythuiexp.h:9
PopupPosition
Preferred position to place virtual keyboard popup.
@ VK_POSBOTTOMDIALOG
@ VK_POSCENTERDIALOG
@ VK_POSBELOWEDIT
@ VK_POSABOVEEDIT
@ VK_POSTOPDIALOG