apparently if the label is hidden it doesn't receive font change events,
so at show event i have to check if the font is different from QApplication::font() :/ now: is this the intended behaviour of qt or is a bug? CCMAIL:plasma-devel@kde.org svn path=/trunk/KDE/kdelibs/; revision=1030634
This commit is contained in:
parent
9a1a247591
commit
8c1408f179
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "label.h"
|
#include "label.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@ -293,7 +294,7 @@ void Label::paint(QPainter *painter,
|
|||||||
|
|
||||||
void Label::changeEvent(QEvent *event)
|
void Label::changeEvent(QEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::FontChange) {
|
if (event->type() == QEvent::FontChange && font() != QApplication::font()) {
|
||||||
d->customFont = true;
|
d->customFont = true;
|
||||||
nativeWidget()->setFont(font());
|
nativeWidget()->setFont(font());
|
||||||
}
|
}
|
||||||
@ -301,6 +302,15 @@ void Label::changeEvent(QEvent *event)
|
|||||||
QGraphicsProxyWidget::changeEvent(event);
|
QGraphicsProxyWidget::changeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Label::event(QEvent *event)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::Show && font() != QApplication::font()) {
|
||||||
|
d->customFont = true;
|
||||||
|
nativeWidget()->setFont(font());
|
||||||
|
}
|
||||||
|
return QGraphicsProxyWidget::event(event);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Plasma
|
} // namespace Plasma
|
||||||
|
|
||||||
#include <label.moc>
|
#include <label.moc>
|
||||||
|
@ -151,6 +151,7 @@ protected:
|
|||||||
const QStyleOptionGraphicsItem *option,
|
const QStyleOptionGraphicsItem *option,
|
||||||
QWidget *widget);
|
QWidget *widget);
|
||||||
void changeEvent(QEvent *event);
|
void changeEvent(QEvent *event);
|
||||||
|
bool event(QEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_PRIVATE_SLOT(d, void setPalette())
|
Q_PRIVATE_SLOT(d, void setPalette())
|
||||||
|
Loading…
Reference in New Issue
Block a user