forked from qt-creator/qt-creator
C++: Select All select the symbol while renaming symbol
https://bugreports.qt.nokia.com//browse/QTCREATORBUG-5520 Change-Id: Ifb163adb2609e17cdbc3df1e90b7e583c75fac49 Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
committed by
Leandro Melo
parent
d96c1a746e
commit
a138465848
@@ -579,6 +579,27 @@ void CPPEditorWidget::cut()
|
|||||||
finishRename();
|
finishRename();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPPEditorWidget::selectAll()
|
||||||
|
{
|
||||||
|
// if we are currently renaming a symbol
|
||||||
|
// and the cursor is over that symbol, select just that symbol
|
||||||
|
if (m_currentRenameSelection != NoCurrentRenameSelection) {
|
||||||
|
QTextCursor cursor = textCursor();
|
||||||
|
int selectionBegin = m_currentRenameSelectionBegin.position();
|
||||||
|
int selectionEnd = m_currentRenameSelectionEnd.position();
|
||||||
|
|
||||||
|
if (cursor.position() >= selectionBegin
|
||||||
|
&& cursor.position() <= selectionEnd) {
|
||||||
|
cursor.setPosition(selectionBegin);
|
||||||
|
cursor.setPosition(selectionEnd, QTextCursor::KeepAnchor);
|
||||||
|
setTextCursor(cursor);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseTextEditorWidget::selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
CppModelManagerInterface *CPPEditorWidget::modelManager() const
|
CppModelManagerInterface *CPPEditorWidget::modelManager() const
|
||||||
{
|
{
|
||||||
return m_modelManager;
|
return m_modelManager;
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ public:
|
|||||||
|
|
||||||
virtual void paste(); // reimplemented from BaseTextEditorWidget
|
virtual void paste(); // reimplemented from BaseTextEditorWidget
|
||||||
virtual void cut(); // reimplemented from BaseTextEditorWidget
|
virtual void cut(); // reimplemented from BaseTextEditorWidget
|
||||||
|
virtual void selectAll(); // reimplemented from BaseTextEditorWidget
|
||||||
|
|
||||||
CPlusPlus::CppModelManagerInterface *modelManager() const;
|
CPlusPlus::CppModelManagerInterface *modelManager() const;
|
||||||
|
|
||||||
|
|||||||
@@ -5763,6 +5763,12 @@ void BaseTextEditorWidget::cut()
|
|||||||
QPlainTextEdit::cut();
|
QPlainTextEdit::cut();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BaseTextEditorWidget::selectAll()
|
||||||
|
{
|
||||||
|
d->clearBlockSelection();
|
||||||
|
QPlainTextEdit::selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
void BaseTextEditorWidget::copy()
|
void BaseTextEditorWidget::copy()
|
||||||
{
|
{
|
||||||
if (!textCursor().hasSelection())
|
if (!textCursor().hasSelection())
|
||||||
|
|||||||
@@ -257,6 +257,7 @@ public slots:
|
|||||||
virtual void copy();
|
virtual void copy();
|
||||||
virtual void paste();
|
virtual void paste();
|
||||||
virtual void cut();
|
virtual void cut();
|
||||||
|
virtual void selectAll();
|
||||||
|
|
||||||
void circularPaste();
|
void circularPaste();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user