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:
Marco Martin 2009-10-02 20:14:40 +00:00
parent 9a1a247591
commit 8c1408f179
2 changed files with 12 additions and 1 deletions

View File

@ -19,6 +19,7 @@
#include "label.h"
#include <QApplication>
#include <QLabel>
#include <QPainter>
#include <QDir>
@ -293,7 +294,7 @@ void Label::paint(QPainter *painter,
void Label::changeEvent(QEvent *event)
{
if (event->type() == QEvent::FontChange) {
if (event->type() == QEvent::FontChange && font() != QApplication::font()) {
d->customFont = true;
nativeWidget()->setFont(font());
}
@ -301,6 +302,15 @@ void Label::changeEvent(QEvent *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
#include <label.moc>

View File

@ -151,6 +151,7 @@ protected:
const QStyleOptionGraphicsItem *option,
QWidget *widget);
void changeEvent(QEvent *event);
bool event(QEvent *event);
private:
Q_PRIVATE_SLOT(d, void setPalette())