* 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:
parent
533799963e
commit
021d8e4823
@ -85,6 +85,7 @@ public:
|
|||||||
q->setPalette(p);
|
q->setPalette(p);
|
||||||
if (!customFont) {
|
if (!customFont) {
|
||||||
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
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) {
|
if (event->type() == QEvent::FontChange) {
|
||||||
d->customFont = true;
|
d->customFont = true;
|
||||||
nativeWidget()->setFont(font());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsProxyWidget::changeEvent(event);
|
QGraphicsProxyWidget::changeEvent(event);
|
||||||
|
@ -98,11 +98,11 @@ void ComboBoxPrivate::syncBorders()
|
|||||||
//calc the rect for the over effect
|
//calc the rect for the over effect
|
||||||
syncActiveRect();
|
syncActiveRect();
|
||||||
|
|
||||||
KComboBox *native = q->nativeWidget();
|
|
||||||
if (customFont) {
|
if (customFont) {
|
||||||
native->setFont(q->font());
|
q->setFont(q->font());
|
||||||
} else {
|
} 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) {
|
if (event->type() == QEvent::FontChange) {
|
||||||
d->customFont = true;
|
d->customFont = true;
|
||||||
nativeWidget()->setFont(font());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsProxyWidget::changeEvent(event);
|
QGraphicsProxyWidget::changeEvent(event);
|
||||||
|
@ -54,6 +54,7 @@ public:
|
|||||||
|
|
||||||
if (!customFont) {
|
if (!customFont) {
|
||||||
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
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) {
|
if (event->type() == QEvent::FontChange) {
|
||||||
d->customFont = true;
|
d->customFont = true;
|
||||||
nativeWidget()->setFont(font());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsProxyWidget::changeEvent(event);
|
QGraphicsProxyWidget::changeEvent(event);
|
||||||
|
@ -103,6 +103,7 @@ public:
|
|||||||
|
|
||||||
if (!customFont) {
|
if (!customFont) {
|
||||||
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||||
|
customFont = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,13 +342,11 @@ void Label::changeEvent(QEvent *event)
|
|||||||
case QEvent::FontChange:
|
case QEvent::FontChange:
|
||||||
if (font() != QApplication::font()) {
|
if (font() != QApplication::font()) {
|
||||||
d->customFont = true;
|
d->customFont = true;
|
||||||
nativeWidget()->setFont(font());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QEvent::PaletteChange:
|
case QEvent::PaletteChange:
|
||||||
d->customPalette = true;
|
d->customPalette = true;
|
||||||
nativeWidget()->setPalette(palette());
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -361,8 +360,8 @@ bool Label::event(QEvent *event)
|
|||||||
{
|
{
|
||||||
if (event->type() == QEvent::Show && font() != QApplication::font()) {
|
if (event->type() == QEvent::Show && font() != QApplication::font()) {
|
||||||
d->customFont = true;
|
d->customFont = true;
|
||||||
nativeWidget()->setFont(font());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return QGraphicsProxyWidget::event(event);
|
return QGraphicsProxyWidget::event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@ public:
|
|||||||
|
|
||||||
if (!customFont) {
|
if (!customFont) {
|
||||||
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
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) {
|
if (event->type() == QEvent::FontChange) {
|
||||||
d->customFont = true;
|
d->customFont = true;
|
||||||
nativeWidget()->setFont(font());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsProxyWidget::changeEvent(event);
|
QGraphicsProxyWidget::changeEvent(event);
|
||||||
|
@ -77,6 +77,7 @@ public:
|
|||||||
|
|
||||||
if (!customFont) {
|
if (!customFont) {
|
||||||
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
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) {
|
if (event->type() == QEvent::FontChange) {
|
||||||
d->customFont = true;
|
d->customFont = true;
|
||||||
nativeWidget()->setFont(font());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsProxyWidget::changeEvent(event);
|
QGraphicsProxyWidget::changeEvent(event);
|
||||||
|
@ -65,6 +65,7 @@ public:
|
|||||||
|
|
||||||
if (!customFont) {
|
if (!customFont) {
|
||||||
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
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) {
|
if (event->type() == QEvent::FontChange) {
|
||||||
d->customFont = true;
|
d->customFont = true;
|
||||||
nativeWidget()->setFont(font());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsProxyWidget::changeEvent(event);
|
QGraphicsProxyWidget::changeEvent(event);
|
||||||
|
@ -236,6 +236,7 @@ void TabBarPrivate::setPalette()
|
|||||||
|
|
||||||
if (!customFont) {
|
if (!customFont) {
|
||||||
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
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) {
|
if (event->type() == QEvent::FontChange) {
|
||||||
d->customFont = true;
|
d->customFont = true;
|
||||||
nativeWidget()->setFont(font());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsWidget::changeEvent(event);
|
QGraphicsWidget::changeEvent(event);
|
||||||
|
@ -83,6 +83,7 @@ public:
|
|||||||
|
|
||||||
if (!customFont) {
|
if (!customFont) {
|
||||||
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
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) {
|
if (event->type() == QEvent::FontChange) {
|
||||||
d->customFont = true;
|
d->customFont = true;
|
||||||
nativeWidget()->setFont(font());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsProxyWidget::changeEvent(event);
|
QGraphicsProxyWidget::changeEvent(event);
|
||||||
|
@ -63,6 +63,7 @@ public:
|
|||||||
|
|
||||||
if (!customFont) {
|
if (!customFont) {
|
||||||
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
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) {
|
if (event->type() == QEvent::FontChange) {
|
||||||
d->customFont = true;
|
d->customFont = true;
|
||||||
nativeWidget()->setFont(font());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsProxyWidget::changeEvent(event);
|
QGraphicsProxyWidget::changeEvent(event);
|
||||||
|
@ -380,15 +380,9 @@ void ToolButton::paint(QPainter *painter,
|
|||||||
buttonOpt.palette.setColor(QPalette::ButtonText, Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
|
buttonOpt.palette.setColor(QPalette::ButtonText, Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
QFont widgetFont;
|
buttonOpt.font = d->customFont ? font() : Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont);
|
||||||
if (d->customFont) {
|
|
||||||
widgetFont = font();
|
|
||||||
} else {
|
|
||||||
widgetFont = Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont);
|
|
||||||
}
|
|
||||||
buttonOpt.font = widgetFont;
|
|
||||||
|
|
||||||
painter->setFont(widgetFont);
|
painter->setFont(buttonOpt.font);
|
||||||
button->style()->drawControl(QStyle::CE_ToolButtonLabel, &buttonOpt, painter, button);
|
button->style()->drawControl(QStyle::CE_ToolButtonLabel, &buttonOpt, painter, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user