diff options
author | Christian Kamm <christian.d.kamm@nokia.com> | 2010-01-11 09:41:16 (GMT) |
---|---|---|
committer | Christian Kamm <christian.d.kamm@nokia.com> | 2010-01-11 09:48:19 (GMT) |
commit | dbf9e912180d06dd83cd61dc704af194d7e89013 (patch) | |
tree | a3ec033a53b94ed2003a55cbd6f6272d949ffca7 /src/gui/styles | |
parent | bbb73124d51fe97eb0df815e406c369bec65b4bd (diff) | |
download | Qt-dbf9e912180d06dd83cd61dc704af194d7e89013.zip Qt-dbf9e912180d06dd83cd61dc704af194d7e89013.tar.gz Qt-dbf9e912180d06dd83cd61dc704af194d7e89013.tar.bz2 |
Do not set the font size unnecessarily in the simulated s60 style.
Reviewed-by: Alessandro Portale <alessandro.portale@nokia.com>
Diffstat (limited to 'src/gui/styles')
-rw-r--r-- | src/gui/styles/qs60style.cpp | 9 | ||||
-rw-r--r-- | src/gui/styles/qs60style_p.h | 5 | ||||
-rw-r--r-- | src/gui/styles/qs60style_s60.cpp | 5 | ||||
-rw-r--r-- | src/gui/styles/qs60style_simulated.cpp | 7 |
4 files changed, 18 insertions, 8 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index bcc993a..5c61949 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -343,7 +343,8 @@ bool QS60StylePrivate::drawsOwnThemeBackground(const QWidget *widget) } QFont QS60StylePrivate::s60Font( - QS60StyleEnums::FontCategories fontCategory, int pointSize) const + QS60StyleEnums::FontCategories fontCategory, + int pointSize, bool resolveFontSize) const { QFont result; int actualPointSize = pointSize; @@ -356,7 +357,7 @@ QFont QS60StylePrivate::s60Font( Q_ASSERT(actualPointSize > 0); const QPair<QS60StyleEnums::FontCategories, int> key(fontCategory, actualPointSize); if (!m_mappedFontsCache.contains(key)) { - result = s60Font_specific(fontCategory, actualPointSize); + result = s60Font_specific(fontCategory, actualPointSize, resolveFontSize); m_mappedFontsCache.insert(key, result); } else { result = m_mappedFontsCache.value(key); @@ -620,8 +621,10 @@ void QS60StylePrivate::setFont(QWidget *widget) const fontCategory = QS60StyleEnums::FC_Title; } if (fontCategory != QS60StyleEnums::FC_Undefined) { + const bool resolveFontSize = widget->testAttribute(Qt::WA_SetFont) + && (widget->font().resolve() & QFont::SizeResolved); const QFont suggestedFont = - s60Font(fontCategory, widget->font().pointSizeF()); + s60Font(fontCategory, widget->font().pointSizeF(), resolveFontSize); widget->setFont(suggestedFont); } } diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 65d7574..bc3c4dc 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -401,7 +401,7 @@ public: static bool drawsOwnThemeBackground(const QWidget *widget); QFont s60Font(QS60StyleEnums::FontCategories fontCategory, - int pointSize = -1) const; + int pointSize = -1, bool resolveFontSize = true) const; // clears all style caches (fonts, colors, pixmaps) void clearCaches(CacheClearReason reason = CC_UndefinedChange); @@ -484,7 +484,8 @@ private: static QPixmap part(QS60StyleEnums::SkinParts part, const QSize &size, QPainter *painter, SkinElementFlags flags = KDefaultSkinElementFlags); - static QFont s60Font_specific(QS60StyleEnums::FontCategories fontCategory, int pointSize); + static QFont s60Font_specific(QS60StyleEnums::FontCategories fontCategory, + int pointSize, bool resolveFontSize); static QSize screenSize(); diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index fb9665a..3f90415 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -909,8 +909,11 @@ TAknsItemID QS60StyleModeSpecifics::partSpecificThemeId(int part) } QFont QS60StylePrivate::s60Font_specific( - QS60StyleEnums::FontCategories fontCategory, int pointSize) + QS60StyleEnums::FontCategories fontCategory, + int pointSize, bool resolveFontSize) { + Q_UNUSED(resolveFontSize); + TAknFontCategory aknFontCategory = EAknFontCategoryUndefined; switch (fontCategory) { case QS60StyleEnums::FC_Primary: diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp index e49854f..e47abbf 100644 --- a/src/gui/styles/qs60style_simulated.cpp +++ b/src/gui/styles/qs60style_simulated.cpp @@ -342,10 +342,13 @@ bool QS60StylePrivate::hasSliderGrooveGraphic() return false; } -QFont QS60StylePrivate::s60Font_specific(QS60StyleEnums::FontCategories fontCategory, int pointSize) +QFont QS60StylePrivate::s60Font_specific( + QS60StyleEnums::FontCategories fontCategory, + int pointSize, bool resolveFontSize) { QFont result; - result.setPointSize(pointSize); + if (resolveFontSize) + result.setPointSize(pointSize); switch (fontCategory) { case QS60StyleEnums::FC_Primary: result.setBold(true); |