aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@digia.com>2013-10-17 14:52:26 +0200
committerEike Ziller <eike.ziller@digia.com>2013-12-05 09:39:55 +0100
commit44d254b37bd700e576fa7e0860c061b9e37da5aa (patch)
tree92064bb8522c49504a085cdf5d796ab1e7056c08
parent9206fefb6ba0952cdc4927ae8b7962e870e1fb5b (diff)
CppEditor: Visual hint for changed preprocessor directives.
Change-Id: I3c3ae623beab55259179aaf0613d2bc5aaad1c28 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
-rw-r--r--src/plugins/coreplugin/manhattanstyle.cpp9
-rw-r--r--src/plugins/cppeditor/cppeditor.cpp9
2 files changed, 14 insertions, 4 deletions
diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp
index 2bec68c320..6df8700c6e 100644
--- a/src/plugins/coreplugin/manhattanstyle.cpp
+++ b/src/plugins/coreplugin/manhattanstyle.cpp
@@ -482,11 +482,12 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
// painter->drawLine(rect.bottomLeft() + QPoint(1, 0), rect.bottomRight() - QPoint(1, 0));
QColor highlight(255, 255, 255, 30);
painter->setPen(highlight);
- }
- else if (option->state & State_Enabled &&
- option->state & State_MouseOver) {
+ } else if (option->state & State_Enabled && option->state & State_MouseOver) {
QColor lighter(255, 255, 255, 37);
painter->fillRect(rect, lighter);
+ } else if (widget && widget->property("highlightWidget").toBool()) {
+ QColor shade(0, 0, 0, 128);
+ painter->fillRect(rect, shade);
}
if (option->state & State_HasFocus && (option->state & State_KeyboardFocusChange)) {
QColor highlight = option->palette.highlight().color();
@@ -872,6 +873,8 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti
QStyleOptionToolButton label = *toolbutton;
label.palette = panelPalette(option->palette, lightColored(widget));
+ if (widget && widget->property("highlightWidget").toBool())
+ label.palette.setColor(QPalette::ButtonText, Qt::red);
int fw = pixelMetric(PM_DefaultFrameWidth, option, widget);
label.rect = button.adjusted(fw, fw, -fw, -fw);
diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index 63d5bc2e5b..e490c4fbe3 100644
--- a/src/plugins/cppeditor/cppeditor.cpp
+++ b/src/plugins/cppeditor/cppeditor.cpp
@@ -717,6 +717,9 @@ void CPPEditorWidget::setMimeType(const QString &mt)
= m_modelManager->cppEditorSupport(editor())->snapshotUpdater();
updater->setEditorDefines(additionalDirectives);
+ m_preprocessorButton->setProperty("highlightWidget", !additionalDirectives.trimmed().isEmpty());
+ m_preprocessorButton->update();
+
BaseTextEditorWidget::setMimeType(mt);
setObjCEnabled(mt == QLatin1String(CppTools::Constants::OBJECTIVE_C_SOURCE_MIMETYPE)
|| mt == QLatin1String(CppTools::Constants::OBJECTIVE_CPP_SOURCE_MIMETYPE));
@@ -1990,8 +1993,12 @@ void CPPEditorWidget::showPreProcessorWidget()
if (preProcessorDialog.exec() == QDialog::Accepted) {
QSharedPointer<SnapshotUpdater> updater
= m_modelManager->cppEditorSupport(editor())->snapshotUpdater();
- updater->setEditorDefines(preProcessorDialog.additionalPreProcessorDirectives().toUtf8());
+ const QString &additionals = preProcessorDialog.additionalPreProcessorDirectives();
+ updater->setEditorDefines(additionals.toUtf8());
updater->update(m_modelManager->workingCopy());
+
+ m_preprocessorButton->setProperty("highlightWidget", !additionals.trimmed().isEmpty());
+ m_preprocessorButton->update();
}
}