19template <
typename EnumType>
22 auto propertyMetaEnum = QMetaEnum::fromType<EnumType>();
23 return QString::fromUtf8(propertyMetaEnum.valueToKeys(quint64(enumValue)));
27 QString str = QString::fromLatin1(obj->metaObject()->className());
28 int idx = str.indexOf(
"_QMLTYPE"_L1);
32 const QString prefix(
"QQStyleKit"_L1);
33 if (str.startsWith(prefix))
34 str = str.mid(prefix.length());
36 const QString name = obj->objectName();
38 str = str +
"("_L1 + name +
")"_L1;
44 const QStringList list = enumToString(state).split(
'|'_L1);
45 return "["_L1 + list.join(
','_L1) +
"]"_L1;
50 return "StyleKitReader"_L1 + stateToString(reader->controlState());
55 const QString path = group->pathToString();
56 QString propertyName = enumToString(property.property());
57 propertyName[0] = propertyName[0].toLower();
60 return path + kDot + propertyName;
65 const QObject *parentObj = control->parent();
67 return "<no parent>"_L1;
70 return "<"_L1 + QString::fromUtf8(parentObj->metaObject()->className()) +
">"_L1;
73 const int startIndex = QQStyleKitControlProperties::staticMetaObject.propertyOffset();
74 const int endIndex = QQStyleKitControlProperties::staticMetaObject.propertyCount();
76 const QMetaObject* parentMeta = parentObj->metaObject();
77 for (
int i = startIndex; i < endIndex; ++i) {
78 const QMetaProperty prop = parentMeta->property(i);
79 const QMetaObject* typeMeta = QMetaType::fromName(prop.typeName()).metaObject();
80 if (!typeMeta || !typeMeta->inherits(&QQStyleKitControl::staticMetaObject))
83 QObject *propObj = prop.read(parentObj).value<QObject *>();
84 if (propObj == control)
85 return QString::fromUtf8(prop.name());
87 return "<unknown control: no property found>"_L1;
93 const QObject *obj = properties;
99 if (
auto *theme = qobject_cast<
const QQStyleKitCustomTheme *>(obj)) {
100 path.prepend(theme->name() + kDot);
101 }
else if (
auto *theme = qobject_cast<
const QQStyleKitTheme *>(obj)) {
103 if (
auto style = theme->style())
104 path.prepend(style->themeName());
106 path.prepend(objectName(obj));
107 }
else if (
auto *control = qobject_cast<
const QQStyleKitControl *>(obj)) {
108 path.prepend(controlToString(control));
109 }
else if (
auto *reader = qobject_cast<
const QQStyleKitReader *>(obj)) {
110 path.prepend(styleReaderToString(reader));
112 path.prepend(objectName(obj));
127 const QQSK::State state,
128 const QVariant &value)
133 if (reader->subclass() == QQSK::Subclass::QQStyleKitState) {
135
136
140 if (!insideControl(reader)) {
145 const QString _readerPath = objectPath(reader, m_item);
146 const QString _readPropertyPath = propertyPath(QQStyleKitDebug::groupBeingRead, property);
147 const QString queriedPath = _readerPath + kDot +_readPropertyPath;
150 if (storage->subclass() == QQSK::Subclass::QQStyleKitReader) {
152
153
155 storagePath =
"[local storage] "_L1;
160 const QString _controlPathInStyle = objectPath(storage, storage->style());
161 const QString _statePath = stateToString(state);
162 storagePath = _controlPathInStyle + _statePath;
165 QString valueString = value.toString();
166 if (!value.isValid())
167 valueString =
"<undefined>"_L1;
168 else if (valueString.isEmpty())
169 valueString =
"<object>"_L1;
171 const QString output = queriedPath +
" -> "_L1 + storagePath +
" = "_L1 + valueString;
173 if (!QRegularExpression(m_filter).match(output).hasMatch())
176 qDebug().nospace().noquote() << m_outputCount++ <<
" | [read] "_L1 << output;
181 const QQSK::Property property,
183 const QQSK::State state,
184 const PropertyStorageId key,
185 const QVariant &value)
196
198 if (storage->subclass() == QQSK::Subclass::QQStyleKitReader) {
199 storagePath =
"[local storage]"_L1;
201 const QString _controlPathInStyle = objectPath(storage, storage->style());
202 const QString _statePath = stateToString(state);
203 storagePath = _controlPathInStyle + _statePath;
206 QString valueString = value.toString();
207 if (!value.isValid())
208 valueString =
"<undefined>"_L1;
209 else if (valueString.isEmpty())
210 valueString =
"<object>"_L1;
212 const QString path = propertyPath(group, property);
213 const QString output = storagePath + kDot + path +
" (storage key:"_L1 + QString::number(key) +
") = "_L1 + valueString;
215 qDebug().nospace().noquote() << m_outputCount++ <<
" | [write] "_L1 << output;
222 if (!insideControl(reader)) {
227 const QString _readerPath = objectPath(reader, m_item);
228 const QString _propertyPath = propertyPath(QQStyleKitDebug::groupBeingRead, property);
229 const QString queriedPath = _readerPath + kDot +_propertyPath;
230 const QString output = queriedPath +
" -> <property not set>"_L1;
232 if (!QRegularExpression(m_filter).match(output).hasMatch())
235 qDebug().nospace().noquote() << m_outputCount++ <<
" | [read] "_L1 << output;
241 const QQSK::State state,
242 const PropertyStorageId key)
250 const QQStyleKitControlProperties *reader = QQStyleKitDebug::groupBeingRead->controlProperties();
251 if (reader->subclass() == QQSK::Subclass::QQStyleKitState) {
253
254
258 if (!insideControl(reader)) {
263 const QString _readerPath = objectPath(reader, m_item);
264 const QString _readPropertyPath = propertyPath(QQStyleKitDebug::groupBeingRead, property);
265 const QString queriedPath = _readerPath + kDot +_readPropertyPath;
268 if (storage->subclass() == QQSK::Subclass::QQStyleKitReader) {
270
271
273 storagePath =
"[local storage]"_L1;
278 const QString _controlPathInStyle = objectPath(storage, storage->style());
279 const QString _statePath = stateToString(state);
280 storagePath = _controlPathInStyle + _statePath;
283 const QString output = queriedPath +
", checking "_L1 + storagePath +
" (storage key:"_L1 + QString::number(key)+
")"_L1;
285 if (!QRegularExpression(m_filter).match(output).hasMatch())
288 qDebug().nospace().noquote() << m_outputCount++ <<
" | [trace] "_L1 << output;
303 emit controlChanged();
313 if (m_filter == filter)
317 emit filterChanged();
324 const QObject *obj = child;
335#include "moc_qqstylekitdebug_p.cpp"
void setFilter(const QString &filter)
void setControl(QQuickItem *item)
QQStyleKitControlProperties * controlProperties() const
Combined button and popup list for selecting options.