MythTV  master
mythuitextedit.h
Go to the documentation of this file.
1 #ifndef MYTHUI_TEXTEDIT_H_
2 #define MYTHUI_TEXTEDIT_H_
3 
4 #include <QString>
5 #include <QClipboard>
6 
9 #include "libmythui/mythuitype.h"
11 
12 class QInputMethodEvent;
13 
14 class MythFontProperties;
15 class MythUIStateType;
16 class MythUIImage;
17 class MythUIText;
18 
20 {
21  FilterNone = 0x0,
22  FilterAlpha = 0x01,
23  FilterNumeric = 0x02,
25  FilterSymbols = 0x04,
26  FilterPunct = 0x08
27 };
28 
35 {
36  Q_OBJECT
37 
38  public:
39  MythUITextEdit(MythUIType *parent, const QString &name);
40  ~MythUITextEdit() override = default;
41 
42  void Pulse(void) override; // MythUIType
43  bool keyPressEvent(QKeyEvent *event) override; // MythUIType
44  bool inputMethodEvent(QInputMethodEvent *event) override; // MythUIType
45  bool gestureEvent(MythGestureEvent *event) override; // MythUIType
46  void Reset(void) override; // MythUIType
47 
48  void SetText(const QString &text, bool moveCursor = true);
49  void InsertText(const QString &text);
50  QString GetText(void) const { return m_message; }
51 
52  void SetFilter(InputFilter filter) { m_filter = filter; }
53  void SetPassword(bool isPassword) { m_isPassword = isPassword; }
54  void SetMaxLength(int length);
55 
56  enum MoveDirection { MoveLeft, MoveRight, MoveUp, MoveDown, MovePageUp, MovePageDown, MoveEnd };
57  bool MoveCursor(MoveDirection moveDir);
58 
59  void SetKeyboardPosition(PopupPosition pos) { m_keyboardPosition = pos; }
60  PopupPosition GetKeyboardPosition(void) { return m_keyboardPosition; }
61 
62  // StorageUser
63  void SetDBValue(const QString &text) override { SetText(text); } // StorageUser
64  QString GetDBValue(void) const override { return GetText(); } // StorageUser
65 
66  signals:
67  void valueChanged();
68 
69  public slots:
70  void Select();
71  void Deselect();
72 
73  protected:
74  bool ParseElement(const QString &filename, QDomElement &element,
75  bool showWarnings) override; // MythUIType
76  void CopyFrom(MythUIType *base) override; // MythUIType
77  void CreateCopy(MythUIType *parent) override; // MythUIType
78  void Finalize(void) override; // MythUIType
79 
80  void Init(void);
81  void SetInitialStates(void);
82 
83  bool InsertCharacter(const QString &character);
84  void RemoveCharacter(int position);
85 
86  void CutTextToClipboard(void);
87  void CopyTextToClipboard(void);
88  void PasteTextFromClipboard(QClipboard::Mode mode = QClipboard::Clipboard);
89  bool UpdateTmpString(const QString &str);
90 
92 
96 
98 
99  QString m_message;
102 
104 
106 
110 
112 
114  QString m_messageBak;
115 };
116 
117 #endif
FilterAlpha
@ FilterAlpha
Definition: mythuitextedit.h:22
MythUIType::keyPressEvent
virtual bool keyPressEvent(QKeyEvent *event)
Key event handler.
Definition: mythuitype.cpp:994
MythUITextEdit::m_position
int m_position
Definition: mythuitextedit.h:101
MythUITextEdit::m_keyboardPosition
PopupPosition m_keyboardPosition
Definition: mythuitextedit.h:105
MythUITextEdit::m_text
MythUIText * m_text
Definition: mythuitextedit.h:109
MythUITextEdit::m_initialized
bool m_initialized
Definition: mythuitextedit.h:91
FilterNone
@ FilterNone
Definition: mythuitextedit.h:21
MythUIImage
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:97
MythUIType::inputMethodEvent
virtual bool inputMethodEvent(QInputMethodEvent *event)
Input Method event handler.
Definition: mythuitype.cpp:1003
MUI_PUBLIC
#define MUI_PUBLIC
Definition: mythuiexp.h:9
MythUITextEdit::m_lastKeyPress
MythTimer m_lastKeyPress
Definition: mythuitextedit.h:95
MythUITextEdit::m_backgroundState
MythUIStateType * m_backgroundState
Definition: mythuitextedit.h:107
MythTimer
A QElapsedTimer based timer to replace use of QTime as a timer.
Definition: mythtimer.h:13
MythUITextEdit::m_isIMEinput
bool m_isIMEinput
Definition: mythuitextedit.h:113
MythUITextEdit::m_maxLength
int m_maxLength
Definition: mythuitextedit.h:97
MythUITextEdit
A text entry and edit widget.
Definition: mythuitextedit.h:34
InputFilter
InputFilter
Definition: mythuitextedit.h:19
MythUITextEdit::GetText
QString GetText(void) const
Definition: mythuitextedit.h:50
MythUITextEdit::SetDBValue
void SetDBValue(const QString &text) override
Definition: mythuitextedit.h:63
MythUIType::Pulse
virtual void Pulse(void)
Pulse is called 70 times a second to trigger a single frame of an animation.
Definition: mythuitype.cpp:457
MythUIType::CreateCopy
virtual void CreateCopy(MythUIType *parent)
Copy the state of this widget to the one given, it must be of the same type.
Definition: mythuitype.cpp:1233
MythUITextEdit::m_isPassword
bool m_isPassword
Definition: mythuitextedit.h:103
mythvirtualkeyboard.h
FilterNumeric
@ FilterNumeric
Definition: mythuitextedit.h:23
MythUITextEdit::m_blinkInterval
int m_blinkInterval
Definition: mythuitextedit.h:93
MythFontProperties
Definition: mythfontproperties.h:13
FilterPunct
@ FilterPunct
Definition: mythuitextedit.h:26
FilterSymbols
@ FilterSymbols
Definition: mythuitextedit.h:25
MythUITextEdit::m_composeKey
int m_composeKey
Definition: mythuitextedit.h:111
MythUITextEdit::SetPassword
void SetPassword(bool isPassword)
Definition: mythuitextedit.h:53
MythUIType::CopyFrom
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
Definition: mythuitype.cpp:1176
MythUITextEdit::m_messageBak
QString m_messageBak
Definition: mythuitextedit.h:114
MythUITextEdit::SetFilter
void SetFilter(InputFilter filter)
Definition: mythuitextedit.h:52
MythUIType::Reset
virtual void Reset(void)
Reset the widget to it's original state, should not reset changes made by the theme.
Definition: mythuitype.cpp:74
MythUITextEdit::m_filter
InputFilter m_filter
Definition: mythuitextedit.h:100
MythUIType
The base class on which all widgets and screens are based.
Definition: mythuitype.h:85
MythUITextEdit::GetKeyboardPosition
PopupPosition GetKeyboardPosition(void)
Definition: mythuitextedit.h:60
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
MythUITextEdit::SetKeyboardPosition
void SetKeyboardPosition(PopupPosition pos)
Definition: mythuitextedit.h:59
MythUITextEdit::m_cursorImage
MythUIImage * m_cursorImage
Definition: mythuitextedit.h:108
MythUIType::gestureEvent
virtual bool gestureEvent(MythGestureEvent *event)
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
Definition: mythuitype.cpp:1018
MythUITextEdit::MoveDirection
MoveDirection
Definition: mythuitextedit.h:56
mythtimer.h
MythUITextEdit::MoveUp
@ MoveUp
Definition: mythuitextedit.h:56
MythGestureEvent
A custom event that represents a mouse gesture.
Definition: mythgesture.h:39
MythUITextEdit::m_cursorBlinkRate
int m_cursorBlinkRate
Definition: mythuitextedit.h:94
PopupPosition
PopupPosition
Preferred position to place virtual keyboard popup.
Definition: mythvirtualkeyboard.h:9
MythUIType::ParseElement
virtual bool ParseElement(const QString &filename, QDomElement &element, bool showWarnings)
Parse the xml definition of this widget setting the state of the object accordingly.
Definition: mythuitype.cpp:1242
mythstorage.h
build_compdb.filename
filename
Definition: build_compdb.py:21
MythUITextEdit::GetDBValue
QString GetDBValue(void) const override
Definition: mythuitextedit.h:64
MythUITextEdit::m_message
QString m_message
Definition: mythuitextedit.h:99
FilterAlphaNumeric
@ FilterAlphaNumeric
Definition: mythuitextedit.h:24
MythUIStateType
This widget is used for grouping other widgets for display when a particular named state is called....
Definition: mythuistatetype.h:22
MythUIType::Finalize
virtual void Finalize(void)
Perform any post-xml parsing initialisation tasks.
Definition: mythuitype.cpp:1318
mythuitype.h
StorageUser
Definition: mythstorage.h:15