CppEditor: Fix inserting completion while in (local) rename mode

Fixes case 1 of QTCREATORBUG-14633.

Task-number: QTCREATORBUG-14633
Change-Id: I1f57b8f831613668b85948f4ec588c4cf441b633
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
Takumi ASAKI
2015-07-01 13:22:18 +09:00
committed by David Schulz
parent 5088f07f39
commit b36924c0e6
4 changed files with 20 additions and 0 deletions

View File

@@ -723,6 +723,14 @@ FollowSymbolUnderCursor *CppEditorWidget::followSymbolUnderCursorDelegate()
return d->m_followSymbolUnderCursor.data();
}
void CppEditorWidget::encourageApply()
{
if (d->m_localRenaming.encourageApply())
return;
TextEditorWidget::encourageApply();
}
void CppEditorWidget::abortDeclDefLink()
{
if (!d->m_declDefLink)

View File

@@ -83,6 +83,8 @@ public:
FollowSymbolUnderCursor *followSymbolUnderCursorDelegate(); // exposed for tests
void encourageApply() override;
public slots:
void paste() override;
void cut() override;

View File

@@ -210,6 +210,14 @@ bool CppLocalRenaming::handleKeyPressEvent(QKeyEvent *e)
return true;
}
bool CppLocalRenaming::encourageApply()
{
if (!isActive())
return false;
finishRenameChange();
return true;
}
QTextEdit::ExtraSelection &CppLocalRenaming::renameSelection()
{
return m_selections[m_renameSelectionIndex];

View File

@@ -61,6 +61,8 @@ public:
// to BaseTextEditorWidget::keyPressEvent()
bool handleKeyPressEvent(QKeyEvent *e);
bool encourageApply();
public slots:
void updateSelectionsForVariableUnderCursor(const QList<QTextEdit::ExtraSelection> &selections);