forked from qt-creator/qt-creator
Do not propagate dark theme to widget designer
Fixes: QTCREATORBUG-23981 Change-Id: I63c362b2ec87e02e7d6828ee4c143f54d113bef2 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -242,9 +242,24 @@ void Theme::readSettings(QSettings &settings)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If you copy QPalette, default values stay at default, even if that default is different
|
||||||
|
// within the context of different widgets. Create deep copy.
|
||||||
|
static QPalette copyPalette(const QPalette &p)
|
||||||
|
{
|
||||||
|
QPalette res;
|
||||||
|
for (int group = 0; group < QPalette::NColorGroups; ++group) {
|
||||||
|
for (int role = 0; role < QPalette::NColorRoles; ++role) {
|
||||||
|
res.setBrush(QPalette::ColorGroup(group),
|
||||||
|
QPalette::ColorRole(role),
|
||||||
|
p.brush(QPalette::ColorGroup(group), QPalette::ColorRole(role)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
QPalette Theme::initialPalette()
|
QPalette Theme::initialPalette()
|
||||||
{
|
{
|
||||||
static QPalette palette = QApplication::palette();
|
static QPalette palette = copyPalette(QApplication::palette());
|
||||||
return palette;
|
return palette;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -766,6 +766,7 @@ IEditor *FormEditorData::createEditor()
|
|||||||
m_fwm->closeAllPreviews();
|
m_fwm->closeAllPreviews();
|
||||||
QDesignerFormWindowInterface *form = m_fwm->createFormWindow(nullptr);
|
QDesignerFormWindowInterface *form = m_fwm->createFormWindow(nullptr);
|
||||||
QTC_ASSERT(form, return nullptr);
|
QTC_ASSERT(form, return nullptr);
|
||||||
|
form->setPalette(Theme::initialPalette());
|
||||||
QObject::connect(form, &QDesignerFormWindowInterface::toolChanged, [this] (int i) { toolChanged(i); });
|
QObject::connect(form, &QDesignerFormWindowInterface::toolChanged, [this] (int i) { toolChanged(i); });
|
||||||
|
|
||||||
auto widgetHost = new SharedTools::WidgetHost( /* parent */ nullptr, form);
|
auto widgetHost = new SharedTools::WidgetHost( /* parent */ nullptr, form);
|
||||||
|
Reference in New Issue
Block a user