forked from qt-creator/qt-creator
CppEditor: Fix highlight of '#' Button for duplication case
Change-Id: Ib97f31912c9b2d619e3b92287ca8b192604f3831 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -203,8 +203,7 @@ void CppEditorWidget::finalizeInitialization()
|
||||
|
||||
connect(cppEditorDocument(), &CppEditorDocument::preprocessorSettingsChanged, this,
|
||||
[this](bool customSettings) {
|
||||
d->m_preprocessorButton->setProperty("highlightWidget", customSettings);
|
||||
d->m_preprocessorButton->update();
|
||||
updateWidgetHighlighting(d->m_preprocessorButton, customSettings);
|
||||
});
|
||||
|
||||
// set up function declaration - definition link
|
||||
@@ -267,6 +266,9 @@ void CppEditorWidget::finalizeInitializationAfterDuplication(TextEditorWidget *o
|
||||
const Id selectionKind = CodeWarningsSelection;
|
||||
setExtraSelections(selectionKind, cppEditorWidget->extraSelections(selectionKind));
|
||||
|
||||
if (isWidgetHighlighted(cppEditorWidget->d->m_preprocessorButton))
|
||||
updateWidgetHighlighting(d->m_preprocessorButton, true);
|
||||
|
||||
d->m_parseContextWidget->syncToModel();
|
||||
d->m_parseContextAction->setVisible(
|
||||
d->m_cppEditorDocument->parseContextModel().areMultipleAvailable());
|
||||
@@ -418,6 +420,17 @@ bool CppEditorWidget::selectBlockDown()
|
||||
return changed;
|
||||
}
|
||||
|
||||
void CppEditorWidget::updateWidgetHighlighting(QWidget *widget, bool highlight)
|
||||
{
|
||||
widget->setProperty("highlightWidget", highlight);
|
||||
widget->update();
|
||||
}
|
||||
|
||||
bool CppEditorWidget::isWidgetHighlighted(QWidget *widget)
|
||||
{
|
||||
return widget->property("highlightWidget").toBool();
|
||||
}
|
||||
|
||||
void CppEditorWidget::renameSymbolUnderCursor()
|
||||
{
|
||||
if (refactoringEngine())
|
||||
|
@@ -95,6 +95,9 @@ public:
|
||||
bool selectBlockUp() override;
|
||||
bool selectBlockDown() override;
|
||||
|
||||
static void updateWidgetHighlighting(QWidget *widget, bool highlight);
|
||||
static bool isWidgetHighlighted(QWidget *widget);
|
||||
|
||||
protected:
|
||||
bool event(QEvent *e) override;
|
||||
void contextMenuEvent(QContextMenuEvent *) override;
|
||||
|
@@ -25,6 +25,8 @@
|
||||
|
||||
#include "cppparsecontext.h"
|
||||
|
||||
#include "cppeditor.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
@@ -165,7 +167,7 @@ void ParseContextWidget::syncToModel()
|
||||
|
||||
const bool isPreferred = m_parseContextModel.isCurrentPreferred();
|
||||
m_clearPreferredAction->setEnabled(isPreferred);
|
||||
QComboBox::setProperty("highlightWidget", isPreferred);
|
||||
CppEditorWidget::updateWidgetHighlighting(this, isPreferred);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
Reference in New Issue
Block a user