15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
72
73
74
75
76
77
78
81
82
83
84
85
86
89
90
91
92
93
94
95
98
99
100
101
102
103
106
107
108
109
110
111
112
113
116
117
118
119
120
121
122
125
126
127
128
129
130
131
132
133
134
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
156
157
158
159
160
161
162
165
166
167
168
169
170
171
172
173
174
175
178
179
180
181
182
183
184
185
186
187
190
191
192
193
194
195
196
199
200
201
202
203
204
205
206
207
208
211
212
213
214
215
216
217
220
221
222
223
224
227
228
229
230
233
234
235
236
237
238
239
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
288
289
290
291
292
295
296
297
298
301
302
303
304
305
306
309
310
311
312
313
314
315
318
319
320
321
322
323
326
327
328
329
332
333
334
335
336
337
338
339
340
341
342
343
344
345
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
407
408
409
410
411
412
413
414
415
416
417
418
419
420
423
424
425
426
427
428
431
432
433
434
437
438
439
440
441
444
445
446
447
448
449
450
453
454
455
456
457
458
459
460
463
464
465
466
467
470
471
472
473
474
475
476
479
480
481
482
483
484
485
486
489
490
491
492
493
494
495
498
499
500
501
504
505
506
507
510
511
512
513
514
515
518
519
520
521
522
523
526
527
528
529
530
531
532
535
536
537
538
539
540
543
544
545
546
547
548
549
550
551
552
553
554
559
560
561
562
563
564
565
566
567
568
569
570
571
574
575
576
577
578
581
582
583
584
585
586
589
590
591
592
597
598
599
600
601
602
603
604
605
606
607
608
609
612
613
614
615
618
619
620
621
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
650
651
652
653
654
655
658
659
660
661
662
663
664
667
668
669
670
671
672
675
676
677
678
681
682
683
684
685
686
687
690
691
692
693
694
697
698
699
700
703
704
705
706
707
708
709
710
711
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
738
739
740
741
742
743
746
747
748
749
750
751
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
776
777
778
779
780
781
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
821
822
823
824
825
826
827
828
831
832
833
834
835
836
837
838
839
840
841
842
845
846
847
848
849
850
851
852
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
879
880
881
882
885
886
887
888
889
890
891
894
895
896
897
898
899
900
903
904
905
906
909
910
911
912
913
914
915
918
919
920
921
922
923
924
927
928
929
930
931
932
933
934
937
938
939
940
943
944
945
946
947
948
949
952
953
954
955
956
957
958
962QHash<PropertyPathId_t, QString> QQStyleKitPropertyGroup::s_pathStrings;
971 if (flag == PropertyPathId::Flag::IncludeSubtype) {
972 if (m_pathFlags.testFlag(QQSK::PropertyPathFlag::DelegateSubtype1))
973 return PropertyPathId(property, m_groupSpace.start, QQSK::PropertyGroup::DelegateSubtype1);
974 else if (m_pathFlags.testFlag(QQSK::PropertyPathFlag::DelegateSubtype2))
975 return PropertyPathId(property, m_groupSpace.start, QQSK::PropertyGroup::DelegateSubtype2);
977 return PropertyPathId(property, m_groupSpace.start, QQSK::PropertyGroup::DelegateSubtype0);
983
984
985
986
987
988
989
990
991
992 if (s_pathStrings.contains(m_groupSpace.start))
993 return s_pathStrings[m_groupSpace.start];
995 constexpr PropertyPathId_t rootGroupsSize = nestedGroupsStartSize / nestedGroupCount;
996 const auto metaEnum = QMetaEnum::fromType<QQSK::PropertyGroup>();
998 PropertyPathId_t nestedGroupStart = m_groupSpace.start;
999 PropertyPathId_t nestedGroupSize = rootGroupsSize;
1000 PropertyPathId_t nestedGroupIndex = nestedGroupStart / nestedGroupSize;
1001 auto groupType = QQSK::PropertyGroup(nestedGroupIndex);
1002 if (groupType == QQSK::PropertyGroup::Control)
1005 QString groupName = QString::fromLatin1(metaEnum.valueToKey(
static_cast<
int>(groupType)));
1006 groupName[0] = groupName[0].toLower();
1007 QString pathString = groupName;
1010 nestedGroupStart -= nestedGroupIndex * nestedGroupSize;
1011 nestedGroupSize /= nestedGroupCount;
1012 nestedGroupIndex = nestedGroupStart / nestedGroupSize;
1013 groupType = QQSK::PropertyGroup(nestedGroupIndex);
1014 if (groupType == QQSK::PropertyGroup::Control)
1017 QString groupName = QString::fromLatin1(metaEnum.valueToKey(
static_cast<
int>(groupType)));
1018 groupName[0] = groupName[0].toLower();
1019 pathString +=
'.'_L1 + groupName;
1022 s_pathStrings.insert(m_groupSpace.start, pathString);
1031 return static_cast<QQStyleKitControlProperties *>(self);
1040 T *nestedGroup = QQSK::lazyCreate(ptr, controlProperties(), group);
1043 nestedGroup->m_pathFlags = m_pathFlags;
1045 if (group == QQSK::PropertyGroup::DelegateSubtype1) {
1047
1048
1049
1050
1051
1052
1053 nestedGroup->m_pathFlags.setFlag(QQSK::PropertyPathFlag::DelegateSubtype1);
1054 nestedGroup->m_groupSpace = m_groupSpace;
1055 }
else if (group == QQSK::PropertyGroup::DelegateSubtype2) {
1056 nestedGroup->m_pathFlags.setFlag(QQSK::PropertyPathFlag::DelegateSubtype2);
1057 nestedGroup->m_groupSpace = m_groupSpace;
1060
1061
1062 const PropertyPathId_t nestedGroupIndex = PropertyPathId_t(group);
1063 const PropertyPathId_t nestedGroupSize = m_groupSpace.size / nestedGroupCount;
1064 nestedGroup->m_groupSpace.size = nestedGroupSize;
1065 nestedGroup->m_groupSpace.start = m_groupSpace.start + (nestedGroupIndex * nestedGroupSize);
1067
1068
1069
1070
1071
1072 Q_ASSERT(nestedGroupSize >= PropertyPathId_t(QQSK::Property::COUNT));
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088#define CONDITIONALLY_EMIT_SIGNALS_GLOBALLY_FOR(CONTROL_PROPERTIES, GROUP_PATH) if
1089 (this == CONTROL_PROPERTIES -> GROUP_PATH ) {
1090 for (QQStyleKitReader *reader : QQStyleKitReader::s_allReaders) {
1091 const auto baseTypes = QQStyleKitPropertyResolver::baseTypesForType(reader->controlType());
1092 if (reader->controlType() != controlType && !baseTypes.contains(controlType))
1094 reader->clearLocalStorage();
1095 ((reader-> GROUP_PATH ->*changedSignals)(), ...);
1098}
1100template<
typename SUBCLASS>
1102 handleStylePropertiesChanged<SUBCLASS>(changedSignal);
1105template <
typename SUBCLASS,
typename... CHANGED_SIGNALS>
1109
1110
1111
1112
1113
1114
1115
1116 static_assert(std::is_base_of<QQStyleKitPropertyGroup, SUBCLASS>::value,
1117 "SUBCLASS must inherit QQStyleKitPropertyGroup");
1119 auto *group =
static_cast<SUBCLASS *>(
this);
1122 if (objectWrittenTo == QQSK::Subclass::QQStyleKitState) {
1123 ((group->*changedSignals)(), ...);
1125 if (shouldEmitGlobally()) {
1127 const QQStyleKitExtendableControlType type = control->controlType();
1128 group->emitGlobally(type, changedSignals...);
1133 if (objectWrittenTo == QQSK::Subclass::QQStyleKitReader) {
1135
1136
1137
1138 if (shouldEmitLocally())
1139 ((group->*changedSignals)(), ...);
1149
1150
1151 const int startIndex = QQStyleKitPropertyGroup::staticMetaObject.propertyOffset();
1152 const QMetaObject* meta = metaObject();
1153 for (
int i = startIndex; i < meta->propertyCount(); ++i) {
1154 const QMetaProperty prop = meta->property(i);
1155 const QMetaObject* propMetaObject = QMetaType::fromName(prop.typeName()).metaObject();
1156 if (propMetaObject) {
1157 if (propMetaObject->inherits(&QQStyleKitDelegateProperties::staticMetaObject)) {
1159
1160
1163 if (propMetaObject->inherits(&QQStyleKitPropertyGroup::staticMetaObject)) {
1165 QObject *childObj = qvariant_cast<QObject *>(property(prop.name()));
1166 if (
auto *child = qobject_cast<QQStyleKitPropertyGroup *>(childObj))
1167 child->emitChangedForAllStylePropertiesRecursive(emitFlags);
1172 if (!emitFlags.testFlag(EmitFlag::AllProperties)) {
1174 if (emitFlags.testFlag(EmitFlag::Colors)) {
1175 if (prop.metaType() != QMetaType::fromType<QColor>())
1181 Q_ASSERT(prop.hasNotifySignal());
1182 QMetaMethod notify = prop.notifySignal();
1183 notify.invoke(
this, Qt::DirectConnection);
1198 if (parentStyle
->loaded() && !parentStyle->m_isUpdatingPalette) {
1200
1201
1202
1203
1204
1205
1218template <
typename... CHANGED_SIGNALS>
1220 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1232 return styleProperty<QUrl>(QQSK::Property::Source);
1237 if (setStyleProperty(QQSK::Property::Source, source))
1238 handleStylePropertyChanged(&QQStyleKitImageProperties::sourceChanged);
1243 return styleProperty<QColor>(QQSK::Property::Color);
1248 if (setStyleProperty(QQSK::Property::Color, color))
1254 return styleProperty<QQuickImage::FillMode>(QQSK::Property::FillMode);
1259 if (setStyleProperty(QQSK::Property::FillMode, fillMode))
1260 handleStylePropertyChanged(&QQStyleKitImageProperties::fillModeChanged);
1270template <
typename... CHANGED_SIGNALS>
1272 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1284 return styleProperty<qreal>(QQSK::Property::Width);
1289 if (setStyleProperty(QQSK::Property::Width, width))
1290 handleStylePropertyChanged(&QQStyleKitBorderProperties::widthChanged);
1295 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1300 if (setStyleProperty(QQSK::Property::Color, color))
1306QQStyleKitShadowProperties::QQStyleKitShadowProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1307 : QQStyleKitPropertyGroup(group, parent)
1311template <
typename... CHANGED_SIGNALS>
1312void QQStyleKitShadowProperties::emitGlobally(
1313 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1316 const QQStyleKitControlProperties *cp = controlProperties();
1323QColor QQStyleKitShadowProperties::color()
const
1325 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1328void QQStyleKitShadowProperties::setColor(QColor color)
1330 if (setStyleProperty(QQSK::Property::Color, color))
1331 handleStylePropertyChanged(&QQStyleKitShadowProperties::colorChanged);
1334qreal QQStyleKitShadowProperties::opacity()
const
1336 return styleProperty<qreal>(QQSK::Property::Opacity, 1.0);
1339void QQStyleKitShadowProperties::setOpacity(qreal opacity)
1341 if (setStyleProperty(QQSK::Property::Opacity, opacity))
1342 handleStylePropertyChanged(&QQStyleKitShadowProperties::opacityChanged);
1345qreal QQStyleKitShadowProperties::scale()
const
1347 return styleProperty<qreal>(QQSK::Property::Scale, 1.0);
1350void QQStyleKitShadowProperties::setScale(qreal scale)
1352 if (setStyleProperty(QQSK::Property::Scale, scale))
1353 handleStylePropertyChanged(&QQStyleKitShadowProperties::scaleChanged);
1356qreal QQStyleKitShadowProperties::verticalOffset()
const
1358 return styleProperty<qreal>(QQSK::Property::VOffset);
1361void QQStyleKitShadowProperties::setVerticalOffset(qreal verticalOffset)
1363 if (setStyleProperty(QQSK::Property::VOffset, verticalOffset))
1364 handleStylePropertyChanged(&QQStyleKitShadowProperties::verticalOffsetChanged);
1367qreal QQStyleKitShadowProperties::horizontalOffset()
const
1369 return styleProperty<qreal>(QQSK::Property::HOffset);
1372void QQStyleKitShadowProperties::setHorizontalOffset(qreal horizontalOffset)
1374 if (setStyleProperty(QQSK::Property::HOffset, horizontalOffset))
1375 handleStylePropertyChanged(&QQStyleKitShadowProperties::horizontalOffsetChanged);
1378qreal QQStyleKitShadowProperties::blur()
const
1380 return styleProperty<qreal>(QQSK::Property::Blur, 10.0);
1383void QQStyleKitShadowProperties::setBlur(qreal blur)
1385 if (setStyleProperty(QQSK::Property::Blur, blur))
1386 handleStylePropertyChanged(&QQStyleKitShadowProperties::blurChanged);
1389bool QQStyleKitShadowProperties::visible()
const
1391 return styleProperty<
bool>(QQSK::Property::Visible,
true);
1394void QQStyleKitShadowProperties::setVisible(
bool visible)
1396 if (setStyleProperty(QQSK::Property::Visible, visible))
1397 handleStylePropertyChanged(&QQStyleKitShadowProperties::visibleChanged);
1400QQmlComponent *QQStyleKitShadowProperties::delegate()
const
1402 return styleProperty<QQmlComponent *>(QQSK::Property::Delegate);
1405void QQStyleKitShadowProperties::setDelegate(QQmlComponent *delegate)
1407 if (setStyleProperty(QQSK::Property::Delegate, delegate))
1408 handleStylePropertyChanged(&QQStyleKitShadowProperties::delegateChanged);
1413QQStyleKitDelegateProperties::QQStyleKitDelegateProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1414 : QQStyleKitPropertyGroup(group, parent)
1418template <
typename... CHANGED_SIGNALS>
1419void QQStyleKitDelegateProperties::emitGlobally(
1420 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1423 const QQStyleKitControlProperties *cp = controlProperties();
1430qreal QQStyleKitDelegateProperties::radius()
const
1432 return styleProperty<qreal>(QQSK::Property::Radius);
1435void QQStyleKitDelegateProperties::setRadius(qreal radius)
1437 if (setStyleProperty(QQSK::Property::Radius, radius))
1438 handleStylePropertiesChanged<QQStyleKitDelegateProperties>(
1439 &QQStyleKitDelegateProperties::radiusChanged,
1440 &QQStyleKitDelegateProperties::topLeftRadiusChanged,
1441 &QQStyleKitDelegateProperties::topRightRadiusChanged,
1442 &QQStyleKitDelegateProperties::bottomLeftRadiusChanged,
1443 &QQStyleKitDelegateProperties::bottomRightRadiusChanged);
1446qreal QQStyleKitDelegateProperties::topLeftRadius()
const
1448 return styleProperty<qreal>(QQSK::Property::TopLeftRadius, QQSK::Property::Radius);
1451void QQStyleKitDelegateProperties::setTopLeftRadius(qreal radius)
1453 if (setStyleProperty(QQSK::Property::TopLeftRadius, radius))
1454 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topLeftRadiusChanged);
1457qreal QQStyleKitDelegateProperties::topRightRadius()
const
1459 return styleProperty<qreal>(QQSK::Property::TopRightRadius, QQSK::Property::Radius);
1462void QQStyleKitDelegateProperties::setTopRightRadius(qreal radius)
1464 if (setStyleProperty(QQSK::Property::TopRightRadius, radius))
1465 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topRightRadiusChanged);
1468qreal QQStyleKitDelegateProperties::bottomLeftRadius()
const
1470 return styleProperty<qreal>(QQSK::Property::BottomLeftRadius, QQSK::Property::Radius);
1473void QQStyleKitDelegateProperties::setBottomLeftRadius(qreal radius)
1475 if (setStyleProperty(QQSK::Property::BottomLeftRadius, radius))
1476 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomLeftRadiusChanged);
1479qreal QQStyleKitDelegateProperties::bottomRightRadius()
const
1481 return styleProperty<qreal>(QQSK::Property::BottomRightRadius, QQSK::Property::Radius);
1484void QQStyleKitDelegateProperties::setBottomRightRadius(qreal radius)
1486 if (setStyleProperty(QQSK::Property::BottomRightRadius, radius))
1487 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomRightRadiusChanged);
1490qreal QQStyleKitDelegateProperties::scale()
const
1492 return styleProperty<qreal>(QQSK::Property::Scale, 1.0);
1495void QQStyleKitDelegateProperties::setScale(qreal scale)
1497 if (setStyleProperty(QQSK::Property::Scale, scale))
1498 handleStylePropertyChanged(&QQStyleKitDelegateProperties::scaleChanged);
1501qreal QQStyleKitDelegateProperties::rotation()
const
1503 return styleProperty<qreal>(QQSK::Property::Rotation);
1506void QQStyleKitDelegateProperties::setRotation(qreal rotation)
1508 if (setStyleProperty(QQSK::Property::Rotation, rotation))
1509 handleStylePropertyChanged(&QQStyleKitDelegateProperties::rotationChanged);
1512qreal QQStyleKitDelegateProperties::implicitWidth()
const
1514 return styleProperty<qreal>(QQSK::Property::ImplicitWidth);
1517void QQStyleKitDelegateProperties::setImplicitWidth(qreal width)
1519 if (setStyleProperty(QQSK::Property::ImplicitWidth, width))
1520 handleStylePropertyChanged(&QQStyleKitDelegateProperties::implicitWidthChanged);
1523qreal QQStyleKitDelegateProperties::implicitHeight()
const
1525 return styleProperty<qreal>(QQSK::Property::ImplicitHeight);
1528void QQStyleKitDelegateProperties::setImplicitHeight(qreal height)
1530 if (setStyleProperty(QQSK::Property::ImplicitHeight, height))
1531 handleStylePropertyChanged(&QQStyleKitDelegateProperties::implicitHeightChanged);
1534qreal QQStyleKitDelegateProperties::minimumWidth()
const
1536 return styleProperty<qreal>(QQSK::Property::MinimumWidth);
1539void QQStyleKitDelegateProperties::setMinimumWidth(qreal width)
1541 if (setStyleProperty(QQSK::Property::MinimumWidth, width))
1542 handleStylePropertyChanged(&QQStyleKitDelegateProperties::minimumWidthChanged);
1545qreal QQStyleKitDelegateProperties::margins()
const
1547 return styleProperty<qreal>(QQSK::Property::Margins);
1550void QQStyleKitDelegateProperties::setMargins(qreal margins)
1552 if (setStyleProperty(QQSK::Property::Margins, margins))
1553 handleStylePropertiesChanged<QQStyleKitDelegateProperties>(
1554 &QQStyleKitDelegateProperties::marginsChanged,
1555 &QQStyleKitDelegateProperties::leftMarginChanged,
1556 &QQStyleKitDelegateProperties::rightMarginChanged,
1557 &QQStyleKitDelegateProperties::topMarginChanged,
1558 &QQStyleKitDelegateProperties::bottomMarginChanged);
1561qreal QQStyleKitDelegateProperties::leftMargin()
const
1563 return styleProperty<qreal>(QQSK::Property::LeftMargin, QQSK::Property::Margins);
1566void QQStyleKitDelegateProperties::setLeftMargin(qreal margin)
1568 if (setStyleProperty(QQSK::Property::LeftMargin, margin))
1569 handleStylePropertyChanged(&QQStyleKitDelegateProperties::leftMarginChanged);
1572qreal QQStyleKitDelegateProperties::rightMargin()
const
1574 return styleProperty<qreal>(QQSK::Property::RightMargin, QQSK::Property::Margins);
1577void QQStyleKitDelegateProperties::setRightMargin(qreal margin)
1579 if (setStyleProperty(QQSK::Property::RightMargin, margin))
1580 handleStylePropertyChanged(&QQStyleKitDelegateProperties::rightMarginChanged);
1583qreal QQStyleKitDelegateProperties::topMargin()
const
1585 return styleProperty<qreal>(QQSK::Property::TopMargin, QQSK::Property::Margins);
1588void QQStyleKitDelegateProperties::setTopMargin(qreal margin)
1590 if (setStyleProperty(QQSK::Property::TopMargin, margin))
1591 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topMarginChanged);
1594qreal QQStyleKitDelegateProperties::bottomMargin()
const
1596 return styleProperty<qreal>(QQSK::Property::BottomMargin, QQSK::Property::Margins);
1599void QQStyleKitDelegateProperties::setBottomMargin(qreal margin)
1601 if (setStyleProperty(QQSK::Property::BottomMargin, margin))
1602 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomMarginChanged);
1605Qt::Alignment QQStyleKitDelegateProperties::alignment()
const
1607 return styleProperty<Qt::Alignment>(QQSK::Property::Alignment, Qt::AlignLeft | Qt::AlignVCenter);
1610void QQStyleKitDelegateProperties::setAlignment(Qt::Alignment alignment)
1612 if (setStyleProperty(QQSK::Property::Alignment, alignment))
1613 handleStylePropertyChanged(&QQStyleKitDelegateProperties::alignmentChanged);
1616qreal QQStyleKitDelegateProperties::opacity()
const
1618 return styleProperty<qreal>(QQSK::Property::Opacity, 1.0);
1621void QQStyleKitDelegateProperties::setOpacity(qreal opacity)
1623 if (setStyleProperty(QQSK::Property::Opacity, opacity))
1624 handleStylePropertyChanged(&QQStyleKitDelegateProperties::opacityChanged);
1627QColor QQStyleKitDelegateProperties::color()
const
1629 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1632void QQStyleKitDelegateProperties::setColor(
const QColor &color)
1634 if (setStyleProperty(QQSK::Property::Color, color))
1635 handleStylePropertyChanged(&QQStyleKitDelegateProperties::colorChanged);
1638bool QQStyleKitDelegateProperties::visible()
const
1640 return styleProperty<
bool>(QQSK::Property::Visible,
true);
1643void QQStyleKitDelegateProperties::setVisible(
bool visible)
1645 if (setStyleProperty(QQSK::Property::Visible, visible))
1646 handleStylePropertyChanged(&QQStyleKitDelegateProperties::visibleChanged);
1649bool QQStyleKitDelegateProperties::clip()
const
1651 return styleProperty<
bool>(QQSK::Property::Clip,
false);
1654void QQStyleKitDelegateProperties::setClip(
bool clip)
1656 if (setStyleProperty(QQSK::Property::Clip, clip))
1657 handleStylePropertyChanged(&QQStyleKitDelegateProperties::clipChanged);
1660QQuickGradient *QQStyleKitDelegateProperties::gradient()
const
1662 return styleProperty<QQuickGradient *>(QQSK::Property::Gradient);
1665void QQStyleKitDelegateProperties::setGradient(QQuickGradient *gradient)
1667 if (setStyleProperty(QQSK::Property::Gradient, gradient))
1668 handleStylePropertyChanged(&QQStyleKitDelegateProperties::gradientChanged);
1671QObject *QQStyleKitDelegateProperties::data()
const
1673 return styleProperty<QObject *>(QQSK::Property::Data);
1676void QQStyleKitDelegateProperties::setData(QObject *data)
1678 if (setStyleProperty(QQSK::Property::Data, data))
1679 handleStylePropertyChanged(&QQStyleKitDelegateProperties::dataChanged);
1682QQmlComponent *QQStyleKitDelegateProperties::delegate()
const
1684 return styleProperty<QQmlComponent *>(QQSK::Property::Delegate);
1687void QQStyleKitDelegateProperties::setDelegate(QQmlComponent *delegate)
1689 if (setStyleProperty(QQSK::Property::Delegate, delegate))
1690 handleStylePropertyChanged(&QQStyleKitDelegateProperties::delegateChanged);
1693QQStyleKitBorderProperties *QQStyleKitDelegateProperties::border()
const
1695 return lazyCreateGroup(m_border, QQSK::PropertyGroup::Border);
1698QQStyleKitShadowProperties *QQStyleKitDelegateProperties::shadow()
const
1700 return lazyCreateGroup(m_shadow, QQSK::PropertyGroup::Shadow);
1703QQStyleKitImageProperties *QQStyleKitDelegateProperties::image()
const
1705 return lazyCreateGroup(m_image, QQSK::PropertyGroup::Image);
1711 : QQStyleKitDelegateProperties(group, parent)
1717 return lazyCreateGroup(m_first, QQSK::PropertyGroup::DelegateSubtype1);
1722 return lazyCreateGroup(m_second, QQSK::PropertyGroup::DelegateSubtype2);
1729 : QQStyleKitDelegateProperties(group, parent)
1733template <
typename... CHANGED_SIGNALS>
1735 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1745 return lazyCreateGroup(m_foreground, QQSK::PropertyGroup::Foreground);
1752 : QQStyleKitDelegateProperties(group, parent)
1756template <
typename... CHANGED_SIGNALS>
1758 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1767 return lazyCreateGroup(m_foreground, QQSK::PropertyGroup::Foreground);
1772 return lazyCreateGroup(m_up, QQSK::PropertyGroup::DelegateSubtype1);
1777 return lazyCreateGroup(m_down, QQSK::PropertyGroup::DelegateSubtype2);
1786template <
typename... CHANGED_SIGNALS>
1788 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1796 return styleProperty<QColor>(QQSK::Property::Color);
1801 if (setStyleProperty(QQSK::Property::Color, color))
1802 handleStylePropertyChanged(&QQStyleKitTextProperties::colorChanged);
1807 return styleProperty<Qt::Alignment>(QQSK::Property::Alignment);
1812 if (setStyleProperty(QQSK::Property::Alignment, alignment))
1813 handleStylePropertyChanged(&QQStyleKitTextProperties::alignmentChanged);
1818 return styleProperty<
bool>(QQSK::Property::Bold,
false);
1823 if (setStyleProperty(QQSK::Property::Bold, bold))
1829 return styleProperty<
bool>(QQSK::Property::Italic,
false);
1834 if (setStyleProperty(QQSK::Property::Italic, italic))
1840 return styleProperty<qreal>(QQSK::Property::PointSize);
1845 if (setStyleProperty(QQSK::Property::PointSize, pointSize))
1851 return styleProperty<qreal>(QQSK::Property::Padding);
1856 if (setStyleProperty(QQSK::Property::Padding, padding))
1867 return styleProperty<qreal>(QQSK::Property::LeftPadding, QQSK::Property::Padding);
1872 if (setStyleProperty(QQSK::Property::LeftPadding, padding))
1878 return styleProperty<qreal>(QQSK::Property::RightPadding, QQSK::Property::Padding);
1883 if (setStyleProperty(QQSK::Property::RightPadding, padding))
1889 return styleProperty<qreal>(QQSK::Property::TopPadding, QQSK::Property::Padding);
1894 if (setStyleProperty(QQSK::Property::TopPadding, padding))
1900 return styleProperty<qreal>(QQSK::Property::BottomPadding, QQSK::Property::Padding);
1905 if (setStyleProperty(QQSK::Property::BottomPadding, padding))
1915
1916
1917
1918
1919 m_groupSpace.size = nestedGroupsStartSize;
1920 m_groupSpace.start = 0;
1922 if (group == QQSK::PropertyGroup::GlobalFlag) {
1924
1925
1926
1927
1928
1929
1930 m_pathFlags.setFlag(QQSK::PropertyPathFlag::Global);
1936 if (subclass() == QQSK::Subclass::QQStyleKitState) {
1938
1939
1940
1941
1942
1943
1944 QObject *obj = parent();
1945 while (obj && !obj->metaObject()->inherits(&QQStyleKitStyle::staticMetaObject))
1946 obj = obj->parent();
1951
1952
1953
1954
1961
1962
1963
1964
1965
1966 if (metaObject()->inherits(&QQStyleKitReader::staticMetaObject))
1967 return QQSK::Subclass::QQStyleKitReader;
1968 if (metaObject()->inherits(&QQStyleKitControlState::staticMetaObject))
1969 return QQSK::Subclass::QQStyleKitState;
1975 Q_ASSERT(subclass() == QQSK::Subclass::QQStyleKitReader);
1976 return static_cast<QQStyleKitReader *>(
const_cast<QQStyleKitControlProperties *>(
this));
1981 Q_ASSERT(subclass() == QQSK::Subclass::QQStyleKitState);
1982 Q_ASSERT(metaObject()->inherits(&QQStyleKitControlState::staticMetaObject));
1983 return static_cast<QQStyleKitControlState *>(
const_cast<QQStyleKitControlProperties *>(
this));
1987 std::function<
void (QQStyleKitDelegateProperties *, QQSK::Delegate,
const QString &)> f)
1991 f(m_background, QQSK::Delegate::Background,
"background"_L1);
1994 f(m_indicator, QQSK::Delegate::Indicator,
"indicator"_L1);
1995 if (m_indicator->m_foreground)
1996 f(m_indicator->m_foreground, QQSK::Delegate::IndicatorForeground,
"indicator.foreground"_L1);
1997 if (m_indicator->m_up) {
1998 f(m_indicator->m_up, QQSK::Delegate::IndicatorUp,
"indicator.up"_L1);
1999 if (m_indicator->m_up->m_foreground)
2000 f(m_indicator->m_up->m_foreground, QQSK::Delegate::IndicatorUpForeground,
"indicator.up.foreground"_L1);
2002 if (m_indicator->m_down) {
2003 f(m_indicator->m_down, QQSK::Delegate::IndicatorDown,
"indicator.down"_L1);
2004 if (m_indicator->m_down->m_foreground)
2005 f(m_indicator->m_down->m_foreground, QQSK::Delegate::IndicatorDownForeground,
"indicator.down.foreground"_L1);
2010 f(m_handle, QQSK::Delegate::Handle,
"handle"_L1);
2011 if (m_handle->m_first)
2012 f(m_handle->m_first, QQSK::Delegate::HandleFirst,
"handle.first"_L1);
2013 if (m_handle->m_second)
2014 f(m_handle->m_second, QQSK::Delegate::HandleSecond,
"handle.second"_L1);
2021
2022
2023 if (emitFlags.testFlag(EmitFlag::AllProperties)) {
2024 emit leftPaddingChanged();
2025 emit rightPaddingChanged();
2026 emit topPaddingChanged();
2027 emit bottomPaddingChanged();
2028 emit spacingChanged();
2029 emit transitionChanged();
2033 forEachUsedDelegate([=](QQStyleKitDelegateProperties *delegate, QQSK::Delegate,
const QString &){
2034 delegate->emitChangedForAllStylePropertiesRecursive(emitFlags);
2038template <
typename... CHANGED_SIGNALS>
2040 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
2042 for (QQStyleKitReader *reader : QQStyleKitReader::s_allReaders) {
2043 if (reader->controlType() != controlType)
2045 ((reader->*changedSignals)(), ...);
2051 return styleProperty<qreal>(QQSK::Property::Spacing);
2056 if (setStyleProperty(QQSK::Property::Spacing, spacing))
2062 return styleProperty<qreal>(QQSK::Property::Padding);
2067 if (setStyleProperty(QQSK::Property::Padding, padding))
2078 return styleProperty<qreal>(QQSK::Property::LeftPadding, QQSK::Property::Padding);
2083 if (setStyleProperty(QQSK::Property::LeftPadding, leftPadding))
2089 return styleProperty<qreal>(QQSK::Property::RightPadding, QQSK::Property::Padding);
2094 if (setStyleProperty(QQSK::Property::RightPadding, rightPadding))
2100 return styleProperty<qreal>(QQSK::Property::TopPadding, QQSK::Property::Padding);
2105 if (setStyleProperty(QQSK::Property::TopPadding, topPadding))
2111 return styleProperty<qreal>(QQSK::Property::BottomPadding, QQSK::Property::Padding);
2116 if (setStyleProperty(QQSK::Property::BottomPadding, bottomPadding))
2122 return styleProperty<QQuickTransition *>(QQSK::Property::Transition);
2127 if (setStyleProperty(QQSK::Property::Transition, transition))
2133 return lazyCreateGroup(m_text, QQSK::PropertyGroup::Text);
2138 return lazyCreateGroup(m_background, QQSK::PropertyGroup::Background);
2143 return lazyCreateGroup(m_handle, QQSK::PropertyGroup::Handle);
2148 return lazyCreateGroup(m_indicator, QQSK::PropertyGroup::Indicator);
2153#include "moc_qqstylekitcontrolproperties_p.cpp"
void setColor(const QColor &color)
void emitGlobally(QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals) const
void setWidth(qreal width)
qreal rightPadding() const
qreal leftPadding() const
void leftPaddingChanged()
QQStyleKitTextProperties * text() const
void setTopPadding(qreal topPadding)
QQSK::Subclass subclass() const
void rightPaddingChanged()
QQStyleKitIndicatorWithSubTypes * indicator() const
void setTransition(QQuickTransition *transition)
void setSpacing(qreal spacing)
void emitGlobally(QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals) const
QQStyleKitDelegateProperties * background() const
QQStyleKitStyle * style() const
void setRightPadding(qreal rightPadding)
QQStyleKitReader * asQQStyleKitReader() const
void emitChangedForAllStyleProperties(EmitFlags emitFlags)
QQuickTransition * transition() const
QQStyleKitHandleProperties * handle() const
QQStyleKitControlState * asQQStyleKitState() const
void setBottomPadding(qreal bottomPadding)
void setPadding(qreal padding)
void setLeftPadding(qreal leftPadding)
void bottomPaddingChanged()
qreal bottomPadding() const
QQStyleKitControl * control() const
QQStyleKitDelegateProperties * first() const
QQStyleKitDelegateProperties * second() const
void setColor(const QColor &color)
QQuickImage::FillMode fillMode() const
void emitGlobally(QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals) const
void setSource(const QUrl &source)
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
static QQStyleKitStyle * current()
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)