diff options
Diffstat (limited to 'src/plugins/coreplugin/themechooser.cpp')
-rw-r--r-- | src/plugins/coreplugin/themechooser.cpp | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/src/plugins/coreplugin/themechooser.cpp b/src/plugins/coreplugin/themechooser.cpp index fd97cfd815..ffb94438be 100644 --- a/src/plugins/coreplugin/themechooser.cpp +++ b/src/plugins/coreplugin/themechooser.cpp @@ -128,13 +128,11 @@ public: public: ThemeListModel *m_themeListModel; QComboBox *m_themeComboBox; - bool m_refreshingThemeList; }; ThemeChooserPrivate::ThemeChooserPrivate(QWidget *widget) : m_themeListModel(new ThemeListModel) , m_themeComboBox(new QComboBox) - , m_refreshingThemeList(false) { QHBoxLayout *layout = new QHBoxLayout(widget); layout->addWidget(m_themeComboBox); @@ -142,6 +140,12 @@ ThemeChooserPrivate::ThemeChooserPrivate(QWidget *widget) 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)); + m_themeListModel->setThemes(themes); + if (selected >= 0) + m_themeComboBox->setCurrentIndex(selected); } ThemeChooserPrivate::~ThemeChooserPrivate() @@ -153,8 +157,6 @@ ThemeChooser::ThemeChooser(QWidget *parent) : QWidget(parent) { d = new ThemeChooserPrivate(this); - - refreshThemeList(); } ThemeChooser::~ThemeChooser() @@ -162,19 +164,6 @@ ThemeChooser::~ThemeChooser() delete d; } -void ThemeChooser::refreshThemeList() -{ - const QList<ThemeEntry> themes = ThemeEntry::availableThemes(); - const int selected = Utils::indexOf(themes, Utils::equal(&ThemeEntry::id, - Id::fromString(creatorTheme()->id()))); - - d->m_refreshingThemeList = true; - d->m_themeListModel->setThemes(themes); - if (selected >= 0) - d->m_themeComboBox->setCurrentIndex(selected); - d->m_refreshingThemeList = false; -} - void ThemeChooser::apply() { const int index = d->m_themeComboBox->currentIndex(); |