14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
52
53
54
55
56
57
58
61
62
63
64
65
66
67
68
69
70
71
74
75
76
77
78
79
80
81
82
83
86
87
88
89
90
91
92
95
96
97
98
99
100
101
102
103
104
107
108
109
110
111
112
113
116
117
118
119
120
123
124
125
126
129
130
131
132
133
134
135
138
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
334
335
336
337
338
339
340
341
342
343
344
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
364
365
366
367
368
369
370
373
374
375
376
377
378
379
380
383
384
385
386
387
390
391
392
393
394
397
398
399
400
401
402
403
404
405
406
407
408
409
410
413
414
415
416
417
418
419
420
421
422
423
424
425
426
429
430
431
432
433
434
435
438
439
440
441
442
443
444
445
448
449
450
451
452
453
454
457
458
459
460
463
464
465
466
469
470
471
472
473
474
477
478
479
480
481
482
485
486
487
488
489
490
491
494
495
496
497
498
499
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
521
522
523
524
525
526
527
528
529
530
531
532
533
536
537
538
539
540
543
544
545
546
547
548
551
552
553
554
559
560
561
562
563
564
565
566
567
568
569
570
571
574
575
576
577
580
581
582
583
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
612
613
614
615
616
617
620
621
622
623
624
625
626
629
630
631
632
633
634
637
638
639
640
643
644
645
646
647
648
649
652
653
654
655
656
659
660
661
662
665
666
667
668
669
670
671
672
673
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
700
701
702
703
704
705
708
709
710
711
712
713
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
740
741
742
743
744
745
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
793
794
795
796
797
798
799
800
801
802
803
804
807
808
809
810
811
812
813
814
815
816
817
818
819
820
823
824
825
826
827
828
829
830
831
832
833
834
835
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
862
863
864
865
868
869
870
871
872
873
874
877
878
879
880
881
882
883
886
887
888
889
892
893
894
895
896
897
898
901
902
903
904
905
906
907
910
911
912
913
914
915
916
917
920
921
922
923
926
927
928
929
930
931
932
935
936
937
938
939
940
941
944
945
946
947
948
949
950
951
954
955
956
957
958
959
960
961
965QHash<PropertyPathId_t, QString> QQStyleKitPropertyGroup::s_pathStrings;
974 if (flag == PropertyPathId::Flag::IncludeSubtype) {
975 if (m_pathFlags.testFlag(QQSK::PropertyPathFlag::DelegateSubtype1))
976 return PropertyPathId(property, m_groupSpace.start, QQSK::PropertyGroup::DelegateSubtype1);
977 else if (m_pathFlags.testFlag(QQSK::PropertyPathFlag::DelegateSubtype2))
978 return PropertyPathId(property, m_groupSpace.start, QQSK::PropertyGroup::DelegateSubtype2);
980 return PropertyPathId(property, m_groupSpace.start, QQSK::PropertyGroup::DelegateSubtype0);
986
987
988
989
990
991
992
993
994
995 if (s_pathStrings.contains(m_groupSpace.start))
996 return s_pathStrings[m_groupSpace.start];
998 constexpr PropertyPathId_t rootGroupsSize = nestedGroupsStartSize / nestedGroupCount;
999 const auto metaEnum = QMetaEnum::fromType<QQSK::PropertyGroup>();
1001 PropertyPathId_t nestedGroupStart = m_groupSpace.start;
1002 PropertyPathId_t nestedGroupSize = rootGroupsSize;
1003 PropertyPathId_t nestedGroupIndex = nestedGroupStart / nestedGroupSize;
1004 auto groupType = QQSK::PropertyGroup(nestedGroupIndex);
1005 if (groupType == QQSK::PropertyGroup::Control)
1008 QString groupName = QString::fromLatin1(metaEnum.valueToKey(
static_cast<
int>(groupType)));
1009 groupName[0] = groupName[0].toLower();
1010 QString pathString = groupName;
1013 nestedGroupStart -= nestedGroupIndex * nestedGroupSize;
1014 nestedGroupSize /= nestedGroupCount;
1015 nestedGroupIndex = nestedGroupStart / nestedGroupSize;
1016 groupType = QQSK::PropertyGroup(nestedGroupIndex);
1017 if (groupType == QQSK::PropertyGroup::Control)
1020 QString groupName = QString::fromLatin1(metaEnum.valueToKey(
static_cast<
int>(groupType)));
1021 groupName[0] = groupName[0].toLower();
1022 pathString +=
'.'_L1 + groupName;
1025 s_pathStrings.insert(m_groupSpace.start, pathString);
1032 Q_ASSERT(qobject_cast<
const QQStyleKitControlProperties *>(
this));
1034 return static_cast<QQStyleKitControlProperties *>(self);
1036 Q_ASSERT(qobject_cast<
const QQStyleKitControlProperties *>(parent()));
1037 return static_cast<QQStyleKitControlProperties *>(parent());
1043 T *nestedGroup = QQSK::lazyCreate(ptr, controlProperties(), group);
1046 nestedGroup->m_pathFlags = m_pathFlags;
1048 if (group == QQSK::PropertyGroup::DelegateSubtype1) {
1050
1051
1052
1053
1054
1055
1056 nestedGroup->m_pathFlags.setFlag(QQSK::PropertyPathFlag::DelegateSubtype1);
1057 nestedGroup->m_groupSpace = m_groupSpace;
1058 }
else if (group == QQSK::PropertyGroup::DelegateSubtype2) {
1059 nestedGroup->m_pathFlags.setFlag(QQSK::PropertyPathFlag::DelegateSubtype2);
1060 nestedGroup->m_groupSpace = m_groupSpace;
1063
1064
1065 const PropertyPathId_t nestedGroupIndex = PropertyPathId_t(group);
1066 const PropertyPathId_t nestedGroupSize = m_groupSpace.size / nestedGroupCount;
1067 nestedGroup->m_groupSpace.size = nestedGroupSize;
1068 nestedGroup->m_groupSpace.start = m_groupSpace.start + (nestedGroupIndex * nestedGroupSize);
1070
1071
1072
1073
1074
1075 Q_ASSERT(nestedGroupSize >= PropertyPathId_t(QQSK::Property::COUNT));
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091#define CONDITIONALLY_EMIT_SIGNALS_GLOBALLY_FOR(CONTROL_PROPERTIES, GROUP_PATH) if
1092 (this == CONTROL_PROPERTIES -> GROUP_PATH ) {
1093 for (QQStyleKitReader *reader : QQStyleKitReader::s_allReaders) {
1094 const auto baseTypes = QQStyleKitPropertyResolver::baseTypesForType(reader->controlType());
1095 if (reader->controlType() != controlType && !baseTypes.contains(controlType))
1097 reader->clearLocalStorage();
1098 ((reader-> GROUP_PATH ->*changedSignals)(), ...);
1101}
1103template<
typename SUBCLASS>
1105 handleStylePropertiesChanged<SUBCLASS>(changedSignal);
1108template <
typename SUBCLASS,
typename... CHANGED_SIGNALS>
1112
1113
1114
1115
1116
1117
1118
1119 static_assert(std::is_base_of<QQStyleKitPropertyGroup, SUBCLASS>::value,
1120 "SUBCLASS must inherit QQStyleKitPropertyGroup");
1122 auto *group =
static_cast<SUBCLASS *>(
this);
1125 if (objectWrittenTo == QQSK::Subclass::QQStyleKitState) {
1126 ((group->*changedSignals)(), ...);
1128 if (shouldEmitGlobally()) {
1130 const QQStyleKitExtendableControlType type = control->controlType();
1131 group->emitGlobally(type, changedSignals...);
1136 if (objectWrittenTo == QQSK::Subclass::QQStyleKitReader) {
1138
1139
1140
1141 if (shouldEmitLocally()) {
1144
1145
1146
1147
1148 if (!reader->m_target)
1149 ((group->*changedSignals)(), ...);
1151 QCoreApplication::postEvent(reader->m_target,
new QEvent(QEvent::StyleAnimationUpdate));
1162
1163
1164 const int startIndex = QQStyleKitPropertyGroup::staticMetaObject.propertyOffset();
1165 const QMetaObject* meta = metaObject();
1166 for (
int i = startIndex; i < meta->propertyCount(); ++i) {
1167 const QMetaProperty prop = meta->property(i);
1168 const QMetaObject* propMetaObject = QMetaType::fromName(prop.typeName()).metaObject();
1169 if (propMetaObject) {
1170 if (propMetaObject->inherits(&QQStyleKitDelegateProperties::staticMetaObject)) {
1172
1173
1176 if (propMetaObject->inherits(&QQStyleKitPropertyGroup::staticMetaObject)) {
1178 QObject *childObj = qvariant_cast<QObject *>(property(prop.name()));
1179 if (
auto *child = qobject_cast<QQStyleKitPropertyGroup *>(childObj))
1180 child->emitChangedForAllStylePropertiesRecursive(emitFlags);
1185 if (!emitFlags.testFlag(EmitFlag::AllProperties)) {
1187 if (emitFlags.testFlag(EmitFlag::Colors)) {
1188 if (prop.metaType() != QMetaType::fromType<QColor>())
1194 Q_ASSERT(prop.hasNotifySignal());
1195 QMetaMethod notify = prop.notifySignal();
1196 notify.invoke(
this, Qt::DirectConnection);
1211 if (parentStyle->loaded() && !parentStyle->m_isUpdatingPalette) {
1213
1214
1215
1216
1217
1218
1219 return parentStyle == QQStyleKitStyle::current();
1226QQStyleKitImageProperties::QQStyleKitImageProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1227 : QQStyleKitPropertyGroup(group, parent)
1231template <
typename... CHANGED_SIGNALS>
1232void QQStyleKitImageProperties::emitGlobally(
1233 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1236 const QQStyleKitControlProperties *cp = controlProperties();
1243QUrl QQStyleKitImageProperties::source()
const
1245 return styleProperty<QUrl>(QQSK::Property::Source);
1248void QQStyleKitImageProperties::setSource(
const QUrl &source)
1250 if (setStyleProperty(QQSK::Property::Source, source))
1251 handleStylePropertyChanged(&QQStyleKitImageProperties::sourceChanged);
1254QColor QQStyleKitImageProperties::color()
const
1256 return styleProperty<QColor>(QQSK::Property::Color);
1259void QQStyleKitImageProperties::setColor(
const QColor &color)
1261 if (setStyleProperty(QQSK::Property::Color, color))
1262 handleStylePropertyChanged(&QQStyleKitImageProperties::colorChanged);
1265QQuickImage::FillMode QQStyleKitImageProperties::fillMode()
const
1267 return styleProperty<QQuickImage::FillMode>(QQSK::Property::FillMode);
1270void QQStyleKitImageProperties::setFillMode(QQuickImage::FillMode fillMode)
1272 if (setStyleProperty(QQSK::Property::FillMode, fillMode))
1273 handleStylePropertyChanged(&QQStyleKitImageProperties::fillModeChanged);
1278QQStyleKitBorderProperties::QQStyleKitBorderProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1279 : QQStyleKitPropertyGroup(group, parent)
1283template <
typename... CHANGED_SIGNALS>
1284void QQStyleKitBorderProperties::emitGlobally(
1285 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1288 const QQStyleKitControlProperties *cp = controlProperties();
1295qreal QQStyleKitBorderProperties::width()
const
1297 return styleProperty<qreal>(QQSK::Property::Width);
1300void QQStyleKitBorderProperties::setWidth(qreal width)
1302 if (setStyleProperty(QQSK::Property::Width, width))
1303 handleStylePropertyChanged(&QQStyleKitBorderProperties::widthChanged);
1306QColor QQStyleKitBorderProperties::color()
const
1308 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1311void QQStyleKitBorderProperties::setColor(
const QColor &color)
1313 if (setStyleProperty(QQSK::Property::Color, color))
1314 handleStylePropertyChanged(&QQStyleKitBorderProperties::colorChanged);
1319QQStyleKitShadowProperties::QQStyleKitShadowProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1320 : QQStyleKitPropertyGroup(group, parent)
1324template <
typename... CHANGED_SIGNALS>
1325void QQStyleKitShadowProperties::emitGlobally(
1326 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1329 const QQStyleKitControlProperties *cp = controlProperties();
1336QColor QQStyleKitShadowProperties::color()
const
1338 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1341void QQStyleKitShadowProperties::setColor(QColor color)
1343 if (setStyleProperty(QQSK::Property::Color, color))
1344 handleStylePropertyChanged(&QQStyleKitShadowProperties::colorChanged);
1347qreal QQStyleKitShadowProperties::opacity()
const
1349 return styleProperty<qreal>(QQSK::Property::Opacity, 1.0);
1352void QQStyleKitShadowProperties::setOpacity(qreal opacity)
1354 if (setStyleProperty(QQSK::Property::Opacity, opacity))
1355 handleStylePropertyChanged(&QQStyleKitShadowProperties::opacityChanged);
1358qreal QQStyleKitShadowProperties::scale()
const
1360 return styleProperty<qreal>(QQSK::Property::Scale, 1.0);
1363void QQStyleKitShadowProperties::setScale(qreal scale)
1365 if (setStyleProperty(QQSK::Property::Scale, scale))
1366 handleStylePropertyChanged(&QQStyleKitShadowProperties::scaleChanged);
1369qreal QQStyleKitShadowProperties::verticalOffset()
const
1371 return styleProperty<qreal>(QQSK::Property::VOffset);
1374void QQStyleKitShadowProperties::setVerticalOffset(qreal verticalOffset)
1376 if (setStyleProperty(QQSK::Property::VOffset, verticalOffset))
1377 handleStylePropertyChanged(&QQStyleKitShadowProperties::verticalOffsetChanged);
1380qreal QQStyleKitShadowProperties::horizontalOffset()
const
1382 return styleProperty<qreal>(QQSK::Property::HOffset);
1385void QQStyleKitShadowProperties::setHorizontalOffset(qreal horizontalOffset)
1387 if (setStyleProperty(QQSK::Property::HOffset, horizontalOffset))
1388 handleStylePropertyChanged(&QQStyleKitShadowProperties::horizontalOffsetChanged);
1391qreal QQStyleKitShadowProperties::blur()
const
1393 return styleProperty<qreal>(QQSK::Property::Blur, 10.0);
1396void QQStyleKitShadowProperties::setBlur(qreal blur)
1398 if (setStyleProperty(QQSK::Property::Blur, blur))
1399 handleStylePropertyChanged(&QQStyleKitShadowProperties::blurChanged);
1402bool QQStyleKitShadowProperties::visible()
const
1404 return styleProperty<
bool>(QQSK::Property::Visible,
true);
1407void QQStyleKitShadowProperties::setVisible(
bool visible)
1409 if (setStyleProperty(QQSK::Property::Visible, visible))
1410 handleStylePropertyChanged(&QQStyleKitShadowProperties::visibleChanged);
1413QQmlComponent *QQStyleKitShadowProperties::delegate()
const
1415 return styleProperty<QQmlComponent *>(QQSK::Property::Delegate);
1418void QQStyleKitShadowProperties::setDelegate(QQmlComponent *delegate)
1420 if (setStyleProperty(QQSK::Property::Delegate, delegate))
1421 handleStylePropertyChanged(&QQStyleKitShadowProperties::delegateChanged);
1426QQStyleKitDelegateProperties::QQStyleKitDelegateProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1427 : QQStyleKitPropertyGroup(group, parent)
1431template <
typename... CHANGED_SIGNALS>
1432void QQStyleKitDelegateProperties::emitGlobally(
1433 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1436 const QQStyleKitControlProperties *cp = controlProperties();
1443qreal QQStyleKitDelegateProperties::radius()
const
1445 return styleProperty<qreal>(QQSK::Property::Radius);
1448void QQStyleKitDelegateProperties::setRadius(qreal radius)
1450 if (setStyleProperty(QQSK::Property::Radius, radius))
1451 handleStylePropertiesChanged<QQStyleKitDelegateProperties>(
1452 &QQStyleKitDelegateProperties::radiusChanged,
1453 &QQStyleKitDelegateProperties::topLeftRadiusChanged,
1454 &QQStyleKitDelegateProperties::topRightRadiusChanged,
1455 &QQStyleKitDelegateProperties::bottomLeftRadiusChanged,
1456 &QQStyleKitDelegateProperties::bottomRightRadiusChanged);
1459qreal QQStyleKitDelegateProperties::topLeftRadius()
const
1461 return styleProperty<qreal>(QQSK::Property::TopLeftRadius, QQSK::Property::Radius);
1464void QQStyleKitDelegateProperties::setTopLeftRadius(qreal radius)
1466 if (setStyleProperty(QQSK::Property::TopLeftRadius, radius))
1467 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topLeftRadiusChanged);
1470qreal QQStyleKitDelegateProperties::topRightRadius()
const
1472 return styleProperty<qreal>(QQSK::Property::TopRightRadius, QQSK::Property::Radius);
1475void QQStyleKitDelegateProperties::setTopRightRadius(qreal radius)
1477 if (setStyleProperty(QQSK::Property::TopRightRadius, radius))
1478 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topRightRadiusChanged);
1481qreal QQStyleKitDelegateProperties::bottomLeftRadius()
const
1483 return styleProperty<qreal>(QQSK::Property::BottomLeftRadius, QQSK::Property::Radius);
1486void QQStyleKitDelegateProperties::setBottomLeftRadius(qreal radius)
1488 if (setStyleProperty(QQSK::Property::BottomLeftRadius, radius))
1489 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomLeftRadiusChanged);
1492qreal QQStyleKitDelegateProperties::bottomRightRadius()
const
1494 return styleProperty<qreal>(QQSK::Property::BottomRightRadius, QQSK::Property::Radius);
1497void QQStyleKitDelegateProperties::setBottomRightRadius(qreal radius)
1499 if (setStyleProperty(QQSK::Property::BottomRightRadius, radius))
1500 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomRightRadiusChanged);
1503qreal QQStyleKitDelegateProperties::scale()
const
1505 return styleProperty<qreal>(QQSK::Property::Scale, 1.0);
1508void QQStyleKitDelegateProperties::setScale(qreal scale)
1510 if (setStyleProperty(QQSK::Property::Scale, scale))
1511 handleStylePropertyChanged(&QQStyleKitDelegateProperties::scaleChanged);
1514qreal QQStyleKitDelegateProperties::rotation()
const
1516 return styleProperty<qreal>(QQSK::Property::Rotation);
1519void QQStyleKitDelegateProperties::setRotation(qreal rotation)
1521 if (setStyleProperty(QQSK::Property::Rotation, rotation))
1522 handleStylePropertyChanged(&QQStyleKitDelegateProperties::rotationChanged);
1525qreal QQStyleKitDelegateProperties::width()
const
1527 return styleProperty<qreal>(QQSK::Property::Width);
1530void QQStyleKitDelegateProperties::setWidth(qreal width)
1532 if (setStyleProperty(QQSK::Property::Width, width))
1533 handleStylePropertyChanged(&QQStyleKitDelegateProperties::widthChanged);
1536qreal QQStyleKitDelegateProperties::height()
const
1538 return styleProperty<qreal>(QQSK::Property::Height);
1541void QQStyleKitDelegateProperties::setHeight(qreal height)
1543 if (setStyleProperty(QQSK::Property::Height, height))
1544 handleStylePropertyChanged(&QQStyleKitDelegateProperties::heightChanged);
1547qreal QQStyleKitDelegateProperties::minimumWidth()
const
1549 return styleProperty<qreal>(QQSK::Property::MinimumWidth);
1552void QQStyleKitDelegateProperties::setMinimumWidth(qreal width)
1554 if (setStyleProperty(QQSK::Property::MinimumWidth, width))
1555 handleStylePropertyChanged(&QQStyleKitDelegateProperties::minimumWidthChanged);
1558qreal QQStyleKitDelegateProperties::minimumHeight()
const
1560 return styleProperty<qreal>(QQSK::Property::MinimumHeight);
1563void QQStyleKitDelegateProperties::setMinimumHeight(qreal height)
1565 if (setStyleProperty(QQSK::Property::MinimumHeight, height))
1566 handleStylePropertyChanged(&QQStyleKitDelegateProperties::minimumHeightChanged);
1569bool QQStyleKitDelegateProperties::fillWidth()
const
1571 return styleProperty<
bool>(QQSK::Property::FillWidth);
1574void QQStyleKitDelegateProperties::setFillWidth(
bool fill)
1576 if (setStyleProperty(QQSK::Property::FillWidth, fill))
1577 handleStylePropertyChanged(&QQStyleKitDelegateProperties::fillWidthChanged);
1580bool QQStyleKitDelegateProperties::fillHeight()
const
1582 return styleProperty<
bool>(QQSK::Property::FillHeight);
1585void QQStyleKitDelegateProperties::setFillHeight(
bool fill)
1587 if (setStyleProperty(QQSK::Property::FillHeight, fill))
1588 handleStylePropertyChanged(&QQStyleKitDelegateProperties::fillHeightChanged);
1591qreal QQStyleKitDelegateProperties::margins()
const
1593 return styleProperty<qreal>(QQSK::Property::Margins);
1596void QQStyleKitDelegateProperties::setMargins(qreal margins)
1598 if (setStyleProperty(QQSK::Property::Margins, margins))
1599 handleStylePropertiesChanged<QQStyleKitDelegateProperties>(
1600 &QQStyleKitDelegateProperties::marginsChanged,
1601 &QQStyleKitDelegateProperties::leftMarginChanged,
1602 &QQStyleKitDelegateProperties::rightMarginChanged,
1603 &QQStyleKitDelegateProperties::topMarginChanged,
1604 &QQStyleKitDelegateProperties::bottomMarginChanged);
1607qreal QQStyleKitDelegateProperties::leftMargin()
const
1609 return styleProperty<qreal>(QQSK::Property::LeftMargin, QQSK::Property::Margins);
1612void QQStyleKitDelegateProperties::setLeftMargin(qreal margin)
1614 if (setStyleProperty(QQSK::Property::LeftMargin, margin))
1615 handleStylePropertyChanged(&QQStyleKitDelegateProperties::leftMarginChanged);
1618qreal QQStyleKitDelegateProperties::rightMargin()
const
1620 return styleProperty<qreal>(QQSK::Property::RightMargin, QQSK::Property::Margins);
1623void QQStyleKitDelegateProperties::setRightMargin(qreal margin)
1625 if (setStyleProperty(QQSK::Property::RightMargin, margin))
1626 handleStylePropertyChanged(&QQStyleKitDelegateProperties::rightMarginChanged);
1629qreal QQStyleKitDelegateProperties::topMargin()
const
1631 return styleProperty<qreal>(QQSK::Property::TopMargin, QQSK::Property::Margins);
1634void QQStyleKitDelegateProperties::setTopMargin(qreal margin)
1636 if (setStyleProperty(QQSK::Property::TopMargin, margin))
1637 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topMarginChanged);
1640qreal QQStyleKitDelegateProperties::bottomMargin()
const
1642 return styleProperty<qreal>(QQSK::Property::BottomMargin, QQSK::Property::Margins);
1645void QQStyleKitDelegateProperties::setBottomMargin(qreal margin)
1647 if (setStyleProperty(QQSK::Property::BottomMargin, margin))
1648 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomMarginChanged);
1651Qt::Alignment QQStyleKitDelegateProperties::alignment()
const
1653 return styleProperty<Qt::Alignment>(QQSK::Property::Alignment, Qt::AlignLeft | Qt::AlignVCenter);
1656void QQStyleKitDelegateProperties::setAlignment(Qt::Alignment alignment)
1658 if (setStyleProperty(QQSK::Property::Alignment, alignment))
1659 handleStylePropertyChanged(&QQStyleKitDelegateProperties::alignmentChanged);
1662qreal QQStyleKitDelegateProperties::opacity()
const
1664 return styleProperty<qreal>(QQSK::Property::Opacity, 1.0);
1667void QQStyleKitDelegateProperties::setOpacity(qreal opacity)
1669 if (setStyleProperty(QQSK::Property::Opacity, opacity))
1670 handleStylePropertyChanged(&QQStyleKitDelegateProperties::opacityChanged);
1673QColor QQStyleKitDelegateProperties::color()
const
1675 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1678void QQStyleKitDelegateProperties::setColor(
const QColor &color)
1680 if (setStyleProperty(QQSK::Property::Color, color))
1681 handleStylePropertyChanged(&QQStyleKitDelegateProperties::colorChanged);
1684bool QQStyleKitDelegateProperties::visible()
const
1686 return styleProperty<
bool>(QQSK::Property::Visible,
true);
1689void QQStyleKitDelegateProperties::setVisible(
bool visible)
1691 if (setStyleProperty(QQSK::Property::Visible, visible))
1692 handleStylePropertyChanged(&QQStyleKitDelegateProperties::visibleChanged);
1695bool QQStyleKitDelegateProperties::clip()
const
1697 return styleProperty<
bool>(QQSK::Property::Clip,
false);
1700void QQStyleKitDelegateProperties::setClip(
bool clip)
1702 if (setStyleProperty(QQSK::Property::Clip, clip))
1703 handleStylePropertyChanged(&QQStyleKitDelegateProperties::clipChanged);
1706QQuickGradient *QQStyleKitDelegateProperties::gradient()
const
1708 return styleProperty<QQuickGradient *>(QQSK::Property::Gradient);
1711void QQStyleKitDelegateProperties::setGradient(QQuickGradient *gradient)
1713 if (setStyleProperty(QQSK::Property::Gradient, gradient))
1714 handleStylePropertyChanged(&QQStyleKitDelegateProperties::gradientChanged);
1717QObject *QQStyleKitDelegateProperties::data()
const
1719 return styleProperty<QObject *>(QQSK::Property::Data);
1722void QQStyleKitDelegateProperties::setData(QObject *data)
1724 if (setStyleProperty(QQSK::Property::Data, data))
1725 handleStylePropertyChanged(&QQStyleKitDelegateProperties::dataChanged);
1728QQmlComponent *QQStyleKitDelegateProperties::delegate()
const
1730 return styleProperty<QQmlComponent *>(QQSK::Property::Delegate);
1733void QQStyleKitDelegateProperties::setDelegate(QQmlComponent *delegate)
1735 if (setStyleProperty(QQSK::Property::Delegate, delegate))
1736 handleStylePropertyChanged(&QQStyleKitDelegateProperties::delegateChanged);
1739QQStyleKitBorderProperties *QQStyleKitDelegateProperties::border()
const
1741 return lazyCreateGroup(m_border, QQSK::PropertyGroup::Border);
1744QQStyleKitShadowProperties *QQStyleKitDelegateProperties::shadow()
const
1746 return lazyCreateGroup(m_shadow, QQSK::PropertyGroup::Shadow);
1749QQStyleKitImageProperties *QQStyleKitDelegateProperties::image()
const
1751 return lazyCreateGroup(m_image, QQSK::PropertyGroup::Image);
1757 : QQStyleKitDelegateProperties(group, parent)
1763 return lazyCreateGroup(m_first, QQSK::PropertyGroup::DelegateSubtype1);
1768 return lazyCreateGroup(m_second, QQSK::PropertyGroup::DelegateSubtype2);
1774 QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1775 : QQStyleKitDelegateProperties(group, parent)
1779template <
typename... CHANGED_SIGNALS>
1781 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1784 const QQStyleKitControlProperties *cp = controlProperties();
1791 return lazyCreateGroup(m_foreground, QQSK::PropertyGroup::Foreground);
1797 QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1798 : QQStyleKitDelegateProperties(group, parent)
1802template <
typename... CHANGED_SIGNALS>
1804 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1807 const QQStyleKitControlProperties *cp = controlProperties();
1813 return lazyCreateGroup(m_foreground, QQSK::PropertyGroup::Foreground);
1828 return lazyCreateGroup(m_first, QQSK::PropertyGroup::DelegateSubtype1);
1833 return lazyCreateGroup(m_second, QQSK::PropertyGroup::DelegateSubtype2);
1842template <
typename... CHANGED_SIGNALS>
1844 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1854 return styleProperty<QColor>(QQSK::Property::Color);
1859 if (setStyleProperty(QQSK::Property::Color, color))
1860 handleStylePropertyChanged(&QQStyleKitTextProperties::colorChanged);
1865 return styleProperty<Qt::Alignment>(QQSK::Property::Alignment);
1870 if (setStyleProperty(QQSK::Property::Alignment, alignment))
1871 handleStylePropertyChanged(&QQStyleKitTextProperties::alignmentChanged);
1876 return styleProperty<
bool>(QQSK::Property::Bold,
false);
1881 if (setStyleProperty(QQSK::Property::Bold, bold))
1887 return styleProperty<
bool>(QQSK::Property::Italic,
false);
1892 if (setStyleProperty(QQSK::Property::Italic, italic))
1898 return styleProperty<qreal>(QQSK::Property::PointSize);
1903 if (setStyleProperty(QQSK::Property::PointSize, pointSize))
1909 return styleProperty<qreal>(QQSK::Property::Padding);
1914 if (setStyleProperty(QQSK::Property::Padding, padding))
1925 return styleProperty<qreal>(QQSK::Property::LeftPadding, QQSK::Property::Padding);
1930 if (setStyleProperty(QQSK::Property::LeftPadding, padding))
1936 return styleProperty<qreal>(QQSK::Property::RightPadding, QQSK::Property::Padding);
1941 if (setStyleProperty(QQSK::Property::RightPadding, padding))
1947 return styleProperty<qreal>(QQSK::Property::TopPadding, QQSK::Property::Padding);
1952 if (setStyleProperty(QQSK::Property::TopPadding, padding))
1958 return styleProperty<qreal>(QQSK::Property::BottomPadding, QQSK::Property::Padding);
1963 if (setStyleProperty(QQSK::Property::BottomPadding, padding))
1969 return lazyCreateGroup(m_first, QQSK::PropertyGroup::DelegateSubtype1);
1974 return lazyCreateGroup(m_second, QQSK::PropertyGroup::DelegateSubtype2);
1979QQStyleKitControlProperties::QQStyleKitControlProperties(QQSK::PropertyGroup group, QObject *parent)
1980 : QQStyleKitPropertyGroup(group, parent)
1983
1984
1985
1986
1987 m_groupSpace.size = nestedGroupsStartSize;
1988 m_groupSpace.start = 0;
1990 if (group == QQSK::PropertyGroup::GlobalFlag) {
1992
1993
1994
1995
1996
1997
1998 m_pathFlags.setFlag(QQSK::PropertyPathFlag::Global);
2002QQStyleKitStyle *QQStyleKitControlProperties::style()
const
2004 if (subclass() == QQSK::Subclass::QQStyleKitState) {
2006
2007
2008
2009
2010
2011
2012 QObject *obj = parent();
2013 while (obj && !obj->metaObject()->inherits(&QQStyleKitStyle::staticMetaObject))
2014 obj = obj->parent();
2015 return obj ?
static_cast<QQStyleKitStyle *>(obj) :
nullptr;
2018 if (subclass() == QQSK::Subclass::QQStyleKitReader) {
2019 const auto *reader =
static_cast<
const QQStyleKitReader *>(
this);
2020 if (reader->m_explicitStyle)
2021 return reader->m_explicitStyle;
2025 return QQStyleKitStyle::current();
2028QQSK::Subclass QQStyleKitControlProperties::subclass()
const
2031
2032
2033
2034
2035
2036 if (metaObject()->inherits(&QQStyleKitReader::staticMetaObject))
2037 return QQSK::Subclass::QQStyleKitReader;
2038 if (metaObject()->inherits(&QQStyleKitControlState::staticMetaObject))
2039 return QQSK::Subclass::QQStyleKitState;
2043QQStyleKitReader *QQStyleKitControlProperties::asQQStyleKitReader()
const
2045 Q_ASSERT(subclass() == QQSK::Subclass::QQStyleKitReader);
2046 return static_cast<QQStyleKitReader *>(
const_cast<QQStyleKitControlProperties *>(
this));
2049QQStyleKitControlState *QQStyleKitControlProperties::asQQStyleKitState()
const
2051 Q_ASSERT(subclass() == QQSK::Subclass::QQStyleKitState);
2052 Q_ASSERT(metaObject()->inherits(&QQStyleKitControlState::staticMetaObject));
2053 return static_cast<QQStyleKitControlState *>(
const_cast<QQStyleKitControlProperties *>(
this));
2056void QQStyleKitControlProperties::forEachUsedDelegate(
2057 std::function<
void (QQStyleKitDelegateProperties *, QQSK::Delegate,
const QString &)> f)
2061 f(m_background, QQSK::Delegate::Background,
"background"_L1);
2064 f(m_indicator, QQSK::Delegate::Indicator,
"indicator"_L1);
2065 if (m_indicator->m_foreground)
2066 f(m_indicator->m_foreground, QQSK::Delegate::IndicatorForeground,
"indicator.foreground"_L1);
2067 if (m_indicator->m_first) {
2068 f(m_indicator->m_first, QQSK::Delegate::IndicatorFirst,
"indicator.first"_L1);
2069 if (m_indicator->m_first->m_foreground)
2070 f(m_indicator->m_first->m_foreground, QQSK::Delegate::IndicatorFirstForeground,
"indicator.first.foreground"_L1);
2072 if (m_indicator->m_second) {
2073 f(m_indicator->m_second, QQSK::Delegate::IndicatorSecond,
"indicator.second"_L1);
2074 if (m_indicator->m_second->m_foreground)
2075 f(m_indicator->m_second->m_foreground, QQSK::Delegate::IndicatorSecondForeground,
"indicator.second.foreground"_L1);
2080 f(m_handle, QQSK::Delegate::Handle,
"handle"_L1);
2081 if (m_handle->m_first)
2082 f(m_handle->m_first, QQSK::Delegate::HandleFirst,
"handle.first"_L1);
2083 if (m_handle->m_second)
2084 f(m_handle->m_second, QQSK::Delegate::HandleSecond,
"handle.second"_L1);
2088void QQStyleKitControlProperties::emitChangedForAllStyleProperties(EmitFlags emitFlags)
2091
2092
2093 if (emitFlags.testFlag(EmitFlag::AllProperties)) {
2094 emit leftPaddingChanged();
2095 emit rightPaddingChanged();
2096 emit topPaddingChanged();
2097 emit bottomPaddingChanged();
2098 emit spacingChanged();
2099 emit transitionChanged();
2103 forEachUsedDelegate([=](QQStyleKitDelegateProperties *delegate, QQSK::Delegate,
const QString &){
2104 delegate->emitChangedForAllStylePropertiesRecursive(emitFlags);
2108template <
typename... CHANGED_SIGNALS>
2109void QQStyleKitControlProperties::emitGlobally(
2110 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
2112 for (QQStyleKitReader *reader : QQStyleKitReader::s_allReaders) {
2113 if (reader->controlType() != controlType)
2115 ((reader->*changedSignals)(), ...);
2119qreal QQStyleKitControlProperties::spacing()
const
2121 return styleProperty<qreal>(QQSK::Property::Spacing);
2124void QQStyleKitControlProperties::setSpacing(qreal spacing)
2126 if (setStyleProperty(QQSK::Property::Spacing, spacing))
2127 handleStylePropertyChanged(&QQStyleKitControlProperties::spacingChanged);
2130qreal QQStyleKitControlProperties::padding()
const
2132 return styleProperty<qreal>(QQSK::Property::Padding);
2135void QQStyleKitControlProperties::setPadding(qreal padding)
2137 if (setStyleProperty(QQSK::Property::Padding, padding))
2138 handleStylePropertiesChanged<QQStyleKitControlProperties>(
2139 &QQStyleKitControlProperties::paddingChanged,
2140 &QQStyleKitControlProperties::leftPaddingChanged,
2141 &QQStyleKitControlProperties::rightPaddingChanged,
2142 &QQStyleKitControlProperties::topPaddingChanged,
2143 &QQStyleKitControlProperties::bottomPaddingChanged);
2146qreal QQStyleKitControlProperties::leftPadding()
const
2148 return styleProperty<qreal>(QQSK::Property::LeftPadding, QQSK::Property::Padding);
2151void QQStyleKitControlProperties::setLeftPadding(qreal leftPadding)
2153 if (setStyleProperty(QQSK::Property::LeftPadding, leftPadding))
2154 handleStylePropertyChanged(&QQStyleKitControlProperties::leftPaddingChanged);
2157qreal QQStyleKitControlProperties::rightPadding()
const
2159 return styleProperty<qreal>(QQSK::Property::RightPadding, QQSK::Property::Padding);
2162void QQStyleKitControlProperties::setRightPadding(qreal rightPadding)
2164 if (setStyleProperty(QQSK::Property::RightPadding, rightPadding))
2165 handleStylePropertyChanged(&QQStyleKitControlProperties::rightPaddingChanged);
2168qreal QQStyleKitControlProperties::topPadding()
const
2170 return styleProperty<qreal>(QQSK::Property::TopPadding, QQSK::Property::Padding);
2173void QQStyleKitControlProperties::setTopPadding(qreal topPadding)
2175 if (setStyleProperty(QQSK::Property::TopPadding, topPadding))
2176 handleStylePropertyChanged(&QQStyleKitControlProperties::topPaddingChanged);
2179qreal QQStyleKitControlProperties::bottomPadding()
const
2181 return styleProperty<qreal>(QQSK::Property::BottomPadding, QQSK::Property::Padding);
2184void QQStyleKitControlProperties::setBottomPadding(qreal bottomPadding)
2186 if (setStyleProperty(QQSK::Property::BottomPadding, bottomPadding))
2187 handleStylePropertyChanged(&QQStyleKitControlProperties::bottomPaddingChanged);
2190QQuickTransition *QQStyleKitControlProperties::transition()
const
2192 return styleProperty<QQuickTransition *>(QQSK::Property::Transition);
2195void QQStyleKitControlProperties::setTransition(QQuickTransition *transition)
2197 if (setStyleProperty(QQSK::Property::Transition, transition))
2198 handleStylePropertyChanged(&QQStyleKitControlProperties::transitionChanged);
2201QQStyleKitTextProperties *QQStyleKitControlProperties::text()
const
2203 return lazyCreateGroup(m_text, QQSK::PropertyGroup::Text);
2206QQStyleKitDelegateProperties *QQStyleKitControlProperties::background()
const
2208 return lazyCreateGroup(m_background, QQSK::PropertyGroup::Background);
2211QQStyleKitHandleProperties *QQStyleKitControlProperties::handle()
const
2213 return lazyCreateGroup(m_handle, QQSK::PropertyGroup::Handle);
2216QQStyleKitIndicatorWithSubTypes *QQStyleKitControlProperties::indicator()
const
2218 return lazyCreateGroup(m_indicator, QQSK::PropertyGroup::Indicator);
2223#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
QQStyleKitIndicatorProperties * second() const
QQStyleKitIndicatorProperties * first() 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
QQStyleKitTextProperties * first() const
void rightPaddingChanged()
QQStyleKitTextProperties * second() const
void leftPaddingChanged()
qreal leftPadding() const
Combined button and popup list for selecting options.
#define CONDITIONALLY_EMIT_SIGNALS_GLOBALLY_FOR(CONTROL_PROPERTIES, GROUP_PATH)