Permalink
Browse files

Fix not being able to insert a newline in the multi-line text edit

Refs #11414.
This adds a NEWLINE keybinding to the Global key context (default binding is
Ctrl-Return) and adds support for it in MythUITextEdit.
  • Loading branch information...
paul-h authored and Paul Harrison committed Feb 19, 2013
1 parent e167f79 commit f320d68349b9ead0f3f006c921c63e9b8b12b034
Showing with 9 additions and 0 deletions.
  1. +2 −0 mythtv/libs/libmythui/mythmainwindow.cpp
  2. +7 −0 mythtv/libs/libmythui/mythuitextedit.cpp
@@ -1147,6 +1147,8 @@ void MythMainWindow::InitKeys()
,"Copy text from textedit"), "Ctrl+C");
RegisterKey("Global", "PASTE", QT_TRANSLATE_NOOP("MythControls",
"Paste text into textedit"), "Ctrl+V");
RegisterKey("Global", "NEWLINE", QT_TRANSLATE_NOOP("MythControls",
"Insert newline into textedit"), "Ctrl+Return");
RegisterKey("Global", "UNDO", QT_TRANSLATE_NOOP("MythControls",
"Undo"), "Ctrl+Z");
RegisterKey("Global", "REDO", QT_TRANSLATE_NOOP("MythControls",
@@ -500,6 +500,13 @@ bool MythUITextEdit::keyPressEvent(QKeyEvent *event)
{
RemoveCharacter(m_Position);
}
else if (action == "NEWLINE")
{
QString newmessage = m_Message;
newmessage.insert(m_Position + 1, '\n');
SetText(newmessage, false);
MoveCursor(MoveRight);
}
else if (action == "SELECT" && keynum != Qt::Key_Space
&& GetMythDB()->GetNumSetting("UseVirtualKeyboard", 1) == 1)
{

0 comments on commit f320d68

Please sign in to comment.