From e7ea80161aa91369cf700b79e96e97367ecf0ff6 Mon Sep 17 00:00:00 2001
From: Olivier Goffart <ogoffart@trolltech.com>
Date: Thu, 14 May 2009 11:03:35 +0200
Subject: Fix Toolbutton font with pseudo-states

So now QToolButton:pressed {text-decoration: underline} will works

The change in QCommonStyle is to make it consistant with the setFont few
lines later.

Reveiwed-by: jbache
---
 src/gui/styles/qcommonstyle.cpp     | 1 +
 src/gui/styles/qstylesheetstyle.cpp | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index c0899f8..6972803 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -1664,6 +1664,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
                 if (!styleHint(SH_UnderlineShortcut, opt, widget))
                     alignment |= Qt::TextHideMnemonic;
                 rect.translate(shiftX, shiftY);
+                p->setFont(toolbutton->font);
                 drawItemText(p, rect, alignment, toolbutton->palette,
                              opt->state & State_Enabled, toolbutton->text,
                              QPalette::ButtonText);
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index dcc11b8..cd44bfd 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -3030,6 +3030,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
         if (const QStyleOptionToolButton *tool = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
             QStyleOptionToolButton toolOpt(*tool);
             rule.configurePalette(&toolOpt.palette, QPalette::ButtonText, QPalette::Button);
+            toolOpt.font = rule.font.resolve(toolOpt.font);
             toolOpt.rect = rule.borderRect(opt->rect);
             bool customArrow = (tool->features & (QStyleOptionToolButton::HasMenu | QStyleOptionToolButton::MenuButtonPopup));
             bool customDropDown = tool->features & QStyleOptionToolButton::MenuButtonPopup;
-- 
cgit v0.12