diff options
author | Jens Bache-Wiig <jbache@trolltech.com> | 2009-08-10 16:19:53 (GMT) |
---|---|---|
committer | Jens Bache-Wiig <jbache@trolltech.com> | 2009-08-10 16:19:53 (GMT) |
commit | f9605d3f396043e5b893470acaeb4c726361e9dc (patch) | |
tree | d7215d77270daed0bad8f0d0e1169ca6e5f62079 /src/gui | |
parent | 13a31fe82845f8b1f4d86919080d3b2a87c4d061 (diff) | |
download | Qt-f9605d3f396043e5b893470acaeb4c726361e9dc.zip Qt-f9605d3f396043e5b893470acaeb4c726361e9dc.tar.gz Qt-f9605d3f396043e5b893470acaeb4c726361e9dc.tar.bz2 |
Make QGtkStyle react properly to font changes in GNOME
We only reacted to font changes before when the whole theme changed.
Two things had to be fixed to support this. We need to check if the
font changed in QGtkStyle::updateTheme and we need to make sure that
QApplication does not reset these settings for us.
Reviewed-by: joao
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication_x11.cpp | 36 | ||||
-rw-r--r-- | src/gui/styles/gtksymbols.cpp | 6 | ||||
-rw-r--r-- | src/gui/styles/qgtkstyle.cpp | 2 |
3 files changed, 26 insertions, 18 deletions
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 221101a..470b433 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -871,28 +871,32 @@ bool QApplicationPrivate::x11_apply_settings() } // ### Fix properly for 4.6 - if (!(QApplicationPrivate::app_style && QApplicationPrivate::app_style->inherits("QGtkStyle"))) { + bool usingGtkSettings = QApplicationPrivate::app_style && QApplicationPrivate::app_style->inherits("QGtkStyle"); + if (!usingGtkSettings) { if (groupCount == QPalette::NColorGroups) QApplicationPrivate::setSystemPalette(pal); } if (!appFont) { - QFont font(QApplication::font()); - QString fontDescription; - // Override Qt font if KDE4 settings can be used - if (X11->desktopEnvironment == DE_KDE && X11->desktopVersion >= 4) { - QSettings kdeSettings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); - fontDescription = kdeSettings.value(QLatin1String("font")).toString(); - if (fontDescription.isEmpty()) { - // KDE stores fonts without quotes - fontDescription = kdeSettings.value(QLatin1String("font")).toStringList().join(QLatin1String(",")); + // ### Fix properly for 4.6 + if (!usingGtkSettings) { + QFont font(QApplication::font()); + QString fontDescription; + // Override Qt font if KDE4 settings can be used + if (X11->desktopVersion == 4) { + QSettings kdeSettings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); + fontDescription = kdeSettings.value(QLatin1String("font")).toString(); + if (fontDescription.isEmpty()) { + // KDE stores fonts without quotes + fontDescription = kdeSettings.value(QLatin1String("font")).toStringList().join(QLatin1String(",")); + } + } + if (fontDescription.isEmpty()) + fontDescription = settings.value(QLatin1String("font")).toString(); + if (!fontDescription .isEmpty()) { + font.fromString(fontDescription ); + QApplicationPrivate::setSystemFont(font); } - } - if (fontDescription.isEmpty()) - fontDescription = settings.value(QLatin1String("font")).toString(); - if (!fontDescription .isEmpty()) { - font.fromString(fontDescription ); - QApplicationPrivate::setSystemFont(font); } } diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp index c8b4fda..2d8d6e2 100644 --- a/src/gui/styles/gtksymbols.cpp +++ b/src/gui/styles/gtksymbols.cpp @@ -547,9 +547,13 @@ void QGtkStyleUpdateScheduler::updateTheme() { static QString oldTheme(QLS("qt_not_set")); QPixmapCache::clear(); + + QFont font = QGtk::getThemeFont(); + if (QApplication::font() != font) + qApp->setFont(font); + if (oldTheme != getThemeName()) { oldTheme = getThemeName(); - qApp->setFont(QGtk::getThemeFont()); QPalette newPalette = qApp->style()->standardPalette(); QApplicationPrivate::setSystemPalette(newPalette); QApplication::setPalette(newPalette); diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index f6d8c88..5f56230 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -1,4 +1,4 @@ -/******* ********************************************************************* +/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) |