Port Plasma::Svg away from KGlobalSettings
This commit is contained in:
parent
5b17b0f082
commit
18c12fb520
@ -24,6 +24,7 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QDomDocument>
|
||||
#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
|
||||
// a colorscheme
|
||||
if (usesColors && (!themed || !actualTheme()->colorScheme())) {
|
||||
// QObject::connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
|
||||
// q, SLOT(colorsChanged()), Qt::UniqueConnection);
|
||||
} else {
|
||||
// QObject::disconnect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
|
||||
// q, SLOT(colorsChanged()));
|
||||
if (qApp) {
|
||||
if (usesColors && (!themed || !actualTheme()->colorScheme())) {
|
||||
qApp->installEventFilter(q);
|
||||
} else {
|
||||
qApp->removeEventFilter(q);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
//to and from are always 0 <= val <= 1
|
||||
qreal SvgPrivate::closestDistance(qreal to, qreal from)
|
||||
|
@ -385,6 +385,7 @@ class PLASMA_EXPORT Svg : public QObject
|
||||
|
||||
private:
|
||||
SvgPrivate *const d;
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
Q_PRIVATE_SLOT(d, void themeChanged())
|
||||
Q_PRIVATE_SLOT(d, void colorsChanged())
|
||||
|
Loading…
x
Reference in New Issue
Block a user