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
342
343
344
345
346
347
348
349
350
351
354
355
356
357
358
359
360
363
364
365
366
367
368
369
370
373
374
375
376
377
380
381
382
383
384
387
388
389
390
391
392
393
394
395
396
397
398
399
400
403
404
405
406
407
408
409
410
411
412
413
414
415
416
419
420
421
422
423
424
425
428
429
430
431
432
433
434
435
438
439
440
441
442
443
444
447
448
449
450
453
454
455
456
459
460
461
462
463
464
467
468
469
470
471
472
475
476
477
478
479
480
481
484
485
486
487
488
489
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
511
512
513
514
515
516
517
518
519
520
521
522
523
526
527
528
529
530
533
534
535
536
537
538
541
542
543
544
549
550
551
552
553
554
555
556
557
558
559
560
561
564
565
566
567
570
571
572
573
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
602
603
604
605
606
607
610
611
612
613
614
615
616
619
620
621
622
623
624
627
628
629
630
633
634
635
636
637
638
639
642
643
644
645
646
649
650
651
652
655
656
657
658
659
660
661
662
663
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
690
691
692
693
694
695
698
699
700
701
702
703
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
730
731
732
733
734
735
740
741
742
743
744
745
746
747
748
749
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
783
784
785
786
787
788
789
790
791
792
793
794
797
798
799
800
801
802
803
804
805
806
807
808
809
810
813
814
815
816
817
818
819
820
821
822
823
824
825
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
852
853
854
855
858
859
860
861
862
863
864
867
868
869
870
871
872
873
876
877
878
879
882
883
884
885
886
887
888
891
892
893
894
895
896
897
900
901
902
903
904
905
906
907
910
911
912
913
916
917
918
919
920
921
922
925
926
927
928
929
930
931
934
935
936
937
938
939
940
941
944
945
946
947
948
949
950
951
955QHash<PropertyPathId_t, QString> QQStyleKitPropertyGroup::s_pathStrings;
964 if (flag == PropertyPathId::Flag::IncludeSubtype) {
965 if (m_pathFlags.testFlag(QQSK::PropertyPathFlag::DelegateSubtype1))
966 return PropertyPathId(property, m_groupSpace.start, QQSK::PropertyGroup::DelegateSubtype1);
967 else if (m_pathFlags.testFlag(QQSK::PropertyPathFlag::DelegateSubtype2))
968 return PropertyPathId(property, m_groupSpace.start, QQSK::PropertyGroup::DelegateSubtype2);
970 return PropertyPathId(property, m_groupSpace.start, QQSK::PropertyGroup::DelegateSubtype0);
976
977
978
979
980
981
982
983
984
985 if (s_pathStrings.contains(m_groupSpace.start))
986 return s_pathStrings[m_groupSpace.start];
988 constexpr PropertyPathId_t rootGroupsSize = nestedGroupsStartSize / nestedGroupCount;
989 const auto metaEnum = QMetaEnum::fromType<QQSK::PropertyGroup>();
991 PropertyPathId_t nestedGroupStart = m_groupSpace.start;
992 PropertyPathId_t nestedGroupSize = rootGroupsSize;
993 PropertyPathId_t nestedGroupIndex = nestedGroupStart / nestedGroupSize;
994 auto groupType = QQSK::PropertyGroup(nestedGroupIndex);
995 if (groupType == QQSK::PropertyGroup::Control)
998 QString groupName = QString::fromLatin1(metaEnum.valueToKey(
static_cast<
int>(groupType)));
999 groupName[0] = groupName[0].toLower();
1000 QString pathString = groupName;
1003 nestedGroupStart -= nestedGroupIndex * nestedGroupSize;
1004 nestedGroupSize /= nestedGroupCount;
1005 nestedGroupIndex = nestedGroupStart / nestedGroupSize;
1006 groupType = QQSK::PropertyGroup(nestedGroupIndex);
1007 if (groupType == QQSK::PropertyGroup::Control)
1010 QString groupName = QString::fromLatin1(metaEnum.valueToKey(
static_cast<
int>(groupType)));
1011 groupName[0] = groupName[0].toLower();
1012 pathString +=
'.'_L1 + groupName;
1015 s_pathStrings.insert(m_groupSpace.start, pathString);
1022 Q_ASSERT(qobject_cast<
const QQStyleKitControlProperties *>(
this));
1024 return static_cast<QQStyleKitControlProperties *>(self);
1026 Q_ASSERT(qobject_cast<
const QQStyleKitControlProperties *>(parent()));
1027 return static_cast<QQStyleKitControlProperties *>(parent());
1033 T *nestedGroup = QQSK::lazyCreate(ptr, controlProperties(), group);
1036 nestedGroup->m_pathFlags = m_pathFlags;
1038 if (group == QQSK::PropertyGroup::DelegateSubtype1) {
1040
1041
1042
1043
1044
1045
1046 nestedGroup->m_pathFlags.setFlag(QQSK::PropertyPathFlag::DelegateSubtype1);
1047 nestedGroup->m_groupSpace = m_groupSpace;
1048 }
else if (group == QQSK::PropertyGroup::DelegateSubtype2) {
1049 nestedGroup->m_pathFlags.setFlag(QQSK::PropertyPathFlag::DelegateSubtype2);
1050 nestedGroup->m_groupSpace = m_groupSpace;
1053
1054
1055 const PropertyPathId_t nestedGroupIndex = PropertyPathId_t(group);
1056 const PropertyPathId_t nestedGroupSize = m_groupSpace.size / nestedGroupCount;
1057 nestedGroup->m_groupSpace.size = nestedGroupSize;
1058 nestedGroup->m_groupSpace.start = m_groupSpace.start + (nestedGroupIndex * nestedGroupSize);
1060
1061
1062
1063
1064
1065 Q_ASSERT(nestedGroupSize >= PropertyPathId_t(QQSK::Property::COUNT));
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081#define CONDITIONALLY_EMIT_SIGNALS_GLOBALLY_FOR(CONTROL_PROPERTIES, GROUP_PATH) if
1082 (this == CONTROL_PROPERTIES -> GROUP_PATH ) {
1083 for (QQStyleKitReader *reader : QQStyleKitReader::s_allReaders) {
1084 const auto baseTypes = QQStyleKitPropertyResolver::baseTypesForType(reader->controlType());
1085 if (reader->controlType() != controlType && !baseTypes.contains(controlType))
1087 reader->clearLocalStorage();
1088 ((reader-> GROUP_PATH ->*changedSignals)(), ...);
1091}
1093template<
typename SUBCLASS>
1095 handleStylePropertiesChanged<SUBCLASS>(changedSignal);
1098template <
typename SUBCLASS,
typename... CHANGED_SIGNALS>
1102
1103
1104
1105
1106
1107
1108
1109 static_assert(std::is_base_of<QQStyleKitPropertyGroup, SUBCLASS>::value,
1110 "SUBCLASS must inherit QQStyleKitPropertyGroup");
1112 auto *group =
static_cast<SUBCLASS *>(
this);
1115 if (objectWrittenTo == QQSK::Subclass::QQStyleKitState) {
1116 ((group->*changedSignals)(), ...);
1118 if (shouldEmitGlobally()) {
1120 const QQStyleKitExtendableControlType type = control->controlType();
1121 group->emitGlobally(type, changedSignals...);
1126 if (objectWrittenTo == QQSK::Subclass::QQStyleKitReader) {
1128
1129
1130
1131 if (shouldEmitLocally()) {
1134
1135
1136
1137
1138 if (!reader->m_target)
1139 ((group->*changedSignals)(), ...);
1141 QCoreApplication::postEvent(reader->m_target,
new QEvent(QEvent::StyleAnimationUpdate));
1152
1153
1154 const int startIndex = QQStyleKitPropertyGroup::staticMetaObject.propertyOffset();
1155 const QMetaObject* meta = metaObject();
1156 for (
int i = startIndex; i < meta->propertyCount(); ++i) {
1157 const QMetaProperty prop = meta->property(i);
1158 const QMetaObject* propMetaObject = QMetaType::fromName(prop.typeName()).metaObject();
1159 if (propMetaObject) {
1160 if (propMetaObject->inherits(&QQStyleKitDelegateProperties::staticMetaObject)) {
1162
1163
1166 if (propMetaObject->inherits(&QQStyleKitPropertyGroup::staticMetaObject)) {
1168 QObject *childObj = qvariant_cast<QObject *>(property(prop.name()));
1169 if (
auto *child = qobject_cast<QQStyleKitPropertyGroup *>(childObj))
1170 child->emitChangedForAllStylePropertiesRecursive(emitFlags);
1175 if (!emitFlags.testFlag(EmitFlag::AllProperties)) {
1177 if (emitFlags.testFlag(EmitFlag::Colors)) {
1178 if (prop.metaType() != QMetaType::fromType<QColor>())
1184 Q_ASSERT(prop.hasNotifySignal());
1185 QMetaMethod notify = prop.notifySignal();
1186 notify.invoke(
this, Qt::DirectConnection);
1201 if (parentStyle->loaded() && !parentStyle->m_isUpdatingPalette) {
1203
1204
1205
1206
1207
1208
1209 return parentStyle == QQStyleKitStyle::current();
1216QQStyleKitImageProperties::QQStyleKitImageProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1217 : QQStyleKitPropertyGroup(group, parent)
1221template <
typename... CHANGED_SIGNALS>
1222void QQStyleKitImageProperties::emitGlobally(
1223 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1226 const QQStyleKitControlProperties *cp = controlProperties();
1233QUrl QQStyleKitImageProperties::source()
const
1235 return styleProperty<QUrl>(QQSK::Property::Source);
1238void QQStyleKitImageProperties::setSource(
const QUrl &source)
1240 if (setStyleProperty(QQSK::Property::Source, source))
1241 handleStylePropertyChanged(&QQStyleKitImageProperties::sourceChanged);
1244QColor QQStyleKitImageProperties::color()
const
1246 return styleProperty<QColor>(QQSK::Property::Color);
1249void QQStyleKitImageProperties::setColor(
const QColor &color)
1251 if (setStyleProperty(QQSK::Property::Color, color))
1252 handleStylePropertyChanged(&QQStyleKitImageProperties::colorChanged);
1255QQuickImage::FillMode QQStyleKitImageProperties::fillMode()
const
1257 return styleProperty<QQuickImage::FillMode>(QQSK::Property::FillMode);
1260void QQStyleKitImageProperties::setFillMode(QQuickImage::FillMode fillMode)
1262 if (setStyleProperty(QQSK::Property::FillMode, fillMode))
1263 handleStylePropertyChanged(&QQStyleKitImageProperties::fillModeChanged);
1268QQStyleKitBorderProperties::QQStyleKitBorderProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1269 : QQStyleKitPropertyGroup(group, parent)
1273template <
typename... CHANGED_SIGNALS>
1274void QQStyleKitBorderProperties::emitGlobally(
1275 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1278 const QQStyleKitControlProperties *cp = controlProperties();
1285qreal QQStyleKitBorderProperties::width()
const
1287 return styleProperty<qreal>(QQSK::Property::Width);
1290void QQStyleKitBorderProperties::setWidth(qreal width)
1292 if (setStyleProperty(QQSK::Property::Width, width))
1293 handleStylePropertyChanged(&QQStyleKitBorderProperties::widthChanged);
1296QColor QQStyleKitBorderProperties::color()
const
1298 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1301void QQStyleKitBorderProperties::setColor(
const QColor &color)
1303 if (setStyleProperty(QQSK::Property::Color, color))
1304 handleStylePropertyChanged(&QQStyleKitBorderProperties::colorChanged);
1309QQStyleKitShadowProperties::QQStyleKitShadowProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1310 : QQStyleKitPropertyGroup(group, parent)
1314template <
typename... CHANGED_SIGNALS>
1315void QQStyleKitShadowProperties::emitGlobally(
1316 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1319 const QQStyleKitControlProperties *cp = controlProperties();
1326QColor QQStyleKitShadowProperties::color()
const
1328 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1331void QQStyleKitShadowProperties::setColor(QColor color)
1333 if (setStyleProperty(QQSK::Property::Color, color))
1334 handleStylePropertyChanged(&QQStyleKitShadowProperties::colorChanged);
1337qreal QQStyleKitShadowProperties::opacity()
const
1339 return styleProperty<qreal>(QQSK::Property::Opacity, 1.0);
1342void QQStyleKitShadowProperties::setOpacity(qreal opacity)
1344 if (setStyleProperty(QQSK::Property::Opacity, opacity))
1345 handleStylePropertyChanged(&QQStyleKitShadowProperties::opacityChanged);
1348qreal QQStyleKitShadowProperties::scale()
const
1350 return styleProperty<qreal>(QQSK::Property::Scale, 1.0);
1353void QQStyleKitShadowProperties::setScale(qreal scale)
1355 if (setStyleProperty(QQSK::Property::Scale, scale))
1356 handleStylePropertyChanged(&QQStyleKitShadowProperties::scaleChanged);
1359qreal QQStyleKitShadowProperties::verticalOffset()
const
1361 return styleProperty<qreal>(QQSK::Property::VOffset);
1364void QQStyleKitShadowProperties::setVerticalOffset(qreal verticalOffset)
1366 if (setStyleProperty(QQSK::Property::VOffset, verticalOffset))
1367 handleStylePropertyChanged(&QQStyleKitShadowProperties::verticalOffsetChanged);
1370qreal QQStyleKitShadowProperties::horizontalOffset()
const
1372 return styleProperty<qreal>(QQSK::Property::HOffset);
1375void QQStyleKitShadowProperties::setHorizontalOffset(qreal horizontalOffset)
1377 if (setStyleProperty(QQSK::Property::HOffset, horizontalOffset))
1378 handleStylePropertyChanged(&QQStyleKitShadowProperties::horizontalOffsetChanged);
1381qreal QQStyleKitShadowProperties::blur()
const
1383 return styleProperty<qreal>(QQSK::Property::Blur, 10.0);
1386void QQStyleKitShadowProperties::setBlur(qreal blur)
1388 if (setStyleProperty(QQSK::Property::Blur, blur))
1389 handleStylePropertyChanged(&QQStyleKitShadowProperties::blurChanged);
1392bool QQStyleKitShadowProperties::visible()
const
1394 return styleProperty<
bool>(QQSK::Property::Visible,
true);
1397void QQStyleKitShadowProperties::setVisible(
bool visible)
1399 if (setStyleProperty(QQSK::Property::Visible, visible))
1400 handleStylePropertyChanged(&QQStyleKitShadowProperties::visibleChanged);
1403QQmlComponent *QQStyleKitShadowProperties::delegate()
const
1405 return styleProperty<QQmlComponent *>(QQSK::Property::Delegate);
1408void QQStyleKitShadowProperties::setDelegate(QQmlComponent *delegate)
1410 if (setStyleProperty(QQSK::Property::Delegate, delegate))
1411 handleStylePropertyChanged(&QQStyleKitShadowProperties::delegateChanged);
1416QQStyleKitDelegateProperties::QQStyleKitDelegateProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1417 : QQStyleKitPropertyGroup(group, parent)
1421template <
typename... CHANGED_SIGNALS>
1422void QQStyleKitDelegateProperties::emitGlobally(
1423 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1426 const QQStyleKitControlProperties *cp = controlProperties();
1433qreal QQStyleKitDelegateProperties::radius()
const
1435 return styleProperty<qreal>(QQSK::Property::Radius);
1438void QQStyleKitDelegateProperties::setRadius(qreal radius)
1440 if (setStyleProperty(QQSK::Property::Radius, radius))
1441 handleStylePropertiesChanged<QQStyleKitDelegateProperties>(
1442 &QQStyleKitDelegateProperties::radiusChanged,
1443 &QQStyleKitDelegateProperties::topLeftRadiusChanged,
1444 &QQStyleKitDelegateProperties::topRightRadiusChanged,
1445 &QQStyleKitDelegateProperties::bottomLeftRadiusChanged,
1446 &QQStyleKitDelegateProperties::bottomRightRadiusChanged);
1449qreal QQStyleKitDelegateProperties::topLeftRadius()
const
1451 return styleProperty<qreal>(QQSK::Property::TopLeftRadius, QQSK::Property::Radius);
1454void QQStyleKitDelegateProperties::setTopLeftRadius(qreal radius)
1456 if (setStyleProperty(QQSK::Property::TopLeftRadius, radius))
1457 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topLeftRadiusChanged);
1460qreal QQStyleKitDelegateProperties::topRightRadius()
const
1462 return styleProperty<qreal>(QQSK::Property::TopRightRadius, QQSK::Property::Radius);
1465void QQStyleKitDelegateProperties::setTopRightRadius(qreal radius)
1467 if (setStyleProperty(QQSK::Property::TopRightRadius, radius))
1468 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topRightRadiusChanged);
1471qreal QQStyleKitDelegateProperties::bottomLeftRadius()
const
1473 return styleProperty<qreal>(QQSK::Property::BottomLeftRadius, QQSK::Property::Radius);
1476void QQStyleKitDelegateProperties::setBottomLeftRadius(qreal radius)
1478 if (setStyleProperty(QQSK::Property::BottomLeftRadius, radius))
1479 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomLeftRadiusChanged);
1482qreal QQStyleKitDelegateProperties::bottomRightRadius()
const
1484 return styleProperty<qreal>(QQSK::Property::BottomRightRadius, QQSK::Property::Radius);
1487void QQStyleKitDelegateProperties::setBottomRightRadius(qreal radius)
1489 if (setStyleProperty(QQSK::Property::BottomRightRadius, radius))
1490 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomRightRadiusChanged);
1493qreal QQStyleKitDelegateProperties::scale()
const
1495 return styleProperty<qreal>(QQSK::Property::Scale, 1.0);
1498void QQStyleKitDelegateProperties::setScale(qreal scale)
1500 if (setStyleProperty(QQSK::Property::Scale, scale))
1501 handleStylePropertyChanged(&QQStyleKitDelegateProperties::scaleChanged);
1504qreal QQStyleKitDelegateProperties::rotation()
const
1506 return styleProperty<qreal>(QQSK::Property::Rotation);
1509void QQStyleKitDelegateProperties::setRotation(qreal rotation)
1511 if (setStyleProperty(QQSK::Property::Rotation, rotation))
1512 handleStylePropertyChanged(&QQStyleKitDelegateProperties::rotationChanged);
1515qreal QQStyleKitDelegateProperties::implicitWidth()
const
1517 return styleProperty<qreal>(QQSK::Property::ImplicitWidth);
1520void QQStyleKitDelegateProperties::setImplicitWidth(qreal width)
1522 if (setStyleProperty(QQSK::Property::ImplicitWidth, width))
1523 handleStylePropertyChanged(&QQStyleKitDelegateProperties::implicitWidthChanged);
1526qreal QQStyleKitDelegateProperties::implicitHeight()
const
1528 return styleProperty<qreal>(QQSK::Property::ImplicitHeight);
1531void QQStyleKitDelegateProperties::setImplicitHeight(qreal height)
1533 if (setStyleProperty(QQSK::Property::ImplicitHeight, height))
1534 handleStylePropertyChanged(&QQStyleKitDelegateProperties::implicitHeightChanged);
1537qreal QQStyleKitDelegateProperties::minimumWidth()
const
1539 return styleProperty<qreal>(QQSK::Property::MinimumWidth);
1542void QQStyleKitDelegateProperties::setMinimumWidth(qreal width)
1544 if (setStyleProperty(QQSK::Property::MinimumWidth, width))
1545 handleStylePropertyChanged(&QQStyleKitDelegateProperties::minimumWidthChanged);
1548qreal QQStyleKitDelegateProperties::minimumHeight()
const
1550 return styleProperty<qreal>(QQSK::Property::MinimumHeight);
1553void QQStyleKitDelegateProperties::setMinimumHeight(qreal height)
1555 if (setStyleProperty(QQSK::Property::MinimumHeight, height))
1556 handleStylePropertyChanged(&QQStyleKitDelegateProperties::minimumHeightChanged);
1559bool QQStyleKitDelegateProperties::fillWidth()
const
1561 return styleProperty<
bool>(QQSK::Property::FillWidth);
1564void QQStyleKitDelegateProperties::setFillWidth(
bool fill)
1566 if (setStyleProperty(QQSK::Property::FillWidth, fill))
1567 handleStylePropertyChanged(&QQStyleKitDelegateProperties::fillWidthChanged);
1570bool QQStyleKitDelegateProperties::fillHeight()
const
1572 return styleProperty<
bool>(QQSK::Property::FillHeight);
1575void QQStyleKitDelegateProperties::setFillHeight(
bool fill)
1577 if (setStyleProperty(QQSK::Property::FillHeight, fill))
1578 handleStylePropertyChanged(&QQStyleKitDelegateProperties::fillHeightChanged);
1581qreal QQStyleKitDelegateProperties::margins()
const
1583 return styleProperty<qreal>(QQSK::Property::Margins);
1586void QQStyleKitDelegateProperties::setMargins(qreal margins)
1588 if (setStyleProperty(QQSK::Property::Margins, margins))
1589 handleStylePropertiesChanged<QQStyleKitDelegateProperties>(
1590 &QQStyleKitDelegateProperties::marginsChanged,
1591 &QQStyleKitDelegateProperties::leftMarginChanged,
1592 &QQStyleKitDelegateProperties::rightMarginChanged,
1593 &QQStyleKitDelegateProperties::topMarginChanged,
1594 &QQStyleKitDelegateProperties::bottomMarginChanged);
1597qreal QQStyleKitDelegateProperties::leftMargin()
const
1599 return styleProperty<qreal>(QQSK::Property::LeftMargin, QQSK::Property::Margins);
1602void QQStyleKitDelegateProperties::setLeftMargin(qreal margin)
1604 if (setStyleProperty(QQSK::Property::LeftMargin, margin))
1605 handleStylePropertyChanged(&QQStyleKitDelegateProperties::leftMarginChanged);
1608qreal QQStyleKitDelegateProperties::rightMargin()
const
1610 return styleProperty<qreal>(QQSK::Property::RightMargin, QQSK::Property::Margins);
1613void QQStyleKitDelegateProperties::setRightMargin(qreal margin)
1615 if (setStyleProperty(QQSK::Property::RightMargin, margin))
1616 handleStylePropertyChanged(&QQStyleKitDelegateProperties::rightMarginChanged);
1619qreal QQStyleKitDelegateProperties::topMargin()
const
1621 return styleProperty<qreal>(QQSK::Property::TopMargin, QQSK::Property::Margins);
1624void QQStyleKitDelegateProperties::setTopMargin(qreal margin)
1626 if (setStyleProperty(QQSK::Property::TopMargin, margin))
1627 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topMarginChanged);
1630qreal QQStyleKitDelegateProperties::bottomMargin()
const
1632 return styleProperty<qreal>(QQSK::Property::BottomMargin, QQSK::Property::Margins);
1635void QQStyleKitDelegateProperties::setBottomMargin(qreal margin)
1637 if (setStyleProperty(QQSK::Property::BottomMargin, margin))
1638 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomMarginChanged);
1641Qt::Alignment QQStyleKitDelegateProperties::alignment()
const
1643 return styleProperty<Qt::Alignment>(QQSK::Property::Alignment, Qt::AlignLeft | Qt::AlignVCenter);
1646void QQStyleKitDelegateProperties::setAlignment(Qt::Alignment alignment)
1648 if (setStyleProperty(QQSK::Property::Alignment, alignment))
1649 handleStylePropertyChanged(&QQStyleKitDelegateProperties::alignmentChanged);
1652qreal QQStyleKitDelegateProperties::opacity()
const
1654 return styleProperty<qreal>(QQSK::Property::Opacity, 1.0);
1657void QQStyleKitDelegateProperties::setOpacity(qreal opacity)
1659 if (setStyleProperty(QQSK::Property::Opacity, opacity))
1660 handleStylePropertyChanged(&QQStyleKitDelegateProperties::opacityChanged);
1663QColor QQStyleKitDelegateProperties::color()
const
1665 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1668void QQStyleKitDelegateProperties::setColor(
const QColor &color)
1670 if (setStyleProperty(QQSK::Property::Color, color))
1671 handleStylePropertyChanged(&QQStyleKitDelegateProperties::colorChanged);
1674bool QQStyleKitDelegateProperties::visible()
const
1676 return styleProperty<
bool>(QQSK::Property::Visible,
true);
1679void QQStyleKitDelegateProperties::setVisible(
bool visible)
1681 if (setStyleProperty(QQSK::Property::Visible, visible))
1682 handleStylePropertyChanged(&QQStyleKitDelegateProperties::visibleChanged);
1685bool QQStyleKitDelegateProperties::clip()
const
1687 return styleProperty<
bool>(QQSK::Property::Clip,
false);
1690void QQStyleKitDelegateProperties::setClip(
bool clip)
1692 if (setStyleProperty(QQSK::Property::Clip, clip))
1693 handleStylePropertyChanged(&QQStyleKitDelegateProperties::clipChanged);
1696QQuickGradient *QQStyleKitDelegateProperties::gradient()
const
1698 return styleProperty<QQuickGradient *>(QQSK::Property::Gradient);
1701void QQStyleKitDelegateProperties::setGradient(QQuickGradient *gradient)
1703 if (setStyleProperty(QQSK::Property::Gradient, gradient))
1704 handleStylePropertyChanged(&QQStyleKitDelegateProperties::gradientChanged);
1707QObject *QQStyleKitDelegateProperties::data()
const
1709 return styleProperty<QObject *>(QQSK::Property::Data);
1712void QQStyleKitDelegateProperties::setData(QObject *data)
1714 if (setStyleProperty(QQSK::Property::Data, data))
1715 handleStylePropertyChanged(&QQStyleKitDelegateProperties::dataChanged);
1718QQmlComponent *QQStyleKitDelegateProperties::delegate()
const
1720 return styleProperty<QQmlComponent *>(QQSK::Property::Delegate);
1723void QQStyleKitDelegateProperties::setDelegate(QQmlComponent *delegate)
1725 if (setStyleProperty(QQSK::Property::Delegate, delegate))
1726 handleStylePropertyChanged(&QQStyleKitDelegateProperties::delegateChanged);
1729QQStyleKitBorderProperties *QQStyleKitDelegateProperties::border()
const
1731 return lazyCreateGroup(m_border, QQSK::PropertyGroup::Border);
1734QQStyleKitShadowProperties *QQStyleKitDelegateProperties::shadow()
const
1736 return lazyCreateGroup(m_shadow, QQSK::PropertyGroup::Shadow);
1739QQStyleKitImageProperties *QQStyleKitDelegateProperties::image()
const
1741 return lazyCreateGroup(m_image, QQSK::PropertyGroup::Image);
1747 : QQStyleKitDelegateProperties(group, parent)
1753 return lazyCreateGroup(m_first, QQSK::PropertyGroup::DelegateSubtype1);
1758 return lazyCreateGroup(m_second, QQSK::PropertyGroup::DelegateSubtype2);
1764 QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1765 : QQStyleKitDelegateProperties(group, parent)
1769template <
typename... CHANGED_SIGNALS>
1771 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1774 const QQStyleKitControlProperties *cp = controlProperties();
1781 return lazyCreateGroup(m_foreground, QQSK::PropertyGroup::Foreground);
1787 QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1788 : QQStyleKitDelegateProperties(group, parent)
1792template <
typename... CHANGED_SIGNALS>
1794 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1797 const QQStyleKitControlProperties *cp = controlProperties();
1803 return lazyCreateGroup(m_foreground, QQSK::PropertyGroup::Foreground);
1818 return lazyCreateGroup(m_first, QQSK::PropertyGroup::DelegateSubtype1);
1823 return lazyCreateGroup(m_second, QQSK::PropertyGroup::DelegateSubtype2);
1832template <
typename... CHANGED_SIGNALS>
1834 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1844 return styleProperty<QColor>(QQSK::Property::Color);
1849 if (setStyleProperty(QQSK::Property::Color, color))
1850 handleStylePropertyChanged(&QQStyleKitTextProperties::colorChanged);
1855 return styleProperty<Qt::Alignment>(QQSK::Property::Alignment);
1860 if (setStyleProperty(QQSK::Property::Alignment, alignment))
1861 handleStylePropertyChanged(&QQStyleKitTextProperties::alignmentChanged);
1866 return styleProperty<
bool>(QQSK::Property::Bold,
false);
1871 if (setStyleProperty(QQSK::Property::Bold, bold))
1877 return styleProperty<
bool>(QQSK::Property::Italic,
false);
1882 if (setStyleProperty(QQSK::Property::Italic, italic))
1888 return styleProperty<qreal>(QQSK::Property::PointSize);
1893 if (setStyleProperty(QQSK::Property::PointSize, pointSize))
1899 return styleProperty<qreal>(QQSK::Property::Padding);
1904 if (setStyleProperty(QQSK::Property::Padding, padding))
1915 return styleProperty<qreal>(QQSK::Property::LeftPadding, QQSK::Property::Padding);
1920 if (setStyleProperty(QQSK::Property::LeftPadding, padding))
1926 return styleProperty<qreal>(QQSK::Property::RightPadding, QQSK::Property::Padding);
1931 if (setStyleProperty(QQSK::Property::RightPadding, padding))
1937 return styleProperty<qreal>(QQSK::Property::TopPadding, QQSK::Property::Padding);
1942 if (setStyleProperty(QQSK::Property::TopPadding, padding))
1948 return styleProperty<qreal>(QQSK::Property::BottomPadding, QQSK::Property::Padding);
1953 if (setStyleProperty(QQSK::Property::BottomPadding, padding))
1959 return lazyCreateGroup(m_first, QQSK::PropertyGroup::DelegateSubtype1);
1964 return lazyCreateGroup(m_second, QQSK::PropertyGroup::DelegateSubtype2);
1969QQStyleKitControlProperties::QQStyleKitControlProperties(QQSK::PropertyGroup group, QObject *parent)
1970 : QQStyleKitPropertyGroup(group, parent)
1973
1974
1975
1976
1977 m_groupSpace.size = nestedGroupsStartSize;
1978 m_groupSpace.start = 0;
1980 if (group == QQSK::PropertyGroup::GlobalFlag) {
1982
1983
1984
1985
1986
1987
1988 m_pathFlags.setFlag(QQSK::PropertyPathFlag::Global);
1992QQStyleKitStyle *QQStyleKitControlProperties::style()
const
1994 if (subclass() == QQSK::Subclass::QQStyleKitState) {
1996
1997
1998
1999
2000
2001
2002 QObject *obj = parent();
2003 while (obj && !obj->metaObject()->inherits(&QQStyleKitStyle::staticMetaObject))
2004 obj = obj->parent();
2005 return obj ?
static_cast<QQStyleKitStyle *>(obj) :
nullptr;
2008 if (subclass() == QQSK::Subclass::QQStyleKitReader) {
2009 const auto *reader =
static_cast<
const QQStyleKitReader *>(
this);
2010 if (reader->m_explicitStyle)
2011 return reader->m_explicitStyle;
2015 return QQStyleKitStyle::current();
2018QQSK::Subclass QQStyleKitControlProperties::subclass()
const
2021
2022
2023
2024
2025
2026 if (metaObject()->inherits(&QQStyleKitReader::staticMetaObject))
2027 return QQSK::Subclass::QQStyleKitReader;
2028 if (metaObject()->inherits(&QQStyleKitControlState::staticMetaObject))
2029 return QQSK::Subclass::QQStyleKitState;
2033QQStyleKitReader *QQStyleKitControlProperties::asQQStyleKitReader()
const
2035 Q_ASSERT(subclass() == QQSK::Subclass::QQStyleKitReader);
2036 return static_cast<QQStyleKitReader *>(
const_cast<QQStyleKitControlProperties *>(
this));
2039QQStyleKitControlState *QQStyleKitControlProperties::asQQStyleKitState()
const
2041 Q_ASSERT(subclass() == QQSK::Subclass::QQStyleKitState);
2042 Q_ASSERT(metaObject()->inherits(&QQStyleKitControlState::staticMetaObject));
2043 return static_cast<QQStyleKitControlState *>(
const_cast<QQStyleKitControlProperties *>(
this));
2046void QQStyleKitControlProperties::forEachUsedDelegate(
2047 std::function<
void (QQStyleKitDelegateProperties *, QQSK::Delegate,
const QString &)> f)
2051 f(m_background, QQSK::Delegate::Background,
"background"_L1);
2054 f(m_indicator, QQSK::Delegate::Indicator,
"indicator"_L1);
2055 if (m_indicator->m_foreground)
2056 f(m_indicator->m_foreground, QQSK::Delegate::IndicatorForeground,
"indicator.foreground"_L1);
2057 if (m_indicator->m_first) {
2058 f(m_indicator->m_first, QQSK::Delegate::IndicatorFirst,
"indicator.first"_L1);
2059 if (m_indicator->m_first->m_foreground)
2060 f(m_indicator->m_first->m_foreground, QQSK::Delegate::IndicatorFirstForeground,
"indicator.first.foreground"_L1);
2062 if (m_indicator->m_second) {
2063 f(m_indicator->m_second, QQSK::Delegate::IndicatorSecond,
"indicator.second"_L1);
2064 if (m_indicator->m_second->m_foreground)
2065 f(m_indicator->m_second->m_foreground, QQSK::Delegate::IndicatorSecondForeground,
"indicator.second.foreground"_L1);
2070 f(m_handle, QQSK::Delegate::Handle,
"handle"_L1);
2071 if (m_handle->m_first)
2072 f(m_handle->m_first, QQSK::Delegate::HandleFirst,
"handle.first"_L1);
2073 if (m_handle->m_second)
2074 f(m_handle->m_second, QQSK::Delegate::HandleSecond,
"handle.second"_L1);
2078void QQStyleKitControlProperties::emitChangedForAllStyleProperties(EmitFlags emitFlags)
2081
2082
2083 if (emitFlags.testFlag(EmitFlag::AllProperties)) {
2084 emit leftPaddingChanged();
2085 emit rightPaddingChanged();
2086 emit topPaddingChanged();
2087 emit bottomPaddingChanged();
2088 emit spacingChanged();
2089 emit transitionChanged();
2093 forEachUsedDelegate([=](QQStyleKitDelegateProperties *delegate, QQSK::Delegate,
const QString &){
2094 delegate->emitChangedForAllStylePropertiesRecursive(emitFlags);
2098template <
typename... CHANGED_SIGNALS>
2099void QQStyleKitControlProperties::emitGlobally(
2100 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
2102 for (QQStyleKitReader *reader : QQStyleKitReader::s_allReaders) {
2103 if (reader->controlType() != controlType)
2105 ((reader->*changedSignals)(), ...);
2109qreal QQStyleKitControlProperties::spacing()
const
2111 return styleProperty<qreal>(QQSK::Property::Spacing);
2114void QQStyleKitControlProperties::setSpacing(qreal spacing)
2116 if (setStyleProperty(QQSK::Property::Spacing, spacing))
2117 handleStylePropertyChanged(&QQStyleKitControlProperties::spacingChanged);
2120qreal QQStyleKitControlProperties::padding()
const
2122 return styleProperty<qreal>(QQSK::Property::Padding);
2125void QQStyleKitControlProperties::setPadding(qreal padding)
2127 if (setStyleProperty(QQSK::Property::Padding, padding))
2128 handleStylePropertiesChanged<QQStyleKitControlProperties>(
2129 &QQStyleKitControlProperties::paddingChanged,
2130 &QQStyleKitControlProperties::leftPaddingChanged,
2131 &QQStyleKitControlProperties::rightPaddingChanged,
2132 &QQStyleKitControlProperties::topPaddingChanged,
2133 &QQStyleKitControlProperties::bottomPaddingChanged);
2136qreal QQStyleKitControlProperties::leftPadding()
const
2138 return styleProperty<qreal>(QQSK::Property::LeftPadding, QQSK::Property::Padding);
2141void QQStyleKitControlProperties::setLeftPadding(qreal leftPadding)
2143 if (setStyleProperty(QQSK::Property::LeftPadding, leftPadding))
2144 handleStylePropertyChanged(&QQStyleKitControlProperties::leftPaddingChanged);
2147qreal QQStyleKitControlProperties::rightPadding()
const
2149 return styleProperty<qreal>(QQSK::Property::RightPadding, QQSK::Property::Padding);
2152void QQStyleKitControlProperties::setRightPadding(qreal rightPadding)
2154 if (setStyleProperty(QQSK::Property::RightPadding, rightPadding))
2155 handleStylePropertyChanged(&QQStyleKitControlProperties::rightPaddingChanged);
2158qreal QQStyleKitControlProperties::topPadding()
const
2160 return styleProperty<qreal>(QQSK::Property::TopPadding, QQSK::Property::Padding);
2163void QQStyleKitControlProperties::setTopPadding(qreal topPadding)
2165 if (setStyleProperty(QQSK::Property::TopPadding, topPadding))
2166 handleStylePropertyChanged(&QQStyleKitControlProperties::topPaddingChanged);
2169qreal QQStyleKitControlProperties::bottomPadding()
const
2171 return styleProperty<qreal>(QQSK::Property::BottomPadding, QQSK::Property::Padding);
2174void QQStyleKitControlProperties::setBottomPadding(qreal bottomPadding)
2176 if (setStyleProperty(QQSK::Property::BottomPadding, bottomPadding))
2177 handleStylePropertyChanged(&QQStyleKitControlProperties::bottomPaddingChanged);
2180QQuickTransition *QQStyleKitControlProperties::transition()
const
2182 return styleProperty<QQuickTransition *>(QQSK::Property::Transition);
2185void QQStyleKitControlProperties::setTransition(QQuickTransition *transition)
2187 if (setStyleProperty(QQSK::Property::Transition, transition))
2188 handleStylePropertyChanged(&QQStyleKitControlProperties::transitionChanged);
2191QQStyleKitTextProperties *QQStyleKitControlProperties::text()
const
2193 return lazyCreateGroup(m_text, QQSK::PropertyGroup::Text);
2196QQStyleKitDelegateProperties *QQStyleKitControlProperties::background()
const
2198 return lazyCreateGroup(m_background, QQSK::PropertyGroup::Background);
2201QQStyleKitHandleProperties *QQStyleKitControlProperties::handle()
const
2203 return lazyCreateGroup(m_handle, QQSK::PropertyGroup::Handle);
2206QQStyleKitIndicatorWithSubTypes *QQStyleKitControlProperties::indicator()
const
2208 return lazyCreateGroup(m_indicator, QQSK::PropertyGroup::Indicator);
2213#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)