8#include "settinghighlighterprivate.h"
10#include <QGuiApplication>
25 auto result = children;
26 for (
auto child : children) {
27 result += findDescendantItems(child);
34 const auto className = itemClassName(item);
36 auto descendant = findDescendantItems(item);
37 for (
auto child : std::as_const(descendant)) {
38 if (className.contains(
"FontWidget") && itemClassName(child).contains(
"TextField")) {
39 return child->property(
"background").value<
QQuickItem *>();
41 if (itemClassName(child).contains(
"GridViewInternal")) {
44 if (itemClassName(child).contains(
"GridView")) {
45 return child->property(
"view").value<
QQuickItem *>();
47 if (itemClassName(child).contains(
"CheckIndicator")
48 || itemClassName(child).contains(
"KQuickStyleItem")) {
57QQuickItem *SettingHighlighterPrivate::target()
const
62void SettingHighlighterPrivate::setTarget(
QQuickItem *target)
64 if (m_target == target) {
69 disconnect(m_target, &QQuickItem::childrenChanged,
this, &SettingHighlighterPrivate::updateTarget);
75 connect(m_target, &QQuickItem::childrenChanged,
this, &SettingHighlighterPrivate::updateTarget);
82bool SettingHighlighterPrivate::highlight()
const
87void SettingHighlighterPrivate::setHighlight(
bool highlight)
89 if (m_highlight == highlight) {
93 m_highlight = highlight;
98bool SettingHighlighterPrivate::defaultIndicatorVisible()
const
103void SettingHighlighterPrivate::setDefaultIndicatorVisible(
bool enabled)
105 if (m_enabled == enabled) {
110 Q_EMIT defaultIndicatorVisibleChanged(m_enabled);
114void SettingHighlighterPrivate::updateTarget()
116 if (!m_isComponentComplete) {
120 if (!m_styleTarget && m_target) {
121 m_styleTarget = findStyleItem(m_target);
125 if (itemClassName(m_styleTarget).contains(
"GridViewInternal")) {
126 m_styleTarget->setProperty(
"neutralHighlight", m_highlight && m_enabled);
128 m_styleTarget->setProperty(
"_kde_highlight_neutral", m_highlight && m_enabled);
130 m_styleTarget->polish();
134void SettingHighlighterPrivate::componentComplete()
136 m_isComponentComplete =
true;
141#include "moc_settinghighlighterprivate.cpp"
QList< QByteArray > split(char sep) const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool disconnect(const QMetaObject::Connection &connection)
QList< QQuickItem * > childItems() const const