diff --git a/share/qtcreator/themes/dark.creatortheme b/share/qtcreator/themes/dark.creatortheme index 0853182f6e5d95773902d4725e012fde543a2095..3eb1628fd1c561311e3252dc9047fc98feca2487 100644 --- a/share/qtcreator/themes/dark.creatortheme +++ b/share/qtcreator/themes/dark.creatortheme @@ -1,5 +1,6 @@ [General] ThemeName=dark +PreferredStyles=Fusion [Palette] shadowBackground=ff232323 diff --git a/share/qtcreator/themes/default.creatortheme b/share/qtcreator/themes/default.creatortheme index fd3a6372c24ef512175955047e7d3dc8c88665aa..5149e83162e528bcd1911564e03fdc29bfc56535 100644 --- a/share/qtcreator/themes/default.creatortheme +++ b/share/qtcreator/themes/default.creatortheme @@ -1,5 +1,6 @@ [General] ThemeName=default +PreferredStyles= [Palette] brightText = ffffffff diff --git a/src/libs/utils/theme/theme.cpp b/src/libs/utils/theme/theme.cpp index 09f699ff21766ec2c4ef53eee44abab2963594b6..95b03c9c86ff6298b2ab3fb31b1b63c8ecf889df 100644 --- a/src/libs/utils/theme/theme.cpp +++ b/src/libs/utils/theme/theme.cpp @@ -30,6 +30,7 @@ #include "theme.h" #include "theme_p.h" +#include "../algorithm.h" #include "../qtcassert.h" #include <QApplication> @@ -80,6 +81,11 @@ Theme::WidgetStyle Theme::widgetStyle() const return d->widgetStyle; } +QStringList Theme::preferredStyles() const +{ + return d->preferredStyles; +} + bool Theme::flag(Theme::Flag f) const { return d->flags[f]; @@ -171,6 +177,7 @@ void Theme::writeSettings(const QString &filename) const const QMetaObject &m = *metaObject(); { settings.setValue(QLatin1String("ThemeName"), d->name); + settings.setValue(QLatin1String("PreferredStyles"), d->preferredStyles); } { settings.beginGroup(QLatin1String("Palette")); @@ -249,6 +256,7 @@ void Theme::readSettings(QSettings &settings) { d->name = settings.value(QLatin1String("ThemeName"), QLatin1String("unnamed")).toString(); + d->preferredStyles = settings.value(QLatin1String("PreferredStyles")).toStringList(); } { settings.beginGroup(QLatin1String("Palette")); diff --git a/src/libs/utils/theme/theme.h b/src/libs/utils/theme/theme.h index ef1ac85b7c945c374f97318e3d85bd8df48a56ad..a8d5bfcbc3a57d31eda688cf2cd30883a91f8b05 100644 --- a/src/libs/utils/theme/theme.h +++ b/src/libs/utils/theme/theme.h @@ -199,6 +199,7 @@ public: QString imageFile(ImageFile imageFile, const QString &fallBack) const; QGradientStops gradient(Gradient role) const; QPalette palette(const QPalette &base) const; + QStringList preferredStyles() const; QString fileName() const; void setName(const QString &name); diff --git a/src/libs/utils/theme/theme_p.h b/src/libs/utils/theme/theme_p.h index e1493a17e3320a13bfc1e096db51f6aa834007bd..bf78904e7ed5699388c94900123ea4e81bb8d2c8 100644 --- a/src/libs/utils/theme/theme_p.h +++ b/src/libs/utils/theme/theme_p.h @@ -46,6 +46,7 @@ public: QString fileName; QString name; + QStringList preferredStyles; QVector<QPair<QColor, QString> > colors; QVector<QString> imageFiles; QVector<QGradientStops> gradients; diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index f5edf4f705642caf6aad7a7a76ca24eac829dafc..cd149b60aba355c6e8f337bc5bc22f2c56f0b73e 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -166,7 +166,18 @@ MainWindow::MainWindow() : && baseName == QLatin1String("windows")) { baseName = QLatin1String("fusion"); } - qApp->setStyle(new ManhattanStyle(baseName)); + + // if the user has specified as base style in the theme settings, + // prefer that + const QStringList available = QStyleFactory::keys(); + foreach (const QString &s, Utils::creatorTheme()->preferredStyles()) { + if (available.contains(s, Qt::CaseInsensitive)) { + baseName = s; + break; + } + } + + QApplication::setStyle(new ManhattanStyle(baseName)); setDockNestingEnabled(true); diff --git a/src/plugins/coreplugin/themeeditor/themesettingstablemodel.cpp b/src/plugins/coreplugin/themeeditor/themesettingstablemodel.cpp index 20a607dba84809ab9b55e442d0c1ebfcfd2d112a..87826f87bb447f6515814572eaec78043ce5809d 100644 --- a/src/plugins/coreplugin/themeeditor/themesettingstablemodel.cpp +++ b/src/plugins/coreplugin/themeeditor/themesettingstablemodel.cpp @@ -236,6 +236,7 @@ void ThemeSettingsTableModel::initFrom(Theme *theme) m_widgetStyle = theme->widgetStyle(); m_name = theme->d->name; + m_preferredStyles = theme->d->preferredStyles; } void ThemeSettingsTableModel::toTheme(Theme *t) const @@ -265,6 +266,7 @@ void ThemeSettingsTableModel::toTheme(Theme *t) const theme->widgetStyle = m_widgetStyle; theme->name = m_name; + theme->preferredStyles = m_preferredStyles; emit t->changed(); } diff --git a/src/plugins/coreplugin/themeeditor/themesettingstablemodel.h b/src/plugins/coreplugin/themeeditor/themesettingstablemodel.h index 720c07e4e7182e9124439fbc919324dd2cbfbd0f..ea7cf4db394312f0186436a8498c9c7978289457 100644 --- a/src/plugins/coreplugin/themeeditor/themesettingstablemodel.h +++ b/src/plugins/coreplugin/themeeditor/themesettingstablemodel.h @@ -78,6 +78,7 @@ public: void toTheme(Utils::Theme *theme) const; QString m_name; + QStringList m_preferredStyles; public: ThemeColors::Ptr m_colors;