void ThemeSettingsWidget::apply() { const QString themeName = d->m_currentTheme.name(); Theme *newTheme = new Theme(themeName); if (d->m_currentTheme.readOnly()) { QSettings themeSettings(d->m_currentTheme.filePath(), QSettings::IniFormat); newTheme->readSettings(themeSettings); } else { d->m_ui->editor->model()->toTheme(newTheme); newTheme->writeSettings(d->m_currentTheme.filePath()); } setCreatorTheme(newTheme); emit ICore::instance()->themeChanged(); QPalette pal = newTheme->flag(Theme::ApplyThemePaletteGlobally) ? newTheme->palette() : Theme::initialPalette(); QApplication::setPalette(pal); if (ManhattanStyle *style = qobject_cast<ManhattanStyle *>(QApplication::style())) { QStyle *baseStyle = 0; foreach (const QString &s, creatorTheme()->preferredStyles()) { if ((baseStyle = QStyleFactory::create(s))) break; } style->setBaseStyle(baseStyle); }