Commit 6f1d2371 authored by Thomas Hartmann's avatar Thomas Hartmann Committed by Tim Jenssen
Browse files

QmlDesigner: Keep background color in integrated text editor



Applying a .css style overrides the text editor background color
from the theme.
To avoid this we cannot apply any .css on the integrated text editor or
its parents:

 * Only apply the center widget .css to the tab bar.
 * Apply the scrollbar.css only to the scrollbars.

Change-Id: Id9b009a208ea2830c64be8174dbb548ada692560
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent 5b9450a3
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <QEvent> #include <QEvent>
#include <QScrollBar>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <vector> #include <vector>
...@@ -61,7 +62,6 @@ TextEditorWidget::TextEditorWidget(TextEditorView *textEditorView) ...@@ -61,7 +62,6 @@ TextEditorWidget::TextEditorWidget(TextEditorView *textEditorView)
m_updateSelectionTimer.setInterval(200); m_updateSelectionTimer.setInterval(200);
connect(&m_updateSelectionTimer, &QTimer::timeout, this, &TextEditorWidget::updateSelectionByCursorPosition); connect(&m_updateSelectionTimer, &QTimer::timeout, this, &TextEditorWidget::updateSelectionByCursorPosition);
setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css")))));
} }
void TextEditorWidget::setTextEditor(TextEditor::BaseTextEditor *textEditor) void TextEditorWidget::setTextEditor(TextEditor::BaseTextEditor *textEditor)
...@@ -85,6 +85,9 @@ void TextEditorWidget::setTextEditor(TextEditor::BaseTextEditor *textEditor) ...@@ -85,6 +85,9 @@ void TextEditorWidget::setTextEditor(TextEditor::BaseTextEditor *textEditor)
}); });
textEditor->editorWidget()->installEventFilter(this); textEditor->editorWidget()->installEventFilter(this);
static QString styleSheet = Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css"))));
textEditor->editorWidget()->verticalScrollBar()->setStyleSheet(styleSheet);
textEditor->editorWidget()->horizontalScrollBar()->setStyleSheet(styleSheet);
} }
if (oldEditor) if (oldEditor)
......
...@@ -454,10 +454,6 @@ static Core::MiniSplitter *createCentralSplitter(const QList<WidgetInfo> &widget ...@@ -454,10 +454,6 @@ static Core::MiniSplitter *createCentralSplitter(const QList<WidgetInfo> &widget
SwitchSplitTabWidget *switchSplitTabWidget = new SwitchSplitTabWidget(); SwitchSplitTabWidget *switchSplitTabWidget = new SwitchSplitTabWidget();
QString sheet = QString::fromUtf8(Utils::FileReader::fetchQrc(":/qmldesigner/centerwidget.css"));
switchSplitTabWidget->setStyleSheet(Theme::replaceCssColors(sheet));
foreach (const WidgetInfo &widgetInfo, widgetInfos) { foreach (const WidgetInfo &widgetInfo, widgetInfos) {
if (widgetInfo.placementHint == widgetInfo.CentralPane) if (widgetInfo.placementHint == widgetInfo.CentralPane)
switchSplitTabWidget->addTab(widgetInfo.widget, widgetInfo.tabName); switchSplitTabWidget->addTab(widgetInfo.widget, widgetInfo.tabName);
......
...@@ -24,8 +24,10 @@ ...@@ -24,8 +24,10 @@
****************************************************************************/ ****************************************************************************/
#include "switchsplittabwidget.h" #include "switchsplittabwidget.h"
#include <theme.h>
#include <utils/utilsicons.h> #include <utils/utilsicons.h>
#include <utils/fileutils.h>
#include <QVector> #include <QVector>
#include <QBoxLayout> #include <QBoxLayout>
...@@ -48,6 +50,9 @@ SwitchSplitTabWidget::SwitchSplitTabWidget(QWidget *parent) ...@@ -48,6 +50,9 @@ SwitchSplitTabWidget::SwitchSplitTabWidget(QWidget *parent)
m_splitter->setObjectName("centralTabWidget"); m_splitter->setObjectName("centralTabWidget");
m_splitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_splitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QString sheet = QString::fromUtf8(Utils::FileReader::fetchQrc(":/qmldesigner/centerwidget.css"));
m_tabBarBackground->setStyleSheet(Theme::replaceCssColors(sheet));
m_tabBar->setObjectName("centralTabBar"); m_tabBar->setObjectName("centralTabBar");
m_tabBar->setShape(QTabBar::RoundedEast); m_tabBar->setShape(QTabBar::RoundedEast);
m_tabBar->setDocumentMode(false); m_tabBar->setDocumentMode(false);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment