Commit fa998d2d authored by Frantisek Vacek's avatar Frantisek Vacek Committed by David Schulz

Improve Copy/CutLine actions usability

This patch implements two features:
1. Reimplement CopyLine to move text cursor at the beginning of line
2. Add copy/cutLine action to Advanced Edit menu, to make it
   discoverable for editor users.

Change-Id: I0bf336ebee4dbf5afd2c759e47b1830271bd9d18
Reviewed-by: default avatarDavid Schulz <david.schulz@digia.com>
parent f3973ebc
......@@ -159,6 +159,7 @@ const char G_EDIT_OTHER[] = "QtCreator.Group.Edit.Other";
// Advanced edit menu groups
const char G_EDIT_FORMAT[] = "QtCreator.Group.Edit.Format";
const char G_EDIT_COLLAPSING[] = "QtCreator.Group.Edit.Collapsing";
const char G_EDIT_TEXT[] = "QtCreator.Group.Edit.Text";
const char G_EDIT_BLOCKS[] = "QtCreator.Group.Edit.Blocks";
const char G_EDIT_FONT[] = "QtCreator.Group.Edit.Font";
const char G_EDIT_EDITOR[] = "QtCreator.Group.Edit.Editor";
......
......@@ -411,12 +411,14 @@ EditorManager::EditorManager(QWidget *parent) :
medit->addMenu(advancedMenu, Constants::G_EDIT_ADVANCED);
advancedMenu->menu()->setTitle(tr("Ad&vanced"));
advancedMenu->appendGroup(Constants::G_EDIT_FORMAT);
advancedMenu->appendGroup(Constants::G_EDIT_TEXT);
advancedMenu->appendGroup(Constants::G_EDIT_COLLAPSING);
advancedMenu->appendGroup(Constants::G_EDIT_BLOCKS);
advancedMenu->appendGroup(Constants::G_EDIT_FONT);
advancedMenu->appendGroup(Constants::G_EDIT_EDITOR);
// Advanced menu separators
advancedMenu->addSeparator(editManagerContext, Constants::G_EDIT_TEXT);
advancedMenu->addSeparator(editManagerContext, Constants::G_EDIT_COLLAPSING);
advancedMenu->addSeparator(editManagerContext, Constants::G_EDIT_BLOCKS);
advancedMenu->addSeparator(editManagerContext, Constants::G_EDIT_FONT);
......
......@@ -5060,6 +5060,8 @@ void BaseTextEditorWidget::copyLine()
QTextCursor prevCursor = textCursor();
maybeSelectLine();
copy();
if (!prevCursor.hasSelection())
prevCursor.movePosition(QTextCursor::StartOfBlock);
setTextCursor(prevCursor);
}
......
......@@ -136,12 +136,6 @@ void TextEditorActionHandler::createActions()
SLOT(gotoAction()));
m_printAction = registerAction(PRINT,
SLOT(printAction()));
m_cutLineAction = registerAction(CUT_LINE,
SLOT(cutLine()), true, tr("Cut &Line"),
QKeySequence(tr("Shift+Del")));
m_copyLineAction = registerAction(COPY_LINE,
SLOT(copyLine()), false, tr("Copy &Line"),
QKeySequence(tr("Ctrl+Ins")));
m_deleteLineAction = registerAction(DELETE_LINE,
SLOT(deleteLine()), true, tr("Delete &Line"));
m_deleteEndOfWordAction = registerAction(DELETE_END_OF_WORD,
......@@ -241,6 +235,14 @@ void TextEditorActionHandler::createActions()
SLOT(unCommentSelection()), true, tr("Toggle Comment &Selection"),
QKeySequence(tr("Ctrl+/")),
G_EDIT_FORMAT, advancedEditMenu);
m_cutLineAction = registerAction(CUT_LINE,
SLOT(cutLine()), true, tr("Cut &Line"),
QKeySequence(tr("Shift+Del")),
G_EDIT_TEXT, advancedEditMenu);
m_copyLineAction = registerAction(COPY_LINE,
SLOT(copyLine()), false, tr("Copy &Line"),
QKeySequence(tr("Ctrl+Ins")),
G_EDIT_TEXT, advancedEditMenu);
m_foldAction = registerAction(FOLD,
SLOT(fold()), true, tr("Fold"),
QKeySequence(tr("Ctrl+<")),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment