indicate QT_STYLE_OVERRIDE usage in settings

This commit is contained in:
Martin Rotter 2022-01-22 10:10:39 +01:00
parent cf01b38d70
commit f0d993451f
3 changed files with 18 additions and 3 deletions

View File

@ -196,6 +196,12 @@ void SettingsGui::loadSettings() {
m_ui->m_cmbStyles->setCurrentIndex(item_style); m_ui->m_cmbStyles->setCurrentIndex(item_style);
} }
if (qApp->skins()->styleIsFrozen()) {
m_ui->m_cmbStyles->setEnabled(false);
m_ui->m_cmbStyles->setToolTip(tr("You cannot change style because it was explicitly selected in your OS settings.\n"
"Perhaps it is set with 'QT_STYLE_OVERRIDE' environment variable?"));
}
// Load tab settings. // Load tab settings.
m_ui->m_checkCloseTabsMiddleClick->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::TabCloseMiddleClick)).toBool()); m_ui->m_checkCloseTabsMiddleClick->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::TabCloseMiddleClick)).toBool());
m_ui->m_checkCloseTabsDoubleClick->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::TabCloseDoubleClick)).toBool()); m_ui->m_checkCloseTabsDoubleClick->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::TabCloseDoubleClick)).toBool());

View File

@ -14,7 +14,7 @@
#include <QStyleFactory> #include <QStyleFactory>
#include <QToolTip> #include <QToolTip>
SkinFactory::SkinFactory(QObject* parent) : QObject(parent) {} SkinFactory::SkinFactory(QObject* parent) : QObject(parent), m_styleIsFrozen(false) {}
void SkinFactory::loadCurrentSkin() { void SkinFactory::loadCurrentSkin() {
QList<QString> skin_names_to_try = { selectedSkinName(), QSL(APP_SKIN_DEFAULT) }; QList<QString> skin_names_to_try = { selectedSkinName(), QSL(APP_SKIN_DEFAULT) };
@ -53,11 +53,13 @@ void SkinFactory::loadSkinFromData(const Skin& skin) {
if (over_style.isEmpty()) { if (over_style.isEmpty()) {
qApp->setStyle(style_name); qApp->setStyle(style_name);
m_styleIsFrozen = false;
qDebugNN << LOGSEC_GUI << "Setting style:" << QUOTE_W_SPACE_DOT(style_name); qDebugNN << LOGSEC_GUI << "Setting style:" << QUOTE_W_SPACE_DOT(style_name);
} }
else { else {
qDebugNN << LOGSEC_GUI << "Respecting forced style:" << QUOTE_W_SPACE_DOT(over_style); m_styleIsFrozen = true;
qWarningNN << LOGSEC_GUI << "Respecting forced style:" << QUOTE_W_SPACE_DOT(over_style);
} }
if (isStyleGoodForDarkVariant(style_name) && if (isStyleGoodForDarkVariant(style_name) &&
@ -305,6 +307,10 @@ QString SkinFactory::loadSkinFile(const QString& skin_folder, const QString& fil
return data.replace(QSL(USER_DATA_PLACEHOLDER), skin_folder); return data.replace(QSL(USER_DATA_PLACEHOLDER), skin_folder);
} }
bool SkinFactory::styleIsFrozen() const {
return m_styleIsFrozen;
}
QList<Skin> SkinFactory::installedSkins() const { QList<Skin> SkinFactory::installedSkins() const {
QList<Skin> skins; QList<Skin> skins;
bool skin_load_ok; bool skin_load_ok;

View File

@ -87,7 +87,9 @@ class RSSGUARD_DLLSPEC SkinFactory : public QObject {
QString customSkinBaseFolder() const; QString customSkinBaseFolder() const;
private: bool styleIsFrozen() const;
private:
// Loads the skin from give skin_data. // Loads the skin from give skin_data.
void loadSkinFromData(const Skin& skin); void loadSkinFromData(const Skin& skin);
@ -96,6 +98,7 @@ class RSSGUARD_DLLSPEC SkinFactory : public QObject {
// Holds name of the current skin. // Holds name of the current skin.
Skin m_currentSkin; Skin m_currentSkin;
bool m_styleIsFrozen;
}; };
inline Skin SkinFactory::currentSkin() const { inline Skin SkinFactory::currentSkin() const {