Bug #1697 » 0019-Qt-Work-around-Qt-theming-issue.patch
| client/gui-qt/citydlg.cpp | ||
|---|---|---|
|
installEventFilter(this);
|
||
|
::city_dlg_created = true;
|
||
|
set_theme_style();
|
||
|
}
|
||
|
/************************************************************************//**
|
||
| client/gui-qt/gui_main.h | ||
|---|---|---|
|
#define CAPTURE_DEFAULT_THIS [=]
|
||
|
#endif // FREECIV_HAVE_CXX20_CAPTURE_THIS
|
||
|
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)
|
||
|
*****************************************************************************/
|
||