15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
53
54
55
56
57
58
59
62
63
64
65
66
67
68
69
70
71
72
75
76
77
78
79
80
81
82
83
84
87
88
89
90
91
92
93
96
97
98
99
100
101
102
103
104
105
108
109
110
111
112
113
114
117
118
119
120
121
124
125
126
127
130
131
132
133
134
135
136
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
186
187
188
189
190
193
194
195
196
199
200
201
202
203
204
207
208
209
210
211
212
213
216
217
218
219
220
221
224
225
226
227
230
231
232
233
234
235
236
237
238
239
240
241
242
243
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
306
307
308
309
310
311
312
313
314
315
316
317
318
319
322
323
324
325
326
327
330
331
332
333
336
337
338
339
340
343
344
345
346
347
348
349
352
353
354
355
356
357
358
359
362
363
364
365
366
369
370
371
372
373
374
375
378
379
380
381
382
383
384
385
388
389
390
391
392
393
394
397
398
399
400
403
404
405
406
409
410
411
412
413
414
417
418
419
420
421
422
425
426
427
428
429
430
431
434
435
436
437
438
439
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
461
462
463
464
465
466
467
468
469
470
471
472
473
476
477
478
479
480
483
484
485
486
487
488
491
492
493
494
499
500
501
502
503
504
505
506
507
508
509
510
511
514
515
516
517
520
521
522
523
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
552
553
554
555
556
557
560
561
562
563
564
565
566
569
570
571
572
573
574
577
578
579
580
583
584
585
586
587
588
589
592
593
594
595
596
599
600
601
602
605
606
607
608
609
610
611
612
613
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
640
641
642
643
644
645
648
649
650
651
652
653
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
678
679
680
681
682
683
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
723
724
725
726
727
728
729
730
733
734
735
736
737
738
739
740
741
742
743
744
747
748
749
750
751
752
753
754
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
781
782
783
784
787
788
789
790
791
792
793
796
797
798
799
800
801
802
805
806
807
808
811
812
813
814
815
816
817
820
821
822
823
824
825
826
829
830
831
832
833
834
835
836
839
840
841
842
845
846
847
848
849
850
851
854
855
856
857
858
859
860
864QHash<PropertyPathId_t, QString> QQStyleKitPropertyGroup::s_pathStrings;
873 if (flag == PropertyPathId::Flag::IncludeSubtype) {
874 if (m_pathFlags.testFlag(QQSK::PropertyPathFlag::DelegateSubtype1))
875 return PropertyPathId(property, m_groupSpace.start, QQSK::PropertyGroup::DelegateSubtype1);
876 else if (m_pathFlags.testFlag(QQSK::PropertyPathFlag::DelegateSubtype2))
877 return PropertyPathId(property, m_groupSpace.start, QQSK::PropertyGroup::DelegateSubtype2);
879 return PropertyPathId(property, m_groupSpace.start, QQSK::PropertyGroup::DelegateSubtype0);
885
886
887
888
889
890
891
892
893
894 if (s_pathStrings.contains(m_groupSpace.start))
895 return s_pathStrings[m_groupSpace.start];
897 constexpr PropertyPathId_t rootGroupsSize = nestedGroupsStartSize / nestedGroupCount;
898 const auto metaEnum = QMetaEnum::fromType<QQSK::PropertyGroup>();
900 PropertyPathId_t nestedGroupStart = m_groupSpace.start;
901 PropertyPathId_t nestedGroupSize = rootGroupsSize;
902 PropertyPathId_t nestedGroupIndex = nestedGroupStart / nestedGroupSize;
903 auto groupType = QQSK::PropertyGroup(nestedGroupIndex);
904 if (groupType == QQSK::PropertyGroup::Control)
907 QString groupName = QString::fromLatin1(metaEnum.valueToKey(
static_cast<
int>(groupType)));
908 groupName[0] = groupName[0].toLower();
909 QString pathString = groupName;
912 nestedGroupStart -= nestedGroupIndex * nestedGroupSize;
913 nestedGroupSize /= nestedGroupCount;
914 nestedGroupIndex = nestedGroupStart / nestedGroupSize;
915 groupType = QQSK::PropertyGroup(nestedGroupIndex);
916 if (groupType == QQSK::PropertyGroup::Control)
919 QString groupName = QString::fromLatin1(metaEnum.valueToKey(
static_cast<
int>(groupType)));
920 groupName[0] = groupName[0].toLower();
921 pathString +=
'.'_L1 + groupName;
924 s_pathStrings.insert(m_groupSpace.start, pathString);
931 Q_ASSERT(qobject_cast<
const QQStyleKitControlProperties *>(
this));
933 return static_cast<QQStyleKitControlProperties *>(self);
935 Q_ASSERT(qobject_cast<
const QQStyleKitControlProperties *>(parent()));
936 return static_cast<QQStyleKitControlProperties *>(parent());
942 T *nestedGroup = QQSK::lazyCreate(ptr, controlProperties(), group);
945 nestedGroup->m_pathFlags = m_pathFlags;
947 if (group == QQSK::PropertyGroup::DelegateSubtype1) {
949
950
951
952
953
954
955 nestedGroup->m_pathFlags.setFlag(QQSK::PropertyPathFlag::DelegateSubtype1);
956 nestedGroup->m_groupSpace = m_groupSpace;
957 }
else if (group == QQSK::PropertyGroup::DelegateSubtype2) {
958 nestedGroup->m_pathFlags.setFlag(QQSK::PropertyPathFlag::DelegateSubtype2);
959 nestedGroup->m_groupSpace = m_groupSpace;
962
963
964 const PropertyPathId_t nestedGroupIndex = PropertyPathId_t(group);
965 const PropertyPathId_t nestedGroupSize = m_groupSpace.size / nestedGroupCount;
966 nestedGroup->m_groupSpace.size = nestedGroupSize;
967 nestedGroup->m_groupSpace.start = m_groupSpace.start + (nestedGroupIndex * nestedGroupSize);
969
970
971
972
973
974 Q_ASSERT(nestedGroupSize >= PropertyPathId_t(QQSK::Property::COUNT));
980
981
982
983
984
985
986
987
988
989
990#define CONDITIONALLY_EMIT_SIGNALS_GLOBALLY_FOR(CONTROL_PROPERTIES, GROUP_PATH) if
991 (this == CONTROL_PROPERTIES -> GROUP_PATH ) {
992 for (QQStyleKitReader *reader : QQStyleKitReader::s_allReaders) {
993 const auto baseTypes = QQStyleKitPropertyResolver::baseTypesForType(reader->controlType());
994 if (reader->controlType() != controlType && !baseTypes.contains(controlType))
996 reader->clearLocalStorage();
997 ((reader-> GROUP_PATH ->*changedSignals)(), ...);
1000}
1002template<
typename SUBCLASS>
1004 handleStylePropertiesChanged<SUBCLASS>(changedSignal);
1007template <
typename SUBCLASS,
typename... CHANGED_SIGNALS>
1011
1012
1013
1014
1015
1016
1017
1018 static_assert(std::is_base_of<QQStyleKitPropertyGroup, SUBCLASS>::value,
1019 "SUBCLASS must inherit QQStyleKitPropertyGroup");
1021 auto *group =
static_cast<SUBCLASS *>(
this);
1024 if (objectWrittenTo == QQSK::Subclass::QQStyleKitState) {
1025 ((group->*changedSignals)(), ...);
1027 if (shouldEmitGlobally()) {
1029 const QQStyleKitExtendableControlType type = control->controlType();
1030 group->emitGlobally(type, changedSignals...);
1035 if (objectWrittenTo == QQSK::Subclass::QQStyleKitReader) {
1037
1038
1039
1040 if (shouldEmitLocally())
1041 ((group->*changedSignals)(), ...);
1051
1052
1053 const int startIndex = QQStyleKitPropertyGroup::staticMetaObject.propertyOffset();
1054 const QMetaObject* meta = metaObject();
1055 for (
int i = startIndex; i < meta->propertyCount(); ++i) {
1056 const QMetaProperty prop = meta->property(i);
1057 const QMetaObject* propMetaObject = QMetaType::fromName(prop.typeName()).metaObject();
1058 if (propMetaObject) {
1059 if (propMetaObject->inherits(&QQStyleKitDelegateProperties::staticMetaObject)) {
1061
1062
1065 if (propMetaObject->inherits(&QQStyleKitPropertyGroup::staticMetaObject)) {
1067 QObject *childObj = qvariant_cast<QObject *>(property(prop.name()));
1068 if (
auto *child = qobject_cast<QQStyleKitPropertyGroup *>(childObj))
1069 child->emitChangedForAllStylePropertiesRecursive(emitFlags);
1074 if (!emitFlags.testFlag(EmitFlag::AllProperties)) {
1076 if (emitFlags.testFlag(EmitFlag::Colors)) {
1077 if (prop.metaType() != QMetaType::fromType<QColor>())
1083 Q_ASSERT(prop.hasNotifySignal());
1084 QMetaMethod notify = prop.notifySignal();
1085 notify.invoke(
this, Qt::DirectConnection);
1100 if (parentStyle->loaded() && !parentStyle->m_isUpdatingPalette) {
1102
1103
1104
1105
1106
1107
1108 return parentStyle == QQStyleKitStyle::current();
1115QQStyleKitImageProperties::QQStyleKitImageProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1116 : QQStyleKitPropertyGroup(group, parent)
1120template <
typename... CHANGED_SIGNALS>
1121void QQStyleKitImageProperties::emitGlobally(
1122 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1125 const QQStyleKitControlProperties *cp = controlProperties();
1132QUrl QQStyleKitImageProperties::source()
const
1134 return styleProperty<QUrl>(QQSK::Property::Source);
1137void QQStyleKitImageProperties::setSource(
const QUrl &source)
1139 if (setStyleProperty(QQSK::Property::Source, source))
1140 handleStylePropertyChanged(&QQStyleKitImageProperties::sourceChanged);
1143QColor QQStyleKitImageProperties::color()
const
1145 return styleProperty<QColor>(QQSK::Property::Color);
1148void QQStyleKitImageProperties::setColor(
const QColor &color)
1150 if (setStyleProperty(QQSK::Property::Color, color))
1151 handleStylePropertyChanged(&QQStyleKitImageProperties::colorChanged);
1154QQuickImage::FillMode QQStyleKitImageProperties::fillMode()
const
1156 return styleProperty<QQuickImage::FillMode>(QQSK::Property::FillMode);
1159void QQStyleKitImageProperties::setFillMode(QQuickImage::FillMode fillMode)
1161 if (setStyleProperty(QQSK::Property::FillMode, fillMode))
1162 handleStylePropertyChanged(&QQStyleKitImageProperties::fillModeChanged);
1167QQStyleKitBorderProperties::QQStyleKitBorderProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1168 : QQStyleKitPropertyGroup(group, parent)
1172template <
typename... CHANGED_SIGNALS>
1173void QQStyleKitBorderProperties::emitGlobally(
1174 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1177 const QQStyleKitControlProperties *cp = controlProperties();
1184qreal QQStyleKitBorderProperties::width()
const
1186 return styleProperty<qreal>(QQSK::Property::Width);
1189void QQStyleKitBorderProperties::setWidth(qreal width)
1191 if (setStyleProperty(QQSK::Property::Width, width))
1192 handleStylePropertyChanged(&QQStyleKitBorderProperties::widthChanged);
1195QColor QQStyleKitBorderProperties::color()
const
1197 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1200void QQStyleKitBorderProperties::setColor(
const QColor &color)
1202 if (setStyleProperty(QQSK::Property::Color, color))
1203 handleStylePropertyChanged(&QQStyleKitBorderProperties::colorChanged);
1208QQStyleKitShadowProperties::QQStyleKitShadowProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1209 : QQStyleKitPropertyGroup(group, parent)
1213template <
typename... CHANGED_SIGNALS>
1214void QQStyleKitShadowProperties::emitGlobally(
1215 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1218 const QQStyleKitControlProperties *cp = controlProperties();
1225QColor QQStyleKitShadowProperties::color()
const
1227 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1230void QQStyleKitShadowProperties::setColor(QColor color)
1232 if (setStyleProperty(QQSK::Property::Color, color))
1233 handleStylePropertyChanged(&QQStyleKitShadowProperties::colorChanged);
1236qreal QQStyleKitShadowProperties::opacity()
const
1238 return styleProperty<qreal>(QQSK::Property::Opacity, 1.0);
1241void QQStyleKitShadowProperties::setOpacity(qreal opacity)
1243 if (setStyleProperty(QQSK::Property::Opacity, opacity))
1244 handleStylePropertyChanged(&QQStyleKitShadowProperties::opacityChanged);
1247qreal QQStyleKitShadowProperties::scale()
const
1249 return styleProperty<qreal>(QQSK::Property::Scale, 1.0);
1252void QQStyleKitShadowProperties::setScale(qreal scale)
1254 if (setStyleProperty(QQSK::Property::Scale, scale))
1255 handleStylePropertyChanged(&QQStyleKitShadowProperties::scaleChanged);
1258qreal QQStyleKitShadowProperties::verticalOffset()
const
1260 return styleProperty<qreal>(QQSK::Property::VOffset);
1263void QQStyleKitShadowProperties::setVerticalOffset(qreal verticalOffset)
1265 if (setStyleProperty(QQSK::Property::VOffset, verticalOffset))
1266 handleStylePropertyChanged(&QQStyleKitShadowProperties::verticalOffsetChanged);
1269qreal QQStyleKitShadowProperties::horizontalOffset()
const
1271 return styleProperty<qreal>(QQSK::Property::HOffset);
1274void QQStyleKitShadowProperties::setHorizontalOffset(qreal horizontalOffset)
1276 if (setStyleProperty(QQSK::Property::HOffset, horizontalOffset))
1277 handleStylePropertyChanged(&QQStyleKitShadowProperties::horizontalOffsetChanged);
1280qreal QQStyleKitShadowProperties::blur()
const
1282 return styleProperty<qreal>(QQSK::Property::Blur, 10.0);
1285void QQStyleKitShadowProperties::setBlur(qreal blur)
1287 if (setStyleProperty(QQSK::Property::Blur, blur))
1288 handleStylePropertyChanged(&QQStyleKitShadowProperties::blurChanged);
1291bool QQStyleKitShadowProperties::visible()
const
1293 return styleProperty<
bool>(QQSK::Property::Visible,
true);
1296void QQStyleKitShadowProperties::setVisible(
bool visible)
1298 if (setStyleProperty(QQSK::Property::Visible, visible))
1299 handleStylePropertyChanged(&QQStyleKitShadowProperties::visibleChanged);
1302QQmlComponent *QQStyleKitShadowProperties::delegate()
const
1304 return styleProperty<QQmlComponent *>(QQSK::Property::Delegate);
1307void QQStyleKitShadowProperties::setDelegate(QQmlComponent *delegate)
1309 if (setStyleProperty(QQSK::Property::Delegate, delegate))
1310 handleStylePropertyChanged(&QQStyleKitShadowProperties::delegateChanged);
1315QQStyleKitDelegateProperties::QQStyleKitDelegateProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1316 : QQStyleKitPropertyGroup(group, parent)
1320template <
typename... CHANGED_SIGNALS>
1321void QQStyleKitDelegateProperties::emitGlobally(
1322 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1325 const QQStyleKitControlProperties *cp = controlProperties();
1332qreal QQStyleKitDelegateProperties::radius()
const
1334 return styleProperty<qreal>(QQSK::Property::Radius);
1337void QQStyleKitDelegateProperties::setRadius(qreal radius)
1339 if (setStyleProperty(QQSK::Property::Radius, radius))
1340 handleStylePropertiesChanged<QQStyleKitDelegateProperties>(
1341 &QQStyleKitDelegateProperties::radiusChanged,
1342 &QQStyleKitDelegateProperties::topLeftRadiusChanged,
1343 &QQStyleKitDelegateProperties::topRightRadiusChanged,
1344 &QQStyleKitDelegateProperties::bottomLeftRadiusChanged,
1345 &QQStyleKitDelegateProperties::bottomRightRadiusChanged);
1348qreal QQStyleKitDelegateProperties::topLeftRadius()
const
1350 return styleProperty<qreal>(QQSK::Property::TopLeftRadius, QQSK::Property::Radius);
1353void QQStyleKitDelegateProperties::setTopLeftRadius(qreal radius)
1355 if (setStyleProperty(QQSK::Property::TopLeftRadius, radius))
1356 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topLeftRadiusChanged);
1359qreal QQStyleKitDelegateProperties::topRightRadius()
const
1361 return styleProperty<qreal>(QQSK::Property::TopRightRadius, QQSK::Property::Radius);
1364void QQStyleKitDelegateProperties::setTopRightRadius(qreal radius)
1366 if (setStyleProperty(QQSK::Property::TopRightRadius, radius))
1367 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topRightRadiusChanged);
1370qreal QQStyleKitDelegateProperties::bottomLeftRadius()
const
1372 return styleProperty<qreal>(QQSK::Property::BottomLeftRadius, QQSK::Property::Radius);
1375void QQStyleKitDelegateProperties::setBottomLeftRadius(qreal radius)
1377 if (setStyleProperty(QQSK::Property::BottomLeftRadius, radius))
1378 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomLeftRadiusChanged);
1381qreal QQStyleKitDelegateProperties::bottomRightRadius()
const
1383 return styleProperty<qreal>(QQSK::Property::BottomRightRadius, QQSK::Property::Radius);
1386void QQStyleKitDelegateProperties::setBottomRightRadius(qreal radius)
1388 if (setStyleProperty(QQSK::Property::BottomRightRadius, radius))
1389 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomRightRadiusChanged);
1392qreal QQStyleKitDelegateProperties::scale()
const
1394 return styleProperty<qreal>(QQSK::Property::Scale, 1.0);
1397void QQStyleKitDelegateProperties::setScale(qreal scale)
1399 if (setStyleProperty(QQSK::Property::Scale, scale))
1400 handleStylePropertyChanged(&QQStyleKitDelegateProperties::scaleChanged);
1403qreal QQStyleKitDelegateProperties::rotation()
const
1405 return styleProperty<qreal>(QQSK::Property::Rotation);
1408void QQStyleKitDelegateProperties::setRotation(qreal rotation)
1410 if (setStyleProperty(QQSK::Property::Rotation, rotation))
1411 handleStylePropertyChanged(&QQStyleKitDelegateProperties::rotationChanged);
1414qreal QQStyleKitDelegateProperties::implicitWidth()
const
1416 return styleProperty<qreal>(QQSK::Property::ImplicitWidth);
1419void QQStyleKitDelegateProperties::setImplicitWidth(qreal width)
1421 if (setStyleProperty(QQSK::Property::ImplicitWidth, width))
1422 handleStylePropertyChanged(&QQStyleKitDelegateProperties::implicitWidthChanged);
1425qreal QQStyleKitDelegateProperties::implicitHeight()
const
1427 return styleProperty<qreal>(QQSK::Property::ImplicitHeight);
1430void QQStyleKitDelegateProperties::setImplicitHeight(qreal height)
1432 if (setStyleProperty(QQSK::Property::ImplicitHeight, height))
1433 handleStylePropertyChanged(&QQStyleKitDelegateProperties::implicitHeightChanged);
1436qreal QQStyleKitDelegateProperties::minimumWidth()
const
1438 return styleProperty<qreal>(QQSK::Property::MinimumWidth);
1441void QQStyleKitDelegateProperties::setMinimumWidth(qreal width)
1443 if (setStyleProperty(QQSK::Property::MinimumWidth, width))
1444 handleStylePropertyChanged(&QQStyleKitDelegateProperties::minimumWidthChanged);
1447qreal QQStyleKitDelegateProperties::margins()
const
1449 return styleProperty<qreal>(QQSK::Property::Margins);
1452void QQStyleKitDelegateProperties::setMargins(qreal margins)
1454 if (setStyleProperty(QQSK::Property::Margins, margins))
1455 handleStylePropertiesChanged<QQStyleKitDelegateProperties>(
1456 &QQStyleKitDelegateProperties::marginsChanged,
1457 &QQStyleKitDelegateProperties::leftMarginChanged,
1458 &QQStyleKitDelegateProperties::rightMarginChanged,
1459 &QQStyleKitDelegateProperties::topMarginChanged,
1460 &QQStyleKitDelegateProperties::bottomMarginChanged);
1463qreal QQStyleKitDelegateProperties::leftMargin()
const
1465 return styleProperty<qreal>(QQSK::Property::LeftMargin, QQSK::Property::Margins);
1468void QQStyleKitDelegateProperties::setLeftMargin(qreal margin)
1470 if (setStyleProperty(QQSK::Property::LeftMargin, margin))
1471 handleStylePropertyChanged(&QQStyleKitDelegateProperties::leftMarginChanged);
1474qreal QQStyleKitDelegateProperties::rightMargin()
const
1476 return styleProperty<qreal>(QQSK::Property::RightMargin, QQSK::Property::Margins);
1479void QQStyleKitDelegateProperties::setRightMargin(qreal margin)
1481 if (setStyleProperty(QQSK::Property::RightMargin, margin))
1482 handleStylePropertyChanged(&QQStyleKitDelegateProperties::rightMarginChanged);
1485qreal QQStyleKitDelegateProperties::topMargin()
const
1487 return styleProperty<qreal>(QQSK::Property::TopMargin, QQSK::Property::Margins);
1490void QQStyleKitDelegateProperties::setTopMargin(qreal margin)
1492 if (setStyleProperty(QQSK::Property::TopMargin, margin))
1493 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topMarginChanged);
1496qreal QQStyleKitDelegateProperties::bottomMargin()
const
1498 return styleProperty<qreal>(QQSK::Property::BottomMargin, QQSK::Property::Margins);
1501void QQStyleKitDelegateProperties::setBottomMargin(qreal margin)
1503 if (setStyleProperty(QQSK::Property::BottomMargin, margin))
1504 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomMarginChanged);
1507Qt::Alignment QQStyleKitDelegateProperties::alignment()
const
1509 return styleProperty<Qt::Alignment>(QQSK::Property::Alignment, Qt::AlignLeft | Qt::AlignVCenter);
1512void QQStyleKitDelegateProperties::setAlignment(Qt::Alignment alignment)
1514 if (setStyleProperty(QQSK::Property::Alignment, alignment))
1515 handleStylePropertyChanged(&QQStyleKitDelegateProperties::alignmentChanged);
1518qreal QQStyleKitDelegateProperties::opacity()
const
1520 return styleProperty<qreal>(QQSK::Property::Opacity, 1.0);
1523void QQStyleKitDelegateProperties::setOpacity(qreal opacity)
1525 if (setStyleProperty(QQSK::Property::Opacity, opacity))
1526 handleStylePropertyChanged(&QQStyleKitDelegateProperties::opacityChanged);
1529QColor QQStyleKitDelegateProperties::color()
const
1531 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1534void QQStyleKitDelegateProperties::setColor(
const QColor &color)
1536 if (setStyleProperty(QQSK::Property::Color, color))
1537 handleStylePropertyChanged(&QQStyleKitDelegateProperties::colorChanged);
1540bool QQStyleKitDelegateProperties::visible()
const
1542 return styleProperty<
bool>(QQSK::Property::Visible,
true);
1545void QQStyleKitDelegateProperties::setVisible(
bool visible)
1547 if (setStyleProperty(QQSK::Property::Visible, visible))
1548 handleStylePropertyChanged(&QQStyleKitDelegateProperties::visibleChanged);
1551bool QQStyleKitDelegateProperties::clip()
const
1553 return styleProperty<
bool>(QQSK::Property::Clip,
false);
1556void QQStyleKitDelegateProperties::setClip(
bool clip)
1558 if (setStyleProperty(QQSK::Property::Clip, clip))
1559 handleStylePropertyChanged(&QQStyleKitDelegateProperties::clipChanged);
1562QQuickGradient *QQStyleKitDelegateProperties::gradient()
const
1564 return styleProperty<QQuickGradient *>(QQSK::Property::Gradient);
1567void QQStyleKitDelegateProperties::setGradient(QQuickGradient *gradient)
1569 if (setStyleProperty(QQSK::Property::Gradient, gradient))
1570 handleStylePropertyChanged(&QQStyleKitDelegateProperties::gradientChanged);
1573QObject *QQStyleKitDelegateProperties::data()
const
1575 return styleProperty<QObject *>(QQSK::Property::Data);
1578void QQStyleKitDelegateProperties::setData(QObject *data)
1580 if (setStyleProperty(QQSK::Property::Data, data))
1581 handleStylePropertyChanged(&QQStyleKitDelegateProperties::dataChanged);
1584QQmlComponent *QQStyleKitDelegateProperties::delegate()
const
1586 return styleProperty<QQmlComponent *>(QQSK::Property::Delegate);
1589void QQStyleKitDelegateProperties::setDelegate(QQmlComponent *delegate)
1591 if (setStyleProperty(QQSK::Property::Delegate, delegate))
1592 handleStylePropertyChanged(&QQStyleKitDelegateProperties::delegateChanged);
1595QQStyleKitBorderProperties *QQStyleKitDelegateProperties::border()
const
1597 return lazyCreateGroup(m_border, QQSK::PropertyGroup::Border);
1600QQStyleKitShadowProperties *QQStyleKitDelegateProperties::shadow()
const
1602 return lazyCreateGroup(m_shadow, QQSK::PropertyGroup::Shadow);
1605QQStyleKitImageProperties *QQStyleKitDelegateProperties::image()
const
1607 return lazyCreateGroup(m_image, QQSK::PropertyGroup::Image);
1613 : QQStyleKitDelegateProperties(group, parent)
1619 return lazyCreateGroup(m_first, QQSK::PropertyGroup::DelegateSubtype1);
1624 return lazyCreateGroup(m_second, QQSK::PropertyGroup::DelegateSubtype2);
1630 QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1631 : QQStyleKitDelegateProperties(group, parent)
1635template <
typename... CHANGED_SIGNALS>
1637 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1640 const QQStyleKitControlProperties *cp = controlProperties();
1647 return lazyCreateGroup(m_foreground, QQSK::PropertyGroup::Foreground);
1653 QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1654 : QQStyleKitDelegateProperties(group, parent)
1658template <
typename... CHANGED_SIGNALS>
1660 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1663 const QQStyleKitControlProperties *cp = controlProperties();
1669 return lazyCreateGroup(m_foreground, QQSK::PropertyGroup::Foreground);
1674 return lazyCreateGroup(m_up, QQSK::PropertyGroup::DelegateSubtype1);
1679 return lazyCreateGroup(m_down, QQSK::PropertyGroup::DelegateSubtype2);
1688template <
typename... CHANGED_SIGNALS>
1690 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1698 return styleProperty<QColor>(QQSK::Property::Color);
1703 if (setStyleProperty(QQSK::Property::Color, color))
1704 handleStylePropertyChanged(&QQStyleKitTextProperties::colorChanged);
1709 return styleProperty<Qt::Alignment>(QQSK::Property::Alignment);
1714 if (setStyleProperty(QQSK::Property::Alignment, alignment))
1715 handleStylePropertyChanged(&QQStyleKitTextProperties::alignmentChanged);
1720 return styleProperty<
bool>(QQSK::Property::Bold,
false);
1725 if (setStyleProperty(QQSK::Property::Bold, bold))
1731 return styleProperty<
bool>(QQSK::Property::Italic,
false);
1736 if (setStyleProperty(QQSK::Property::Italic, italic))
1742 return styleProperty<qreal>(QQSK::Property::PointSize);
1747 if (setStyleProperty(QQSK::Property::PointSize, pointSize))
1753 return styleProperty<qreal>(QQSK::Property::Padding);
1758 if (setStyleProperty(QQSK::Property::Padding, padding))
1769 return styleProperty<qreal>(QQSK::Property::LeftPadding, QQSK::Property::Padding);
1774 if (setStyleProperty(QQSK::Property::LeftPadding, padding))
1780 return styleProperty<qreal>(QQSK::Property::RightPadding, QQSK::Property::Padding);
1785 if (setStyleProperty(QQSK::Property::RightPadding, padding))
1791 return styleProperty<qreal>(QQSK::Property::TopPadding, QQSK::Property::Padding);
1796 if (setStyleProperty(QQSK::Property::TopPadding, padding))
1802 return styleProperty<qreal>(QQSK::Property::BottomPadding, QQSK::Property::Padding);
1807 if (setStyleProperty(QQSK::Property::BottomPadding, padding))
1813QQStyleKitControlProperties::QQStyleKitControlProperties(QQSK::PropertyGroup group, QObject *parent)
1814 : QQStyleKitPropertyGroup(group, parent)
1817
1818
1819
1820
1821 m_groupSpace.size = nestedGroupsStartSize;
1822 m_groupSpace.start = 0;
1824 if (group == QQSK::PropertyGroup::GlobalFlag) {
1826
1827
1828
1829
1830
1831
1832 m_pathFlags.setFlag(QQSK::PropertyPathFlag::Global);
1836QQStyleKitStyle *QQStyleKitControlProperties::style()
const
1838 if (subclass() == QQSK::Subclass::QQStyleKitState) {
1840
1841
1842
1843
1844
1845
1846 QObject *obj = parent();
1847 while (obj && !obj->metaObject()->inherits(&QQStyleKitStyle::staticMetaObject))
1848 obj = obj->parent();
1849 return obj ?
static_cast<QQStyleKitStyle *>(obj) :
nullptr;
1852 if (subclass() == QQSK::Subclass::QQStyleKitReader) {
1853 const auto *reader =
static_cast<
const QQStyleKitReader *>(
this);
1854 if (reader->m_explicitStyle)
1855 return reader->m_explicitStyle;
1859 return QQStyleKitStyle::current();
1862QQSK::Subclass QQStyleKitControlProperties::subclass()
const
1865
1866
1867
1868
1869
1870 if (metaObject()->inherits(&QQStyleKitReader::staticMetaObject))
1871 return QQSK::Subclass::QQStyleKitReader;
1872 if (metaObject()->inherits(&QQStyleKitControlState::staticMetaObject))
1873 return QQSK::Subclass::QQStyleKitState;
1877QQStyleKitReader *QQStyleKitControlProperties::asQQStyleKitReader()
const
1879 Q_ASSERT(subclass() == QQSK::Subclass::QQStyleKitReader);
1880 return static_cast<QQStyleKitReader *>(
const_cast<QQStyleKitControlProperties *>(
this));
1883QQStyleKitControlState *QQStyleKitControlProperties::asQQStyleKitState()
const
1885 Q_ASSERT(subclass() == QQSK::Subclass::QQStyleKitState);
1886 Q_ASSERT(metaObject()->inherits(&QQStyleKitControlState::staticMetaObject));
1887 return static_cast<QQStyleKitControlState *>(
const_cast<QQStyleKitControlProperties *>(
this));
1890void QQStyleKitControlProperties::forEachUsedDelegate(
1891 std::function<
void (QQStyleKitDelegateProperties *, QQSK::Delegate,
const QString &)> f)
1895 f(m_background, QQSK::Delegate::Background,
"background"_L1);
1898 f(m_indicator, QQSK::Delegate::Indicator,
"indicator"_L1);
1899 if (m_indicator->m_foreground)
1900 f(m_indicator->m_foreground, QQSK::Delegate::IndicatorForeground,
"indicator.foreground"_L1);
1901 if (m_indicator->m_up) {
1902 f(m_indicator->m_up, QQSK::Delegate::IndicatorUp,
"indicator.up"_L1);
1903 if (m_indicator->m_up->m_foreground)
1904 f(m_indicator->m_up->m_foreground, QQSK::Delegate::IndicatorUpForeground,
"indicator.up.foreground"_L1);
1906 if (m_indicator->m_down) {
1907 f(m_indicator->m_down, QQSK::Delegate::IndicatorDown,
"indicator.down"_L1);
1908 if (m_indicator->m_down->m_foreground)
1909 f(m_indicator->m_down->m_foreground, QQSK::Delegate::IndicatorDownForeground,
"indicator.down.foreground"_L1);
1914 f(m_handle, QQSK::Delegate::Handle,
"handle"_L1);
1915 if (m_handle->m_first)
1916 f(m_handle->m_first, QQSK::Delegate::HandleFirst,
"handle.first"_L1);
1917 if (m_handle->m_second)
1918 f(m_handle->m_second, QQSK::Delegate::HandleSecond,
"handle.second"_L1);
1922void QQStyleKitControlProperties::emitChangedForAllStyleProperties(EmitFlags emitFlags)
1925
1926
1927 if (emitFlags.testFlag(EmitFlag::AllProperties)) {
1928 emit leftPaddingChanged();
1929 emit rightPaddingChanged();
1930 emit topPaddingChanged();
1931 emit bottomPaddingChanged();
1932 emit spacingChanged();
1933 emit transitionChanged();
1937 forEachUsedDelegate([=](QQStyleKitDelegateProperties *delegate, QQSK::Delegate,
const QString &){
1938 delegate->emitChangedForAllStylePropertiesRecursive(emitFlags);
1942template <
typename... CHANGED_SIGNALS>
1943void QQStyleKitControlProperties::emitGlobally(
1944 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1946 for (QQStyleKitReader *reader : QQStyleKitReader::s_allReaders) {
1947 if (reader->controlType() != controlType)
1949 ((reader->*changedSignals)(), ...);
1953qreal QQStyleKitControlProperties::spacing()
const
1955 return styleProperty<qreal>(QQSK::Property::Spacing);
1958void QQStyleKitControlProperties::setSpacing(qreal spacing)
1960 if (setStyleProperty(QQSK::Property::Spacing, spacing))
1961 handleStylePropertyChanged(&QQStyleKitControlProperties::spacingChanged);
1964qreal QQStyleKitControlProperties::padding()
const
1966 return styleProperty<qreal>(QQSK::Property::Padding);
1969void QQStyleKitControlProperties::setPadding(qreal padding)
1971 if (setStyleProperty(QQSK::Property::Padding, padding))
1972 handleStylePropertiesChanged<QQStyleKitControlProperties>(
1973 &QQStyleKitControlProperties::paddingChanged,
1974 &QQStyleKitControlProperties::leftPaddingChanged,
1975 &QQStyleKitControlProperties::rightPaddingChanged,
1976 &QQStyleKitControlProperties::topPaddingChanged,
1977 &QQStyleKitControlProperties::bottomPaddingChanged);
1980qreal QQStyleKitControlProperties::leftPadding()
const
1982 return styleProperty<qreal>(QQSK::Property::LeftPadding, QQSK::Property::Padding);
1985void QQStyleKitControlProperties::setLeftPadding(qreal leftPadding)
1987 if (setStyleProperty(QQSK::Property::LeftPadding, leftPadding))
1988 handleStylePropertyChanged(&QQStyleKitControlProperties::leftPaddingChanged);
1991qreal QQStyleKitControlProperties::rightPadding()
const
1993 return styleProperty<qreal>(QQSK::Property::RightPadding, QQSK::Property::Padding);
1996void QQStyleKitControlProperties::setRightPadding(qreal rightPadding)
1998 if (setStyleProperty(QQSK::Property::RightPadding, rightPadding))
1999 handleStylePropertyChanged(&QQStyleKitControlProperties::rightPaddingChanged);
2002qreal QQStyleKitControlProperties::topPadding()
const
2004 return styleProperty<qreal>(QQSK::Property::TopPadding, QQSK::Property::Padding);
2007void QQStyleKitControlProperties::setTopPadding(qreal topPadding)
2009 if (setStyleProperty(QQSK::Property::TopPadding, topPadding))
2010 handleStylePropertyChanged(&QQStyleKitControlProperties::topPaddingChanged);
2013qreal QQStyleKitControlProperties::bottomPadding()
const
2015 return styleProperty<qreal>(QQSK::Property::BottomPadding, QQSK::Property::Padding);
2018void QQStyleKitControlProperties::setBottomPadding(qreal bottomPadding)
2020 if (setStyleProperty(QQSK::Property::BottomPadding, bottomPadding))
2021 handleStylePropertyChanged(&QQStyleKitControlProperties::bottomPaddingChanged);
2024QQuickTransition *QQStyleKitControlProperties::transition()
const
2026 return styleProperty<QQuickTransition *>(QQSK::Property::Transition);
2029void QQStyleKitControlProperties::setTransition(QQuickTransition *transition)
2031 if (setStyleProperty(QQSK::Property::Transition, transition))
2032 handleStylePropertyChanged(&QQStyleKitControlProperties::transitionChanged);
2035QQStyleKitTextProperties *QQStyleKitControlProperties::text()
const
2037 return lazyCreateGroup(m_text, QQSK::PropertyGroup::Text);
2040QQStyleKitDelegateProperties *QQStyleKitControlProperties::background()
const
2042 return lazyCreateGroup(m_background, QQSK::PropertyGroup::Background);
2045QQStyleKitHandleProperties *QQStyleKitControlProperties::handle()
const
2047 return lazyCreateGroup(m_handle, QQSK::PropertyGroup::Handle);
2050QQStyleKitIndicatorWithSubTypes *QQStyleKitControlProperties::indicator()
const
2052 return lazyCreateGroup(m_indicator, QQSK::PropertyGroup::Indicator);
2057#include "moc_qqstylekitcontrolproperties_p.cpp"
QQStyleKitDelegateProperties * first() const
QQStyleKitDelegateProperties * second() const
QQStyleKitDelegateProperties * foreground() const
void emitGlobally(QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals) const
void emitGlobally(QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals) const
QQStyleKitDelegateProperties * foreground() const
QQStyleKitIndicatorProperties * down() const
QQStyleKitIndicatorProperties * up() const
void emitChangedForAllStylePropertiesRecursive(EmitFlags emitFlags)
T * lazyCreateGroup(T *const &ptr, QQSK::PropertyGroup group) const
void handleStylePropertyChanged(void(SUBCLASS::*changedSignal)())
void handleStylePropertiesChanged(CHANGED_SIGNALS... changedSignals)
QQStyleKitControlProperties * controlProperties() const
QString pathToString() const
bool isControlProperties() const
void setRightPadding(qreal rightPadding)
void setBottomPadding(qreal bottomPadding)
void setTopPadding(qreal topPadding)
void setLeftPadding(qreal leftPadding)
void setPadding(qreal padding)
qreal rightPadding() const
void setItalic(bool italic)
qreal bottomPadding() const
void setPointSize(qreal pointSize)
void setColor(const QColor &color)
void bottomPaddingChanged()
Qt::Alignment alignment() const
void emitGlobally(QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals) const
void rightPaddingChanged()
void leftPaddingChanged()
qreal leftPadding() const
Combined button and popup list for selecting options.
#define CONDITIONALLY_EMIT_SIGNALS_GLOBALLY_FOR(CONTROL_PROPERTIES, GROUP_PATH)