MythTV  master
mythuitextedit.cpp
Go to the documentation of this file.
1 // Own header
2 #include "mythuitextedit.h"
3 
4 // QT headers
5 #include <QApplication>
6 #include <QChar>
7 #include <QKeyEvent>
8 #include <QDomDocument>
9 #include <QInputMethodEvent>
10 #include <Qt>
11 
12 // libmythbase headers
13 #include "libmythbase/mythdb.h"
15 
16 // MythUI headers
17 #include "mythpainter.h"
18 #include "mythmainwindow.h"
19 #include "mythfontproperties.h"
20 #include "mythuihelper.h"
21 #include "mythgesture.h"
22 #include "mythuitext.h"
23 #include "mythuistatetype.h"
24 #include "mythuiimage.h"
25 
26 #define LOC QString("MythUITextEdit: ")
27 
28 MythUITextEdit::MythUITextEdit(MythUIType *parent, const QString &name)
29  : MythUIType(parent, name)
30 {
31  m_message = "";
33 
34  m_isPassword = false;
35 
36  m_blinkInterval = 0;
37  m_cursorBlinkRate = 40;
38 
39  m_position = -1;
40 
41  m_maxLength = 255;
42 
43  m_backgroundState = nullptr;
44  m_cursorImage = nullptr;
45  m_text = nullptr;
46 
48 
49  connect(this, &MythUIType::TakingFocus, this, &MythUITextEdit::Select);
50  connect(this, &MythUIType::LosingFocus, this, &MythUITextEdit::Deselect);
51 
52  m_canHaveFocus = true;
53 
54  m_initialized = false;
55 
57 
58  m_composeKey = 0;
59 
60  m_messageBak.clear();
61  m_isIMEinput = false;
62 }
63 
65 {
67  LOG(VB_GENERAL, LOG_ERR, LOC + "selected state doesn't exist");
68 }
69 
71 {
73  LOG(VB_GENERAL, LOG_ERR, LOC + "active state doesn't exist");
74 }
75 
77 {
78  SetText("");
79 }
80 
82 {
83  if (!m_cursorImage)
84  return;
85 
86  if (m_hasFocus)
87  {
88  if (m_lastKeyPress.elapsed() < 500ms)
89  {
91  m_blinkInterval = 0;
92  }
94  {
95  m_blinkInterval = 0;
96 
97  if (m_cursorImage->IsVisible())
98  m_cursorImage->SetVisible(false);
99  else
100  m_cursorImage->SetVisible(true);
101  }
102 
103  m_blinkInterval++;
104  }
105  else
106  m_cursorImage->SetVisible(false);
107 
109 }
110 
112  const QString &filename, QDomElement &element, bool showWarnings)
113 {
114  bool parsed = true;
115 
116  if (element.tagName() == "area")
117  {
118  SetArea(parseRect(element));
119  }
120  else if (element.tagName() == "keyboardposition")
121  {
122  QString pos = getFirstText(element);
123 
124  if (pos == "aboveedit")
126  else if (pos == "belowedit")
128  else if (pos == "screentop")
130  else if (pos == "screenbottom")
132  else if (pos == "screencenter")
134  else
135  {
136  VERBOSE_XML(VB_GENERAL, LOG_ERR, filename, element,
137  QString("Unknown popup position '%1'").arg(pos));
139  }
140  }
141  else
142  {
143  return MythUIType::ParseElement(filename, element, showWarnings);
144  }
145 
146  return parsed;
147 }
148 
150 {
152 
153  // Give it something to chew on, so it can position the initial
154  // cursor in the right place. Toggle text, to force an area recalc.
155  if (m_text)
156  {
157  m_text->SetText(".");
158  m_text->SetText("");
159  }
160 
161  if (m_cursorImage && m_text)
163 }
164 
166 {
167  if (m_initialized)
168  return;
169 
170  m_initialized = true;
171 
172  m_text = dynamic_cast<MythUIText *>(GetChild("text"));
173  m_cursorImage = dynamic_cast<MythUIImage *>(GetChild("cursor"));
175  dynamic_cast<MythUIStateType *>(GetChild("background"));
176 
177  if (!m_text)
178  LOG(VB_GENERAL, LOG_ERR, LOC + "Missing text element.");
179 
180  if (!m_cursorImage)
181  LOG(VB_GENERAL, LOG_ERR, LOC + "Missing cursor element.");
182 
183  if (!m_backgroundState)
184  LOG(VB_GENERAL, LOG_WARNING, LOC + "Missing background element.");
185 
186  if (!m_text || !m_cursorImage)
187  {
188  m_text = nullptr;
189  m_cursorImage = nullptr;
190  m_backgroundState = nullptr;
191  return;
192  }
193 
195  LOG(VB_GENERAL, LOG_ERR, LOC + "active state doesn't exist");
196  m_text->SetCutDown(Qt::ElideNone);
197 
198  QFontMetrics fm(m_text->GetFontProperties()->face());
199  int height = fm.height();
200 
201  if (height > 0)
202  {
203  MythRect imageArea = m_cursorImage->GetFullArea();
204  int width = int(((float)height / (float)imageArea.height())
205  * (float)imageArea.width());
206 
207  if (width <= 0)
208  width = 1;
209 
210  m_cursorImage->ForceSize(QSize(width, height));
211  }
212 }
213 
214 void MythUITextEdit::SetMaxLength(const int length)
215 {
216  m_maxLength = length;
217 }
218 
219 void MythUITextEdit::SetText(const QString &text, bool moveCursor)
220 {
221  if (!m_text || (m_message == text))
222  return;
223 
224  m_message = text;
225 
226  if (m_isPassword)
227  {
228  QString obscured;
229 
230  obscured.fill('*', m_message.size());
231  m_text->SetText(obscured);
232  }
233  else
235 
236  if (moveCursor)
238 
239  emit valueChanged();
240 }
241 
242 void MythUITextEdit::InsertText(const QString &text)
243 {
244  if (!m_text)
245  return;
246 
247  for (const auto& c : qAsConst(text))
248  InsertCharacter(c);
249 
250  emit valueChanged();
251 }
252 
253 bool MythUITextEdit::InsertCharacter(const QString &character)
254 {
255  if (m_maxLength != 0 && m_message.length() == m_maxLength)
256  return false;
257 
258  QString newmessage = m_message;
259 
260  const QChar *unichar = character.unicode();
261 
262  // Filter all non printable characters
263  if (!unichar->isPrint())
264  return false;
265 
266  if ((m_filter & FilterAlpha) && unichar->isLetter())
267  return false;
268 
269  if ((m_filter & FilterNumeric) && unichar->isNumber())
270  return false;
271 
272  if ((m_filter & FilterSymbols) && unichar->isSymbol())
273  return false;
274 
275  if ((m_filter & FilterPunct) && unichar->isPunct())
276  return false;
277 
278  newmessage.insert(m_position + 1, character);
279  SetText(newmessage, false);
281 
282  return true;
283 }
284 
285 // This is used for updating IME.
286 bool MythUITextEdit::UpdateTmpString(const QString &str)
287 {
288  if (!m_text)
289  return false;
290 
291  if (str.isEmpty())
292  return false;
293  QString newmessage = m_message;
294  newmessage.append(str);
295  SetText(newmessage, false);
296  return true;
297 }
298 
300 {
301  if (m_message.isEmpty() || position < 0 || position >= m_message.size())
302  return;
303 
304  QString newmessage = m_message;
305 
306  newmessage.remove(position, 1);
307  SetText(newmessage, false);
308 
309  if (position == m_position)
311 }
312 
314 {
315  if (!m_text || !m_cursorImage)
316  return false;
317 
318  switch (moveDir)
319  {
320  case MoveLeft:
321  if (m_position < 0)
322  return false;
323  m_position--;
324  break;
325  case MoveRight:
326  if (m_position == (m_message.size() - 1))
327  return false;
328  m_position++;
329  break;
330  case MoveUp:
331  {
332  int newPos = m_text->MoveCursor(-1);
333  if (newPos == -1)
334  return false;
335  m_position = newPos - 1;
336  break;
337  }
338  case MoveDown:
339  {
340  int newPos = m_text->MoveCursor(1);
341  if (newPos == -1)
342  return false;
343  m_position = newPos - 1;
344  break;
345  }
346  case MovePageUp:
347  {
348  int lines = m_text->m_area.height() / (m_text->m_lineHeight + m_text->m_leading);
349  int newPos = m_text->MoveCursor(-lines);
350  if (newPos == -1)
351  return false;
352  m_position = newPos - 1;
353  break;
354  }
355  case MovePageDown:
356  {
357  int lines = m_text->m_area.height() / (m_text->m_lineHeight + m_text->m_leading);
358  int newPos = m_text->MoveCursor(lines);
359  if (newPos == -1)
360  return false;
361  m_position = newPos - 1;
362  break;
363  }
364  case MoveEnd:
365  m_position = m_message.size() - 1;
366  break;
367  }
368 
370 
371  SetRedraw();
372  return true;
373 }
374 
376 {
378  Reset();
379 }
380 
382 {
383  QClipboard *clipboard = QApplication::clipboard();
384 
385  clipboard->setText(m_message);
386 }
387 
389 {
390  QClipboard *clipboard = QApplication::clipboard();
391 
392  if (!clipboard->supportsSelection())
393  mode = QClipboard::Clipboard;
394 
395  InsertText(clipboard->text(mode));
396 }
397 
398 using keyCombo = QPair<int, int>;
399 static QMap<keyCombo, int> gDeadKeyMap;
400 
401 static void LoadDeadKeys(QMap<QPair<int, int>, int> &map)
402 {
403  // Dead key // Key // Result
404  map[keyCombo(Qt::Key_Dead_Grave, Qt::Key_A)] = Qt::Key_Agrave;
405  map[keyCombo(Qt::Key_Dead_Acute, Qt::Key_A)] = Qt::Key_Aacute;
406  map[keyCombo(Qt::Key_Dead_Circumflex, Qt::Key_A)] = Qt::Key_Acircumflex;
407  map[keyCombo(Qt::Key_Dead_Tilde, Qt::Key_A)] = Qt::Key_Atilde;
408  map[keyCombo(Qt::Key_Dead_Diaeresis, Qt::Key_A)] = Qt::Key_Adiaeresis;
409  map[keyCombo(Qt::Key_Dead_Abovering, Qt::Key_A)] = Qt::Key_Aring;
410 
411  map[keyCombo(Qt::Key_Dead_Cedilla, Qt::Key_C)] = Qt::Key_Ccedilla;
412 
413  map[keyCombo(Qt::Key_Dead_Grave, Qt::Key_E)] = Qt::Key_Egrave;
414  map[keyCombo(Qt::Key_Dead_Acute, Qt::Key_E)] = Qt::Key_Eacute;
415  map[keyCombo(Qt::Key_Dead_Circumflex, Qt::Key_E)] = Qt::Key_Ecircumflex;
416  map[keyCombo(Qt::Key_Dead_Diaeresis, Qt::Key_E)] = Qt::Key_Ediaeresis;
417 
418  map[keyCombo(Qt::Key_Dead_Grave, Qt::Key_I)] = Qt::Key_Igrave;
419  map[keyCombo(Qt::Key_Dead_Acute, Qt::Key_I)] = Qt::Key_Iacute;
420  map[keyCombo(Qt::Key_Dead_Circumflex, Qt::Key_I)] = Qt::Key_Icircumflex;
421  map[keyCombo(Qt::Key_Dead_Diaeresis, Qt::Key_I)] = Qt::Key_Idiaeresis;
422 
423  map[keyCombo(Qt::Key_Dead_Tilde, Qt::Key_N)] = Qt::Key_Ntilde;
424 
425  map[keyCombo(Qt::Key_Dead_Grave, Qt::Key_O)] = Qt::Key_Ograve;
426  map[keyCombo(Qt::Key_Dead_Acute, Qt::Key_O)] = Qt::Key_Oacute;
427  map[keyCombo(Qt::Key_Dead_Circumflex, Qt::Key_O)] = Qt::Key_Ocircumflex;
428  map[keyCombo(Qt::Key_Dead_Tilde, Qt::Key_O)] = Qt::Key_Otilde;
429  map[keyCombo(Qt::Key_Dead_Diaeresis, Qt::Key_O)] = Qt::Key_Odiaeresis;
430 
431  map[keyCombo(Qt::Key_Dead_Grave, Qt::Key_U)] = Qt::Key_Ugrave;
432  map[keyCombo(Qt::Key_Dead_Acute, Qt::Key_U)] = Qt::Key_Uacute;
433  map[keyCombo(Qt::Key_Dead_Circumflex, Qt::Key_U)] = Qt::Key_Ucircumflex;
434  map[keyCombo(Qt::Key_Dead_Diaeresis, Qt::Key_U)] = Qt::Key_Udiaeresis;
435 
436  map[keyCombo(Qt::Key_Dead_Acute, Qt::Key_Y)] = Qt::Key_Yacute;
437  map[keyCombo(Qt::Key_Dead_Diaeresis, Qt::Key_Y)] = Qt::Key_ydiaeresis;
438 }
439 
440 bool MythUITextEdit::inputMethodEvent(QInputMethodEvent *event)
441 {
442  // 1st test.
443  if (m_isPassword)
444  return false;
445 
446  bool _bak = m_isIMEinput;
447  if (!m_isIMEinput && (event->commitString().isEmpty() || event->preeditString().isEmpty()))
448  {
449  m_isIMEinput = true;
451  }
452 #if 0
453  printf("IME: %s->%s PREEDIT=\"%s\" COMMIT=\"%s\"\n"
454  , (_bak) ? "ON" : "OFF"
455  , (m_isIMEinput) ? "ON" : "OFF"
456  , event->preeditString().toUtf8().constData()
457  , event->commitString().toUtf8().constData());
458 #endif
459  if (!event->commitString().isEmpty() && m_isIMEinput)
460  {
462  m_messageBak.clear();
463  InsertText(event->commitString());
464  m_isIMEinput = false;
465  return true; // commited
466  }
467  if (m_isIMEinput && !event->preeditString().isEmpty())
468  {
470  UpdateTmpString(event->preeditString());
471  return true; // preedited
472  }
473  if (m_isIMEinput && _bak)
474  { // Abort?
475  m_isIMEinput = false;
476  QString newmessage= m_messageBak;
477  m_messageBak.clear();
478  SetText(newmessage, true);
479  return true;
480  }
481  return true; // Not commited
482 }
483 
484 bool MythUITextEdit::keyPressEvent(QKeyEvent *event)
485 {
486  if (m_isIMEinput) // Prefer IME then keyPress.
487  return true;
489 
490  QStringList actions;
491  bool handled = false;
492 
493  handled = GetMythMainWindow()->TranslateKeyPress("Global", event, actions,
494  false);
495 
496  Qt::KeyboardModifiers modifiers = event->modifiers();
497  int keynum = event->key();
498 
499  if (keynum >= Qt::Key_Shift && keynum <= Qt::Key_CapsLock)
500  return false;
501 
502  QString character;
503  // Compose key handling
504  // Enter composition mode
505  if (((modifiers & Qt::GroupSwitchModifier) != 0U) &&
506  (keynum >= Qt::Key_Dead_Grave) && (keynum <= Qt::Key_Dead_Horn))
507  {
508  m_composeKey = keynum;
509  handled = true;
510  }
511  else if (m_composeKey > 0) // 'Compose' the key
512  {
513  if (gDeadKeyMap.isEmpty())
515 
516  LOG(VB_GUI, LOG_DEBUG, QString("Compose key: %1 Key: %2")
517  .arg(QString::number(m_composeKey, 16), QString::number(keynum, 16)));
518 
519  if (gDeadKeyMap.contains(keyCombo(m_composeKey, keynum)))
520  {
521  int keycode = gDeadKeyMap.value(keyCombo(m_composeKey, keynum));
522 
523  //QKeyEvent key(QEvent::KeyPress, keycode, modifiers);
524  character = QChar(keycode);
525 
526  if ((modifiers & Qt::ShiftModifier) != 0U)
527  character = character.toUpper();
528  else
529  character = character.toLower();
530  LOG(VB_GUI, LOG_DEBUG, QString("Found match for dead-key combo - %1").arg(character));
531  }
532  m_composeKey = 0;
533  }
534 
535  if (character.isEmpty())
536  character = event->text();
537 
538  if (!handled && InsertCharacter(character))
539  handled = true;
540 
541  for (int i = 0; i < actions.size() && !handled; i++)
542  {
543 
544  QString action = actions[i];
545  handled = true;
546 
547  if (action == "LEFT")
548  {
550  }
551  else if (action == "RIGHT")
552  {
554  }
555  else if (action == "UP")
556  {
557  handled = MoveCursor(MoveUp);
558  }
559  else if (action == "DOWN")
560  {
561  handled = MoveCursor(MoveDown);
562  }
563  else if (action == "PAGEUP")
564  {
565  handled = MoveCursor(MovePageUp);
566  }
567  else if (action == "PAGEDOWN")
568  {
569  handled = MoveCursor(MovePageDown);
570  }
571  else if (action == "DELETE")
572  {
574  }
575  else if (action == "BACKSPACE")
576  {
578  }
579  else if (action == "NEWLINE")
580  {
581  QString newmessage = m_message;
582  newmessage.insert(m_position + 1, '\n');
583  SetText(newmessage, false);
585  }
586  else if (action == "SELECT" && keynum != Qt::Key_Space
587  && GetMythDB()->GetNumSetting("UseVirtualKeyboard", 1) == 1)
588  {
589  MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
590  auto *kb = new MythUIVirtualKeyboard(popupStack, this);
591 
592  if (kb->Create())
593  {
594  popupStack->AddScreen(kb);
595  }
596  else
597  delete kb;
598  }
599  else if (action == "CUT")
600  {
602  }
603  else if (action == "COPY")
604  {
606  }
607  else if (action == "PASTE")
608  {
610  }
611  else
612  handled = false;
613  }
614 
615  return handled;
616 }
617 
624 {
625  bool handled = false;
626 
627  if (event->GetGesture() == MythGestureEvent::Click &&
628  event->GetButton() == Qt::MiddleButton)
629  {
630  PasteTextFromClipboard(QClipboard::Selection);
631  }
632 
633  return handled;
634 }
635 
637 {
638  auto *textedit = dynamic_cast<MythUITextEdit *>(base);
639 
640  if (!textedit)
641  {
642  LOG(VB_GENERAL, LOG_ERR, LOC + "ERROR, bad parsing");
643  return;
644  }
645 
646  m_message.clear();
647  m_position = -1;
648 
649  m_blinkInterval = textedit->m_blinkInterval;
650  m_cursorBlinkRate = textedit->m_cursorBlinkRate;
651  m_maxLength = textedit->m_maxLength;
652  m_filter = textedit->m_filter;
653  m_keyboardPosition = textedit->m_keyboardPosition;
654 
655  MythUIType::CopyFrom(base);
656 
658 }
659 
661 {
662  auto *textedit = new MythUITextEdit(parent, objectName());
663  textedit->CopyFrom(this);
664 }
MythUITextEdit::Reset
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
Definition: mythuitextedit.cpp:76
FilterAlpha
@ FilterAlpha
Definition: mythuitextedit.h:22
MythUIType::m_area
MythRect m_area
Definition: mythuitype.h:274
MythUITextEdit::m_position
int m_position
Definition: mythuitextedit.h:101
MythTimer::elapsed
std::chrono::milliseconds elapsed(void)
Returns milliseconds elapsed since last start() or restart()
Definition: mythtimer.cpp:91
MythUITextEdit::m_keyboardPosition
PopupPosition m_keyboardPosition
Definition: mythuitextedit.h:105
MythUITextEdit::SetMaxLength
void SetMaxLength(int length)
Definition: mythuitextedit.cpp:214
MythUITextEdit::CopyFrom
void CopyFrom(MythUIType *base) override
Copy this widgets state from another.
Definition: mythuitextedit.cpp:636
MythUITextEdit::m_text
MythUIText * m_text
Definition: mythuitextedit.h:109
MythUITextEdit::m_initialized
bool m_initialized
Definition: mythuitextedit.h:91
MythUITextEdit::MoveDown
@ MoveDown
Definition: mythuitextedit.h:56
mythuitext.h
FilterNone
@ FilterNone
Definition: mythuitextedit.h:21
MythUIImage
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:97
LoadDeadKeys
static void LoadDeadKeys(QMap< QPair< int, int >, int > &map)
Definition: mythuitextedit.cpp:401
MythUIText::SetCutDown
void SetCutDown(Qt::TextElideMode mode)
Definition: mythuitext.cpp:282
mythdb.h
VK_POSTOPDIALOG
@ VK_POSTOPDIALOG
Definition: mythvirtualkeyboard.h:13
MythUITextEdit::m_lastKeyPress
MythTimer m_lastKeyPress
Definition: mythuitextedit.h:95
MythUITextEdit::PasteTextFromClipboard
void PasteTextFromClipboard(QClipboard::Mode mode=QClipboard::Clipboard)
Definition: mythuitextedit.cpp:388
MythGestureEvent::GetGesture
Gesture GetGesture() const
Definition: mythgesture.h:85
MythGestureEvent::GetButton
Qt::MouseButton GetButton() const
Definition: mythgesture.h:88
MythUITextEdit::m_backgroundState
MythUIStateType * m_backgroundState
Definition: mythuitextedit.h:107
MythUIType::GetFullArea
virtual MythRect GetFullArea(void) const
Definition: mythuitype.cpp:892
MythUITextEdit::ParseElement
bool ParseElement(const QString &filename, QDomElement &element, bool showWarnings) override
Parse the xml definition of this widget setting the state of the object accordingly.
Definition: mythuitextedit.cpp:111
MythUITextEdit::m_isIMEinput
bool m_isIMEinput
Definition: mythuitextedit.h:113
MythUIType::GetChild
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
Definition: mythuitype.cpp:133
Mode
Mode
Definition: synaesthesia.h:23
VK_POSBELOWEDIT
@ VK_POSBELOWEDIT
Definition: mythvirtualkeyboard.h:12
MythUITextEdit::RemoveCharacter
void RemoveCharacter(int position)
Definition: mythuitextedit.cpp:299
MythUITextEdit::SetInitialStates
void SetInitialStates(void)
Definition: mythuitextedit.cpp:165
MythScreenStack
Definition: mythscreenstack.h:16
MythUITextEdit::m_maxLength
int m_maxLength
Definition: mythuitextedit.h:97
MythFontProperties::face
QFont face(void) const
Definition: mythfontproperties.cpp:40
MythUITextEdit::MoveEnd
@ MoveEnd
Definition: mythuitextedit.h:56
MythUITextEdit
A text entry and edit widget.
Definition: mythuitextedit.h:34
gDeadKeyMap
static QMap< keyCombo, int > gDeadKeyMap
Definition: mythuitextedit.cpp:399
MythUIType::SetArea
virtual void SetArea(const MythRect &rect)
Definition: mythuitype.cpp:609
MythUITextEdit::MovePageUp
@ MovePageUp
Definition: mythuitextedit.h:56
MythTimer::start
void start(void)
starts measuring elapsed time.
Definition: mythtimer.cpp:47
VK_POSBOTTOMDIALOG
@ VK_POSBOTTOMDIALOG
Definition: mythvirtualkeyboard.h:14
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
mythuistatetype.h
GetMythDB
MythDB * GetMythDB(void)
Definition: mythdb.cpp:50
keyCombo
QPair< int, int > keyCombo
Definition: mythuitextedit.cpp:398
MythRect
Wrapper around QRect allowing us to handle percentage and other relative values for areas in mythui.
Definition: mythrect.h:17
MythUIType::Pulse
virtual void Pulse(void)
Pulse is called 70 times a second to trigger a single frame of an animation.
Definition: mythuitype.cpp:455
MythUITextEdit::m_isPassword
bool m_isPassword
Definition: mythuitextedit.h:103
MythUIText::GetFontProperties
const MythFontProperties * GetFontProperties()
Definition: mythuitext.h:79
MythUIText::MoveCursor
int MoveCursor(int lines)
Definition: mythuitext.cpp:1028
mythuiimage.h
MythUITextEdit::InsertText
void InsertText(const QString &text)
Definition: mythuitextedit.cpp:242
MythUIType::TakingFocus
void TakingFocus()
MythUIText::m_lineHeight
int m_lineHeight
Definition: mythuitext.h:133
MythUITextEdit::MoveLeft
@ MoveLeft
Definition: mythuitextedit.h:56
MythUITextEdit::MoveRight
@ MoveRight
Definition: mythuitextedit.h:56
MythUITextEdit::SetText
void SetText(const QString &text, bool moveCursor=true)
Definition: mythuitextedit.cpp:219
FilterNumeric
@ FilterNumeric
Definition: mythuitextedit.h:23
MythUITextEdit::m_blinkInterval
int m_blinkInterval
Definition: mythuitextedit.h:93
MythUIType::m_hasFocus
bool m_hasFocus
Definition: mythuitype.h:262
mythfontproperties.h
mythlogging.h
MythMainWindow::TranslateKeyPress
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
Definition: mythmainwindow.cpp:1104
VK_POSCENTERDIALOG
@ VK_POSCENTERDIALOG
Definition: mythvirtualkeyboard.h:15
MythUIType::SetPosition
void SetPosition(int x, int y)
Convenience method, calls SetPosition(const MythPoint&) Override that instead to change functionality...
Definition: mythuitype.cpp:532
VERBOSE_XML
#define VERBOSE_XML(type, level, filename, element, msg)
Definition: xmlparsebase.h:15
FilterPunct
@ FilterPunct
Definition: mythuitextedit.h:26
MythTimer::restart
std::chrono::milliseconds restart(void)
Returns milliseconds elapsed since last start() or restart() and resets the count.
Definition: mythtimer.cpp:62
MythUIText::CursorPosition
QPoint CursorPosition(int text_offset)
Definition: mythuitext.cpp:1110
XMLParseBase::getFirstText
static QString getFirstText(QDomElement &element)
Definition: xmlparsebase.cpp:52
FilterSymbols
@ FilterSymbols
Definition: mythuitextedit.h:25
MythUITextEdit::m_composeKey
int m_composeKey
Definition: mythuitextedit.h:111
MythGestureEvent::Click
@ Click
Definition: mythgesture.h:77
MythUITextEdit::Pulse
void Pulse(void) override
Pulse is called 70 times a second to trigger a single frame of an animation.
Definition: mythuitextedit.cpp:81
MythUIType::CopyFrom
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
Definition: mythuitype.cpp:1174
MythUITextEdit::CreateCopy
void CreateCopy(MythUIType *parent) override
Copy the state of this widget to the one given, it must be of the same type.
Definition: mythuitextedit.cpp:660
mythpainter.h
MythUITextEdit::m_messageBak
QString m_messageBak
Definition: mythuitextedit.h:114
XMLParseBase::parseRect
static MythRect parseRect(const QString &text, bool normalize=true)
Definition: xmlparsebase.cpp:136
LOC
#define LOC
Definition: mythuitextedit.cpp:26
MythUIVirtualKeyboard
A popup onscreen keyboard for easy alphanumeric and text entry using a remote control or mouse.
Definition: mythvirtualkeyboard.h:48
mythgesture.h
A C++ ripoff of the stroke library for MythTV.
MythUITextEdit::m_filter
InputFilter m_filter
Definition: mythuitextedit.h:100
MythUITextEdit::Finalize
void Finalize(void) override
Perform any post-xml parsing initialisation tasks.
Definition: mythuitextedit.cpp:149
MythUITextEdit::InsertCharacter
bool InsertCharacter(const QString &character)
Definition: mythuitextedit.cpp:253
MythUIType
The base class on which all widgets and screens are based.
Definition: mythuitype.h:85
MythUITextEdit::CutTextToClipboard
void CutTextToClipboard(void)
Definition: mythuitextedit.cpp:375
mythuihelper.h
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
mythuitextedit.h
MythUITextEdit::m_cursorImage
MythUIImage * m_cursorImage
Definition: mythuitextedit.h:108
MythUITextEdit::Select
void Select()
Definition: mythuitextedit.cpp:64
MythUIType::m_canHaveFocus
bool m_canHaveFocus
Definition: mythuitype.h:263
MythUITextEdit::MoveDirection
MoveDirection
Definition: mythuitextedit.h:56
MythUIImage::ForceSize
void ForceSize(QSize size)
Force the dimensions of the widget and image to the given size.
Definition: mythuiimage.cpp:902
MythUIText::SetText
virtual void SetText(const QString &text)
Definition: mythuitext.cpp:132
MythUIType::SetVisible
virtual void SetVisible(bool visible)
Definition: mythuitype.cpp:1108
GetMythMainWindow
MythMainWindow * GetMythMainWindow(void)
Definition: mythmainwindow.cpp:102
build_compdb.action
action
Definition: build_compdb.py:9
MythUITextEdit::gestureEvent
bool gestureEvent(MythGestureEvent *event) override
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
Definition: mythuitextedit.cpp:623
MythMainWindow::GetStack
MythScreenStack * GetStack(const QString &Stackname)
Definition: mythmainwindow.cpp:320
MythUITextEdit::valueChanged
void valueChanged()
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
MythUITextEdit::inputMethodEvent
bool inputMethodEvent(QInputMethodEvent *event) override
Input Method event handler.
Definition: mythuitextedit.cpp:440
MythUIText::m_leading
int m_leading
Definition: mythuitext.h:131
MythUITextEdit::UpdateTmpString
bool UpdateTmpString(const QString &str)
Definition: mythuitextedit.cpp:286
MythUIType::LosingFocus
void LosingFocus()
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:1240
MythUITextEdit::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: mythuitextedit.cpp:484
MythUITextEdit::CopyTextToClipboard
void CopyTextToClipboard(void)
Definition: mythuitextedit.cpp:381
build_compdb.filename
filename
Definition: build_compdb.py:21
mythmainwindow.h
MythScreenStack::AddScreen
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
Definition: mythscreenstack.cpp:50
MythUIType::SetRedraw
void SetRedraw(void)
Definition: mythuitype.cpp:308
MythUITextEdit::m_message
QString m_message
Definition: mythuitextedit.h:99
MythUIType::IsVisible
bool IsVisible(bool recurse=false) const
Definition: mythuitype.cpp:902
VK_POSABOVEEDIT
@ VK_POSABOVEEDIT
Definition: mythvirtualkeyboard.h:11
MythUITextEdit::MoveCursor
bool MoveCursor(MoveDirection moveDir)
Definition: mythuitextedit.cpp:313
MythUITextEdit::MythUITextEdit
MythUITextEdit(MythUIType *parent, const QString &name)
Definition: mythuitextedit.cpp:28
MythUIStateType
This widget is used for grouping other widgets for display when a particular named state is called....
Definition: mythuistatetype.h:22
MythUIStateType::DisplayState
bool DisplayState(const QString &name)
Definition: mythuistatetype.cpp:84
MythUITextEdit::MovePageDown
@ MovePageDown
Definition: mythuitextedit.h:56
MythUITextEdit::Deselect
void Deselect()
Definition: mythuitextedit.cpp:70