Commit 583d8ced authored by Eike Ziller's avatar Eike Ziller

Theme Settings: Fix that options page switched back to current theme

- Changing the theme settings and reopening options page switched back
  to current theme
- When passing a theme on the command line, closing the options dialog
  would state that the theme change takes effect after restart, even if
  theme was not changed

Fix these issues by showing the current theme setting in the options
page, ignoring the currently active theme, and showing a label telling
the currently active theme instead.

Task-number: QTCREATORBUG-15852
Change-Id: I343fc729c33f17fcb15a8e9facd7a49076d0e0d1
Reviewed-by: Riitta-Leena Miettinen's avatarLeena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Alessandro Portale's avatarAlessandro Portale <alessandro.portale@qt.io>
parent 05bf915c
......@@ -38,6 +38,7 @@
#include <QDebug>
#include <QDir>
#include <QHBoxLayout>
#include <QLabel>
#include <QMessageBox>
#include <QSettings>
#include <QSpacerItem>
......@@ -136,13 +137,17 @@ ThemeChooserPrivate::ThemeChooserPrivate(QWidget *widget)
{
QHBoxLayout *layout = new QHBoxLayout(widget);
layout->addWidget(m_themeComboBox);
auto overriddenLabel = new QLabel;
overriddenLabel->setText(ThemeChooser::tr("Current theme: %1")
.arg(creatorTheme()->displayName()));
layout->addWidget(overriddenLabel);
layout->setMargin(0);
auto horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
layout->addSpacerItem(horizontalSpacer);
m_themeComboBox->setModel(m_themeListModel);
const QList<ThemeEntry> themes = ThemeEntry::availableThemes();
const Id activeTheme = Id::fromString(creatorTheme()->id());
const int selected = Utils::indexOf(themes, Utils::equal(&ThemeEntry::id, activeTheme));
const Id themeSetting = ThemeEntry::themeSetting();
const int selected = Utils::indexOf(themes, Utils::equal(&ThemeEntry::id, themeSetting));
m_themeListModel->setThemes(themes);
if (selected >= 0)
m_themeComboBox->setCurrentIndex(selected);
......
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