summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Bache-Wiig <jbache@trolltech.com>2009-09-09 13:09:34 (GMT)
committerJens Bache-Wiig <jbache@trolltech.com>2009-09-09 13:14:20 (GMT)
commitc5c58c2368f71c5d0067c9389c8ad04c41b66db5 (patch)
treee974295bfded180194d63ab2ffd11a5cd44d0094
parent4cc9fcac3ef66987b95a5589f10f3a0d82a778f4 (diff)
downloadQt-c5c58c2368f71c5d0067c9389c8ad04c41b66db5.zip
Qt-c5c58c2368f71c5d0067c9389c8ad04c41b66db5.tar.gz
Qt-c5c58c2368f71c5d0067c9389c8ad04c41b66db5.tar.bz2
Fix regression in Command link button font size
Since vista style polish sets the font on polish, the check for WA_SetFont will succeed, hence we never set the actual font. I replaced the check with a full resolve. However since the resolve would clear the resolve_mask, from the widget font it has to be restored manually so that QPainter:setFont can resolve it later. Task-number: QTBUG-4646 Reviewed-by: trond
-rw-r--r--src/gui/text/qfont.h1
-rw-r--r--src/gui/widgets/qcommandlinkbutton.cpp27
2 files changed, 20 insertions, 8 deletions
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index ef91983..d73e1c4 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -309,6 +309,7 @@ private:
friend class QPicturePaintEngine;
friend class QPainterReplayer;
friend class QPaintBufferEngine;
+ friend class QCommandLinkButtonPrivate;
#ifndef QT_NO_DATASTREAM
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QFont &);
diff --git a/src/gui/widgets/qcommandlinkbutton.cpp b/src/gui/widgets/qcommandlinkbutton.cpp
index e64f687..9adf280 100644
--- a/src/gui/widgets/qcommandlinkbutton.cpp
+++ b/src/gui/widgets/qcommandlinkbutton.cpp
@@ -140,23 +140,34 @@ QFont QCommandLinkButtonPrivate::titleFont() const
Q_Q(const QCommandLinkButton);
QFont font = q->font();
if (usingVistaStyle()) {
- if (!q->testAttribute(Qt::WA_SetFont))
- font.setPointSizeF(12.0);
+ font.setPointSizeF(12.0);
} else {
font.setBold(true);
- if (!q->testAttribute(Qt::WA_SetFont))
- font.setPointSizeF(9.0);
+ font.setPointSizeF(9.0);
}
- return font;
+
+ // Note the font will be resolved against
+ // QPainters font, so we need to restore the mask
+ int resolve_mask = font.resolve_mask;
+ QFont modifiedFont = q->font().resolve(font);
+ modifiedFont.detach();
+ modifiedFont.resolve_mask = resolve_mask;
+ return modifiedFont;
}
QFont QCommandLinkButtonPrivate::descriptionFont() const
{
Q_Q(const QCommandLinkButton);
QFont font = q->font();
- if (!q->testAttribute(Qt::WA_SetFont))
- font.setPointSizeF(9.0);
- return font;
+ font.setPointSizeF(9.0);
+
+ // Note the font will be resolved against
+ // QPainters font, so we need to restore the mask
+ int resolve_mask = font.resolve_mask;
+ QFont modifiedFont = q->font().resolve(font);
+ modifiedFont.detach();
+ modifiedFont.resolve_mask = resolve_mask;
+ return modifiedFont;
}
QRect QCommandLinkButtonPrivate::titleRect() const