diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index a3537d03af7b27f7bc0a39e64315a2889514e54f..7b08961bb969d6672a66896d575dfc87cd98c61e 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -2773,7 +2773,10 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
         painter.save();
         painter.setRenderHint(QPainter::Antialiasing, true);
         painter.translate(.5, .5);
-        painter.setBrush(d->m_ifdefedOutFormat.background());
+        QBrush brush = baseColor;
+        if (d->m_ifdefedOutFormat.hasProperty(QTextFormat::BackgroundBrush))
+            brush = d->m_ifdefedOutFormat.background();
+        painter.setBrush(brush);
         painter.drawRoundedRect(QRectF(visibleCollapsedBlockOffset.x(),
                                        visibleCollapsedBlockOffset.y(),
                                        maxWidth, blockHeight).adjusted(0, 0, 0, 0), 3, 3);