KDE/kdelibs/plasma/widgets
Marco Martin
notmart at gmail.com
Fri Oct 2 22:14:41 CEST 2009
SVN commit 1030634 by mart:
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 at kde.org
M +11 -1 label.cpp
M +1 -0 label.h
--- trunk/KDE/kdelibs/plasma/widgets/label.cpp #1030633:1030634
@@ -19,6 +19,7 @@
#include "label.h"
+#include <QApplication>
#include <QLabel>
#include <QPainter>
#include <QDir>
@@ -293,7 +294,7 @@
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 @@
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>
--- trunk/KDE/kdelibs/plasma/widgets/label.h #1030633:1030634
@@ -151,6 +151,7 @@
const QStyleOptionGraphicsItem *option,
QWidget *widget);
void changeEvent(QEvent *event);
+ bool event(QEvent *event);
private:
Q_PRIVATE_SLOT(d, void setPalette())
More information about the Plasma-devel
mailing list