don't set the native widget's palette. since this now works in QGraphicsProxyWidget, it now causes new problems: setting the palette on the widget (not the nativeWidget()) doesn't work for users of Plasma::* widgets. love it when work arounds to bugs cause new bugs once the original bugs are fixed upstream. ;)
svn path=/trunk/KDE/kdelibs/; revision=1185467
This commit is contained in:
parent
bdcf7578ee
commit
4c5f141992
@ -78,14 +78,13 @@ public:
|
||||
|
||||
void setPalette()
|
||||
{
|
||||
QCheckBox *native = q->nativeWidget();
|
||||
QColor color = Theme::defaultTheme()->color(Theme::TextColor);
|
||||
QPalette p = native->palette();
|
||||
QPalette p = q->palette();
|
||||
p.setColor(QPalette::Normal, QPalette::WindowText, color);
|
||||
p.setColor(QPalette::Inactive, QPalette::WindowText, color);
|
||||
native->setPalette(p);
|
||||
q->setPalette(p);
|
||||
if (!customFont) {
|
||||
q->nativeWidget()->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,15 +46,14 @@ public:
|
||||
|
||||
void setPalette()
|
||||
{
|
||||
QGroupBox *native = q->nativeWidget();
|
||||
QColor color = Theme::defaultTheme()->color(Theme::TextColor);
|
||||
QPalette p = native->palette();
|
||||
QPalette p = q->palette();
|
||||
p.setColor(QPalette::Normal, QPalette::WindowText, color);
|
||||
p.setColor(QPalette::Inactive, QPalette::WindowText, color);
|
||||
native->setPalette(p);
|
||||
q->setPalette(p);
|
||||
|
||||
if (!customFont) {
|
||||
q->nativeWidget()->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,9 @@ public:
|
||||
LabelPrivate(Label *label)
|
||||
: q(label),
|
||||
svg(0),
|
||||
customFont(false)
|
||||
textSelectable(false),
|
||||
customFont(false),
|
||||
customPalette(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -84,9 +86,12 @@ public:
|
||||
|
||||
void setPalette()
|
||||
{
|
||||
QLabel *native = q->nativeWidget();
|
||||
if (customPalette) {
|
||||
return;
|
||||
}
|
||||
|
||||
QColor color = Theme::defaultTheme()->color(Theme::TextColor);
|
||||
QPalette p = native->palette();
|
||||
QPalette p = q->palette();
|
||||
p.setColor(QPalette::Normal, QPalette::WindowText, color);
|
||||
p.setColor(QPalette::Inactive, QPalette::WindowText, color);
|
||||
color.setAlphaF(0.6);
|
||||
@ -94,10 +99,10 @@ public:
|
||||
|
||||
p.setColor(QPalette::Normal, QPalette::Link, Theme::defaultTheme()->color(Theme::LinkColor));
|
||||
p.setColor(QPalette::Normal, QPalette::LinkVisited, Theme::defaultTheme()->color(Theme::VisitedLinkColor));
|
||||
native->setPalette(p);
|
||||
q->setPalette(p);
|
||||
|
||||
if (!customFont) {
|
||||
q->nativeWidget()->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,8 +110,9 @@ public:
|
||||
QString imagePath;
|
||||
QString absImagePath;
|
||||
Svg *svg;
|
||||
bool textSelectable;
|
||||
bool customFont;
|
||||
bool textSelectable : 1;
|
||||
bool customFont : 1;
|
||||
bool customPalette : 1;
|
||||
};
|
||||
|
||||
Label::Label(QGraphicsWidget *parent)
|
||||
@ -115,7 +121,6 @@ Label::Label(QGraphicsWidget *parent)
|
||||
{
|
||||
QLabel *native = new QLabel;
|
||||
native->setWindowFlags(native->windowFlags()|Qt::BypassGraphicsProxyWidget);
|
||||
d->textSelectable = false;
|
||||
connect(native, SIGNAL(linkActivated(QString)), this, SIGNAL(linkActivated(QString)));
|
||||
connect(native, SIGNAL(linkHovered(QString)), this, SIGNAL(linkHovered(QString)));
|
||||
|
||||
@ -332,9 +337,21 @@ void Label::paint(QPainter *painter,
|
||||
|
||||
void Label::changeEvent(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::FontChange && font() != QApplication::font()) {
|
||||
d->customFont = true;
|
||||
nativeWidget()->setFont(font());
|
||||
switch (event->type()) {
|
||||
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:
|
||||
break;
|
||||
}
|
||||
|
||||
QGraphicsProxyWidget::changeEvent(event);
|
||||
|
@ -52,17 +52,15 @@ public:
|
||||
|
||||
void setPalette()
|
||||
{
|
||||
KLineEdit *native = q->nativeWidget();
|
||||
QColor color = Theme::defaultTheme()->color(Theme::ButtonTextColor);
|
||||
QPalette p = native->palette();
|
||||
QPalette p = q->palette();
|
||||
|
||||
p.setColor(QPalette::Normal, QPalette::Text, color);
|
||||
p.setColor(QPalette::Inactive, QPalette::Text, color);
|
||||
native->setPalette(p);
|
||||
native->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||
q->setPalette(p);
|
||||
|
||||
if (!customFont) {
|
||||
q->nativeWidget()->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,17 +68,15 @@ public:
|
||||
|
||||
void setPalette()
|
||||
{
|
||||
QRadioButton *native = q->nativeWidget();
|
||||
QColor color = Theme::defaultTheme()->color(Theme::TextColor);
|
||||
QPalette p = native->palette();
|
||||
QPalette p = q->palette();
|
||||
|
||||
p.setColor(QPalette::Normal, QPalette::Text, color);
|
||||
p.setColor(QPalette::Inactive, QPalette::Text, color);
|
||||
native->setPalette(p);
|
||||
native->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||
q->setPalette(p);
|
||||
|
||||
if (!customFont) {
|
||||
q->nativeWidget()->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,9 +52,8 @@ public:
|
||||
|
||||
void setPalette()
|
||||
{
|
||||
QSpinBox *native = q->nativeWidget();
|
||||
QColor color = Theme::defaultTheme()->color(Theme::ButtonTextColor);
|
||||
QPalette p = native->palette();
|
||||
QPalette p = q->palette();
|
||||
|
||||
p.setColor(QPalette::Normal, QPalette::Text, color);
|
||||
p.setColor(QPalette::Inactive, QPalette::Text, color);
|
||||
@ -62,10 +61,10 @@ public:
|
||||
p.setColor(QPalette::Inactive, QPalette::ButtonText, color);
|
||||
p.setColor(QPalette::Normal, QPalette::Base, QColor(0,0,0,0));
|
||||
p.setColor(QPalette::Inactive, QPalette::Base, QColor(0,0,0,0));
|
||||
native->setPalette(p);
|
||||
q->setPalette(p);
|
||||
|
||||
if (!customFont) {
|
||||
q->nativeWidget()->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,9 +223,8 @@ void TabBarPrivate::shapeChanged(const QTabBar::Shape shape)
|
||||
|
||||
void TabBarPrivate::setPalette()
|
||||
{
|
||||
QTabBar *native = q->nativeWidget();
|
||||
QColor color = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
|
||||
QPalette p = native->palette();
|
||||
QPalette p = q->palette();
|
||||
|
||||
p.setColor(QPalette::Normal, QPalette::Text, color);
|
||||
p.setColor(QPalette::Inactive, QPalette::Text, color);
|
||||
@ -233,10 +232,10 @@ void TabBarPrivate::setPalette()
|
||||
p.setColor(QPalette::Inactive, QPalette::ButtonText, color);
|
||||
p.setColor(QPalette::Normal, QPalette::Base, QColor(0,0,0,0));
|
||||
p.setColor(QPalette::Inactive, QPalette::Base, QColor(0,0,0,0));
|
||||
native->setPalette(p);
|
||||
q->setPalette(p);
|
||||
|
||||
if (!customFont) {
|
||||
q->nativeWidget()->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,9 +70,8 @@ public:
|
||||
|
||||
void setPalette()
|
||||
{
|
||||
KTextBrowser *native = q->nativeWidget();
|
||||
QColor color = Theme::defaultTheme()->color(Theme::TextColor);
|
||||
QPalette p = native->palette();
|
||||
QPalette p = q->palette();
|
||||
|
||||
p.setColor(QPalette::Normal, QPalette::Text, color);
|
||||
p.setColor(QPalette::Inactive, QPalette::Text, color);
|
||||
@ -80,10 +79,10 @@ public:
|
||||
p.setColor(QPalette::Inactive, QPalette::ButtonText, color);
|
||||
p.setColor(QPalette::Normal, QPalette::Base, QColor(0,0,0,0));
|
||||
p.setColor(QPalette::Inactive, QPalette::Base, QColor(0,0,0,0));
|
||||
native->setPalette(p);
|
||||
q->setPalette(p);
|
||||
|
||||
if (!customFont) {
|
||||
q->nativeWidget()->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,9 +50,8 @@ public:
|
||||
|
||||
void setPalette()
|
||||
{
|
||||
KTextEdit *native = q->nativeWidget();
|
||||
QColor color = Theme::defaultTheme()->color(Theme::TextColor);
|
||||
QPalette p = native->palette();
|
||||
QPalette p = q->palette();
|
||||
|
||||
p.setColor(QPalette::Normal, QPalette::Text, color);
|
||||
p.setColor(QPalette::Inactive, QPalette::Text, color);
|
||||
@ -60,10 +59,10 @@ public:
|
||||
p.setColor(QPalette::Inactive, QPalette::ButtonText, color);
|
||||
p.setColor(QPalette::Normal, QPalette::Base, QColor(0,0,0,0));
|
||||
p.setColor(QPalette::Inactive, QPalette::Base, QColor(0,0,0,0));
|
||||
native->setPalette(p);
|
||||
q->setPalette(p);
|
||||
|
||||
if (!customFont) {
|
||||
q->nativeWidget()->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||
q->setFont(Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user