Port Plasma::Svg away from KGlobalSettings
This commit is contained in:
parent
5b17b0f082
commit
18c12fb520
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QDomDocument>
|
#include <QDomDocument>
|
||||||
#include <QMatrix>
|
#include <QMatrix>
|
||||||
@ -546,15 +547,25 @@ void SvgPrivate::checkColorHints()
|
|||||||
|
|
||||||
// check to see if we are using colors, but the theme isn't being used or isn't providing
|
// check to see if we are using colors, but the theme isn't being used or isn't providing
|
||||||
// a colorscheme
|
// a colorscheme
|
||||||
if (usesColors && (!themed || !actualTheme()->colorScheme())) {
|
if (qApp) {
|
||||||
// QObject::connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
|
if (usesColors && (!themed || !actualTheme()->colorScheme())) {
|
||||||
// q, SLOT(colorsChanged()), Qt::UniqueConnection);
|
qApp->installEventFilter(q);
|
||||||
} else {
|
} else {
|
||||||
// QObject::disconnect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
|
qApp->removeEventFilter(q);
|
||||||
// q, SLOT(colorsChanged()));
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Svg::eventFilter(QObject *watched, QEvent *event)
|
||||||
|
{
|
||||||
|
if (watched == QCoreApplication::instance()) {
|
||||||
|
if (event->type() == QEvent::ApplicationPaletteChange) {
|
||||||
|
d->colorsChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QObject::eventFilter(watched, event);
|
||||||
|
}
|
||||||
|
|
||||||
//Following two are utility functions to snap rendered elements to the pixel grid
|
//Following two are utility functions to snap rendered elements to the pixel grid
|
||||||
//to and from are always 0 <= val <= 1
|
//to and from are always 0 <= val <= 1
|
||||||
qreal SvgPrivate::closestDistance(qreal to, qreal from)
|
qreal SvgPrivate::closestDistance(qreal to, qreal from)
|
||||||
|
@ -385,6 +385,7 @@ class PLASMA_EXPORT Svg : public QObject
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
SvgPrivate *const d;
|
SvgPrivate *const d;
|
||||||
|
bool eventFilter(QObject *watched, QEvent *event);
|
||||||
|
|
||||||
Q_PRIVATE_SLOT(d, void themeChanged())
|
Q_PRIVATE_SLOT(d, void themeChanged())
|
||||||
Q_PRIVATE_SLOT(d, void colorsChanged())
|
Q_PRIVATE_SLOT(d, void colorsChanged())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user