QT: Implement themed icons (#3554)
* implement themed icons * fix theme search paths
This commit is contained in:
parent
7abfdb164b
commit
05cf7fe70a
13 changed files with 58 additions and 16 deletions
|
@ -130,6 +130,7 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
|
|||
|
||||
game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
|
||||
|
||||
default_theme_paths = QIcon::themeSearchPaths();
|
||||
UpdateUITheme();
|
||||
|
||||
// Show one-time "callout" messages to the user
|
||||
|
@ -1226,7 +1227,9 @@ void GMainWindow::filterBarSetChecked(bool state) {
|
|||
}
|
||||
|
||||
void GMainWindow::UpdateUITheme() {
|
||||
if (UISettings::values.theme != UISettings::themes[0].second) {
|
||||
QStringList theme_paths(default_theme_paths);
|
||||
if (UISettings::values.theme != UISettings::themes[0].second &&
|
||||
!UISettings::values.theme.isEmpty()) {
|
||||
QString theme_uri(":" + UISettings::values.theme + "/style.qss");
|
||||
QFile f(theme_uri);
|
||||
if (!f.exists()) {
|
||||
|
@ -1237,10 +1240,15 @@ void GMainWindow::UpdateUITheme() {
|
|||
qApp->setStyleSheet(ts.readAll());
|
||||
GMainWindow::setStyleSheet(ts.readAll());
|
||||
}
|
||||
theme_paths.append(QStringList{":/icons/default", ":/icons/" + UISettings::values.theme});
|
||||
QIcon::setThemeName(":/icons/" + UISettings::values.theme);
|
||||
} else {
|
||||
qApp->setStyleSheet("");
|
||||
GMainWindow::setStyleSheet("");
|
||||
theme_paths.append(QStringList{":/icons/default"});
|
||||
QIcon::setThemeName(":/icons/default");
|
||||
}
|
||||
QIcon::setThemeSearchPaths(theme_paths);
|
||||
}
|
||||
|
||||
void GMainWindow::LoadTranslation() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue