32 lines
871 B
C++
32 lines
871 B
C++
![]() |
#include "kystylehelper.h"
|
||
|
|
||
|
#include <QQuickWindow>
|
||
|
#include <QGSettings/QGSettings>
|
||
|
|
||
|
#include <QWidget>
|
||
|
|
||
|
KyStyleHelper::KyStyleHelper(QQuickItem *parent)
|
||
|
: QQuickItem(parent)
|
||
|
{
|
||
|
if (QGSettings::isSchemaInstalled("org.ukui.style")) {
|
||
|
QGSettings* styleSettings = new QGSettings("org.ukui.style", QByteArray(), this);
|
||
|
connect(styleSettings, &QGSettings::changed, this, [&](const QString &key){
|
||
|
if (key == "styleName") {
|
||
|
emit paletteChanged();
|
||
|
emit qcolorChanged();
|
||
|
}
|
||
|
if (key == "systemFontSize" || key == "systemFont") {
|
||
|
emit fontChanged();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
KyStyleHelper::~KyStyleHelper() {}
|
||
|
|
||
|
KyStyleHelper* KyStyleHelper::qmlAttachedProperties(QObject *parent)
|
||
|
{
|
||
|
auto p = qobject_cast<QQuickItem*>(parent);
|
||
|
return new KyStyleHelper(p);
|
||
|
}
|