Project

General

Profile

Bug #1697 » 0004-Qt-Work-around-Qt-theming-issue.patch

S3_1 - Marko Lindqvist, 11/02/2025 09:18 AM

View differences:

client/gui-qt/citydlg.cpp
installEventFilter(this);
::city_dlg_created = true;
set_theme_style();
}
/************************************************************************//**
client/gui-qt/gui_main.h
#define mevent_gpos(__ev__) (__ev__)->globalPos()
#endif // FC_QT5_MODE
void set_theme_style();
#endif // FC__GUI_MAIN_H
client/gui-qt/themes.cpp
static QString def_app_style;
static QString stylestring;
static QStyle *current_style = nullptr;
/*************************************************************************//**
Loads a qt theme directory/theme_name
*****************************************************************************/
......
stylestring.replace(lnb, fake_dir + "/" + theme_name + "/");
if (QString(theme_name) == QString("System")) {
QApplication::setStyle(QStyleFactory::create(def_app_style));
current_style = QStyleFactory::create(def_app_style);
} else {
QStyle *fstyle = QStyleFactory::create("Fusion");
if (fstyle != nullptr) {
QApplication::setStyle(fstyle);
current_style = fstyle;
} else {
QApplication::setStyle(QStyleFactory::create(def_app_style));
current_style = QStyleFactory::create(def_app_style);
}
}
QApplication::setStyle(current_style);
current_theme = theme_name;
QPixmapCache::clear();
......
QApplication::setPalette(pal);
}
/*************************************************************************//**
Set theme style again, to work around Qt theming bug.
*****************************************************************************/
void set_theme_style()
{
QApplication::setStyle(current_style);
}
/*************************************************************************//**
Clears a theme (sets default system theme)
*****************************************************************************/
(4-4/4)