94
95
96 if (!QQStyleKitAttached::s_instance)
97 QQStyleKitAttached::s_instance =
new QQStyleKitAttached(QGuiApplication::instance());
98 if (!QQStyleKitAttached::s_instance->m_engine && obj)
99 QQStyleKitAttached::s_instance->m_engine = qmlEngine(obj);
100 return QQStyleKitAttached::s_instance.get();
106 connect(QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged,
this, [
this](){
107 if (m_style && QString::compare(m_style->themeName(),
"System"_L1, Qt::CaseInsensitive) == 0)
108 m_style->recreateTheme();
153 if (m_styleUrl == styleUrl)
156 m_styleUrl = styleUrl;
159 QQmlComponent comp(m_engine, QUrl(styleUrl),
this);
160 if (!comp.errors().isEmpty()) {
161 qmlWarning(
this) <<
"Could not create a StyleKit style: " << comp.errorString();
164 auto *style = qobject_cast<QQStyleKitStyle *>(comp.create());
166 qmlWarning(
this) <<
"Could not create a StyleKit style from url: " << styleUrl;
170 style->componentComplete();
173 emit styleUrlChanged();