* don't set the font on the native widget in change events

* don't set the palette on the native widget in change events
* reset the value of customFont when it is set specifically because !customFont (allowing future theme changes to take effect as a result)

svn path=/trunk/KDE/kdelibs/; revision=1187721
This commit is contained in:
Aaron J. Seigo 2010-10-20 10:07:40 +00:00
parent 533799963e
commit 021d8e4823
11 changed files with 15 additions and 23 deletions

View File

@ -85,6 +85,7 @@ public:
q->setPalette(p);
if (!customFont) {
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
customFont = false;
}
}
@ -191,7 +192,6 @@ void CheckBox::changeEvent(QEvent *event)
{
if (event->type() == QEvent::FontChange) {
d->customFont = true;
nativeWidget()->setFont(font());
}
QGraphicsProxyWidget::changeEvent(event);

View File

@ -98,11 +98,11 @@ void ComboBoxPrivate::syncBorders()
//calc the rect for the over effect
syncActiveRect();
KComboBox *native = q->nativeWidget();
if (customFont) {
native->setFont(q->font());
q->setFont(q->font());
} else {
native->setFont(Theme::defaultTheme()->font(Theme::DefaultFont));
q->setFont(Theme::defaultTheme()->font(Theme::DefaultFont));
customFont = false;
}
}
@ -300,7 +300,6 @@ void ComboBox::changeEvent(QEvent *event)
{
if (event->type() == QEvent::FontChange) {
d->customFont = true;
nativeWidget()->setFont(font());
}
QGraphicsProxyWidget::changeEvent(event);

View File

@ -54,6 +54,7 @@ public:
if (!customFont) {
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
customFont = false;
}
}
@ -111,7 +112,6 @@ void GroupBox::changeEvent(QEvent *event)
{
if (event->type() == QEvent::FontChange) {
d->customFont = true;
nativeWidget()->setFont(font());
}
QGraphicsProxyWidget::changeEvent(event);

View File

@ -103,6 +103,7 @@ public:
if (!customFont) {
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
customFont = false;
}
}
@ -341,13 +342,11 @@ void Label::changeEvent(QEvent *event)
case QEvent::FontChange:
if (font() != QApplication::font()) {
d->customFont = true;
nativeWidget()->setFont(font());
}
break;
case QEvent::PaletteChange:
d->customPalette = true;
nativeWidget()->setPalette(palette());
break;
default:
@ -361,8 +360,8 @@ bool Label::event(QEvent *event)
{
if (event->type() == QEvent::Show && font() != QApplication::font()) {
d->customFont = true;
nativeWidget()->setFont(font());
}
return QGraphicsProxyWidget::event(event);
}

View File

@ -61,6 +61,7 @@ public:
if (!customFont) {
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
customFont = false;
}
}
@ -181,7 +182,6 @@ void LineEdit::changeEvent(QEvent *event)
{
if (event->type() == QEvent::FontChange) {
d->customFont = true;
nativeWidget()->setFont(font());
}
QGraphicsProxyWidget::changeEvent(event);

View File

@ -77,6 +77,7 @@ public:
if (!customFont) {
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
customFont = false;
}
}
@ -182,7 +183,6 @@ void RadioButton::changeEvent(QEvent *event)
{
if (event->type() == QEvent::FontChange) {
d->customFont = true;
nativeWidget()->setFont(font());
}
QGraphicsProxyWidget::changeEvent(event);

View File

@ -65,6 +65,7 @@ public:
if (!customFont) {
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
customFont = false;
}
}
@ -162,7 +163,6 @@ void SpinBox::changeEvent(QEvent *event)
{
if (event->type() == QEvent::FontChange) {
d->customFont = true;
nativeWidget()->setFont(font());
}
QGraphicsProxyWidget::changeEvent(event);

View File

@ -236,6 +236,7 @@ void TabBarPrivate::setPalette()
if (!customFont) {
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
customFont = false;
}
}
@ -626,7 +627,6 @@ void TabBar::changeEvent(QEvent *event)
{
if (event->type() == QEvent::FontChange) {
d->customFont = true;
nativeWidget()->setFont(font());
}
QGraphicsWidget::changeEvent(event);

View File

@ -83,6 +83,7 @@ public:
if (!customFont) {
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
customFont = false;
}
}
@ -207,7 +208,6 @@ void TextBrowser::changeEvent(QEvent *event)
{
if (event->type() == QEvent::FontChange) {
d->customFont = true;
nativeWidget()->setFont(font());
}
QGraphicsProxyWidget::changeEvent(event);

View File

@ -63,6 +63,7 @@ public:
if (!customFont) {
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
customFont = false;
}
}
@ -179,7 +180,6 @@ void TextEdit::changeEvent(QEvent *event)
{
if (event->type() == QEvent::FontChange) {
d->customFont = true;
nativeWidget()->setFont(font());
}
QGraphicsProxyWidget::changeEvent(event);

View File

@ -380,15 +380,9 @@ void ToolButton::paint(QPainter *painter,
buttonOpt.palette.setColor(QPalette::ButtonText, Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
}
QFont widgetFont;
if (d->customFont) {
widgetFont = font();
} else {
widgetFont = Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont);
}
buttonOpt.font = widgetFont;
buttonOpt.font = d->customFont ? font() : Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont);
painter->setFont(widgetFont);
painter->setFont(buttonOpt.font);
button->style()->drawControl(QStyle::CE_ToolButtonLabel, &buttonOpt, painter, button);
}