14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
53
54
55
56
57
58
59
62
63
64
65
66
67
68
69
70
71
72
75
76
77
78
79
80
81
82
83
84
87
88
89
90
91
92
93
96
97
98
99
100
101
102
103
104
105
108
109
110
111
112
113
114
117
118
119
120
121
124
125
126
127
130
131
132
133
134
135
136
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
188
189
190
191
192
195
196
197
198
201
202
203
204
205
206
209
210
211
212
213
214
215
218
219
220
221
222
223
226
227
228
229
232
233
234
235
236
237
238
239
240
241
242
243
244
245
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
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
304
305
308
309
310
311
312
313
314
315
316
317
318
319
320
321
324
325
326
327
328
329
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
366
367
368
369
370
371
372
375
376
377
378
379
380
381
382
385
386
387
388
389
392
393
394
395
396
399
400
401
402
403
404
405
406
407
408
409
410
411
412
415
416
417
418
419
420
421
422
423
424
425
426
427
428
431
432
433
434
435
436
437
440
441
442
443
444
445
446
447
450
451
452
453
454
455
456
459
460
461
462
465
466
467
468
471
472
473
474
475
476
479
480
481
482
483
484
487
488
489
490
491
492
493
496
497
498
499
500
501
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
523
524
525
526
527
528
529
530
531
532
533
534
535
536
539
540
541
542
543
546
547
548
549
550
551
554
555
556
557
562
563
564
565
566
567
568
569
570
571
572
573
574
575
578
579
580
581
584
585
586
587
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
617
618
619
620
621
622
625
626
627
628
629
630
631
634
635
636
637
638
639
642
643
644
645
648
649
650
651
652
653
654
657
658
659
660
661
664
665
666
667
670
671
672
673
674
675
676
677
678
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
706
707
708
709
710
711
714
715
716
717
718
719
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
747
748
749
750
751
752
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
791
792
793
794
795
796
797
798
801
802
803
804
805
806
807
808
809
810
811
812
815
816
817
818
819
820
821
822
823
824
825
826
827
828
831
832
833
834
835
836
837
838
839
840
841
842
843
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
871
872
873
874
877
878
879
880
881
882
883
886
887
888
889
890
891
892
895
896
897
898
901
902
903
904
905
906
907
910
911
912
913
914
915
916
919
920
921
922
923
924
925
926
929
930
931
932
935
936
937
938
939
940
941
944
945
946
947
948
949
950
953
954
955
956
957
958
959
960
963
964
965
966
967
968
969
970
982 Q_ASSERT(qobject_cast<
const QQStyleKitControlProperties *>(
this));
984 return static_cast<QQStyleKitControlProperties *>(self);
986 Q_ASSERT(qobject_cast<
const QQStyleKitControlProperties *>(parent()));
987 return static_cast<QQStyleKitControlProperties *>(parent());
993 T *nestedGroup = QQSK::lazyCreate(ptr, controlProperties(), group);
996 nestedGroup->m_pathFlags = m_pathFlags;
998 if (group == QQSK::PropertyGroup::DelegateSubtype1) {
1000
1001
1002
1003
1004 nestedGroup->m_pathFlags.setFlag(QQSK::PropertyPathFlag::DelegateSubtype1);
1005 nestedGroup->m_groupSpace = m_groupSpace;
1006 }
else if (group == QQSK::PropertyGroup::DelegateSubtype2) {
1007 nestedGroup->m_pathFlags.setFlag(QQSK::PropertyPathFlag::DelegateSubtype2);
1008 nestedGroup->m_groupSpace = m_groupSpace;
1011
1012
1013 const PropertyPathId nestedGroupIndex = PropertyPathId(group);
1014 const PropertyPathId nestedGroupSize = m_groupSpace.size / nestedGroupCount;
1015 nestedGroup->m_groupSpace.size = nestedGroupSize;
1016 nestedGroup->m_groupSpace.start = m_groupSpace.start + (nestedGroupIndex * nestedGroupSize);
1018
1019
1020
1021
1022
1023 Q_ASSERT(nestedGroupSize >= PropertyPathId(QQSK::Property::COUNT));
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039#define CONDITIONALLY_EMIT_SIGNALS_GLOBALLY_FOR(CONTROL_PROPERTIES, GROUP_PATH) if
1040 (this == CONTROL_PROPERTIES -> GROUP_PATH ) {
1041 for (QQStyleKitReader *reader : QQStyleKitReader::s_allReaders) {
1042 const auto baseTypes = QQStyleKitPropertyResolver::baseTypesForType(reader->controlType());
1043 if (reader->controlType() != controlType && !baseTypes.contains(controlType))
1045 reader->clearLocalStorage();
1046 ((reader-> GROUP_PATH ->*changedSignals)(), ...);
1049}
1051template<
typename SUBCLASS>
1053 handleStylePropertiesChanged<SUBCLASS>(changedSignal);
1056template <
typename SUBCLASS,
typename... CHANGED_SIGNALS>
1060
1061
1062
1063
1064
1065
1066
1067 static_assert(std::is_base_of<QQStyleKitPropertyGroup, SUBCLASS>::value,
1068 "SUBCLASS must inherit QQStyleKitPropertyGroup");
1070 auto *group =
static_cast<SUBCLASS *>(
this);
1073 if (objectWrittenTo == QQSK::Subclass::QQStyleKitState) {
1074 ((group->*changedSignals)(), ...);
1076 if (shouldEmitGlobally()) {
1078 const QQStyleKitExtendableControlType type = control->controlType();
1079 group->emitGlobally(type, changedSignals...);
1084 if (objectWrittenTo == QQSK::Subclass::QQStyleKitReader) {
1086
1087
1088
1089 if (shouldEmitLocally()) {
1092
1093
1094
1095
1096 if (!reader->m_target)
1097 ((group->*changedSignals)(), ...);
1099 QCoreApplication::postEvent(reader->m_target,
new QEvent(QEvent::StyleAnimationUpdate));
1110
1111
1112 const QMetaObject *meta = metaObject();
1113 if (meta->inherits(&QQStyleKitControlProperties::staticMetaObject)) {
1115
1116
1117 meta = &QQStyleKitControlProperties::staticMetaObject;
1120 const int startIndex = QQStyleKitPropertyGroup::staticMetaObject.propertyOffset();
1121 for (
int i = startIndex; i < meta->propertyCount(); ++i) {
1122 const QMetaProperty prop = meta->property(i);
1123 const QMetaObject* propMetaObject = QMetaType::fromName(prop.typeName()).metaObject();
1124 if (propMetaObject && propMetaObject->inherits(&QQStyleKitPropertyGroup::staticMetaObject)) {
1126
1130 if (!emitFlags.testFlag(EmitFlag::AllProperties)) {
1132 if (emitFlags.testFlag(EmitFlag::Colors)) {
1133 if (prop.metaType() != QMetaType::fromType<QColor>())
1139
1140
1141
1142 Q_ASSERT(prop.hasNotifySignal());
1143 QMetaMethod notify = prop.notifySignal();
1144 notify.invoke(
this, Qt::DirectConnection);
1148
1149
1150 forEachExistingNestedGroup([emitFlags](QQStyleKitPropertyGroup *group) {
1151 group->emitChangedForAllStylePropertiesRecursive(emitFlags);
1156 const std::function<
void (QQStyleKitPropertyGroup *)> &f)
const
1159
1160
1161
1162
1163
1168
1169 const QMetaObject *meta = metaObject();
1170 const int startIndex = QQStyleKitPropertyGroup::staticMetaObject.propertyOffset();
1171 for (
int i = startIndex; i < meta->propertyCount(); ++i) {
1172 const QMetaProperty prop = meta->property(i);
1173 const QMetaObject *propMetaObject = QMetaType::fromName(prop.typeName()).metaObject();
1174 Q_ASSERT_X(!propMetaObject || !propMetaObject->inherits(&QQStyleKitPropertyGroup::staticMetaObject),
1175 meta->className(),
"Classes with nested property groups must override forEachExistingNestedGroup()");
1191 if (parentStyle->loaded() && !parentStyle->m_isUpdatingPalette) {
1193
1194
1195
1196
1197
1198
1199 return parentStyle == QQStyleKitStyle::current();
1206QQStyleKitImageProperties::QQStyleKitImageProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1207 : QQStyleKitPropertyGroup(group, parent)
1211template <
typename... CHANGED_SIGNALS>
1212void QQStyleKitImageProperties::emitGlobally(
1213 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1216 const QQStyleKitControlProperties *cp = controlProperties();
1223QUrl QQStyleKitImageProperties::source()
const
1225 return styleProperty<QUrl>(QQSK::Property::Source);
1228void QQStyleKitImageProperties::setSource(
const QUrl &source)
1230 if (setStyleProperty(QQSK::Property::Source, source))
1231 handleStylePropertyChanged(&QQStyleKitImageProperties::sourceChanged);
1234QColor QQStyleKitImageProperties::color()
const
1236 return styleProperty<QColor>(QQSK::Property::Color);
1239void QQStyleKitImageProperties::setColor(
const QColor &color)
1241 if (setStyleProperty(QQSK::Property::Color, color))
1242 handleStylePropertyChanged(&QQStyleKitImageProperties::colorChanged);
1245QQuickImage::FillMode QQStyleKitImageProperties::fillMode()
const
1247 return styleProperty<QQuickImage::FillMode>(QQSK::Property::FillMode);
1250void QQStyleKitImageProperties::setFillMode(QQuickImage::FillMode fillMode)
1252 if (setStyleProperty(QQSK::Property::FillMode, fillMode))
1253 handleStylePropertyChanged(&QQStyleKitImageProperties::fillModeChanged);
1258QQStyleKitBorderProperties::QQStyleKitBorderProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1259 : QQStyleKitPropertyGroup(group, parent)
1263template <
typename... CHANGED_SIGNALS>
1264void QQStyleKitBorderProperties::emitGlobally(
1265 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1268 const QQStyleKitControlProperties *cp = controlProperties();
1275qreal QQStyleKitBorderProperties::width()
const
1277 return styleProperty<qreal>(QQSK::Property::Width);
1280void QQStyleKitBorderProperties::setWidth(qreal width)
1282 if (setStyleProperty(QQSK::Property::Width, width))
1283 handleStylePropertyChanged(&QQStyleKitBorderProperties::widthChanged);
1286QColor QQStyleKitBorderProperties::color()
const
1288 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1291void QQStyleKitBorderProperties::setColor(
const QColor &color)
1293 if (setStyleProperty(QQSK::Property::Color, color))
1294 handleStylePropertyChanged(&QQStyleKitBorderProperties::colorChanged);
1299QQStyleKitShadowProperties::QQStyleKitShadowProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1300 : QQStyleKitPropertyGroup(group, parent)
1304template <
typename... CHANGED_SIGNALS>
1305void QQStyleKitShadowProperties::emitGlobally(
1306 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1309 const QQStyleKitControlProperties *cp = controlProperties();
1316QColor QQStyleKitShadowProperties::color()
const
1318 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1321void QQStyleKitShadowProperties::setColor(QColor color)
1323 if (setStyleProperty(QQSK::Property::Color, color))
1324 handleStylePropertyChanged(&QQStyleKitShadowProperties::colorChanged);
1327qreal QQStyleKitShadowProperties::opacity()
const
1329 return styleProperty<qreal>(QQSK::Property::Opacity, 1.0);
1332void QQStyleKitShadowProperties::setOpacity(qreal opacity)
1334 if (setStyleProperty(QQSK::Property::Opacity, opacity))
1335 handleStylePropertyChanged(&QQStyleKitShadowProperties::opacityChanged);
1338qreal QQStyleKitShadowProperties::scale()
const
1340 return styleProperty<qreal>(QQSK::Property::Scale, 1.0);
1343void QQStyleKitShadowProperties::setScale(qreal scale)
1345 if (setStyleProperty(QQSK::Property::Scale, scale))
1346 handleStylePropertyChanged(&QQStyleKitShadowProperties::scaleChanged);
1349qreal QQStyleKitShadowProperties::verticalOffset()
const
1351 return styleProperty<qreal>(QQSK::Property::VOffset);
1354void QQStyleKitShadowProperties::setVerticalOffset(qreal verticalOffset)
1356 if (setStyleProperty(QQSK::Property::VOffset, verticalOffset))
1357 handleStylePropertyChanged(&QQStyleKitShadowProperties::verticalOffsetChanged);
1360qreal QQStyleKitShadowProperties::horizontalOffset()
const
1362 return styleProperty<qreal>(QQSK::Property::HOffset);
1365void QQStyleKitShadowProperties::setHorizontalOffset(qreal horizontalOffset)
1367 if (setStyleProperty(QQSK::Property::HOffset, horizontalOffset))
1368 handleStylePropertyChanged(&QQStyleKitShadowProperties::horizontalOffsetChanged);
1371qreal QQStyleKitShadowProperties::blur()
const
1373 return styleProperty<qreal>(QQSK::Property::Blur, 10.0);
1376void QQStyleKitShadowProperties::setBlur(qreal blur)
1378 if (setStyleProperty(QQSK::Property::Blur, blur))
1379 handleStylePropertyChanged(&QQStyleKitShadowProperties::blurChanged);
1382bool QQStyleKitShadowProperties::visible()
const
1384 return styleProperty<
bool>(QQSK::Property::Visible,
true);
1387void QQStyleKitShadowProperties::setVisible(
bool visible)
1389 if (setStyleProperty(QQSK::Property::Visible, visible))
1390 handleStylePropertyChanged(&QQStyleKitShadowProperties::visibleChanged);
1393QQmlComponent *QQStyleKitShadowProperties::delegate()
const
1395 return styleProperty<QQmlComponent *>(QQSK::Property::Delegate);
1398void QQStyleKitShadowProperties::setDelegate(QQmlComponent *delegate)
1400 if (setStyleProperty(QQSK::Property::Delegate, delegate))
1401 handleStylePropertyChanged(&QQStyleKitShadowProperties::delegateChanged);
1406QQStyleKitDelegateProperties::QQStyleKitDelegateProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1407 : QQStyleKitPropertyGroup(group, parent)
1411template <
typename... CHANGED_SIGNALS>
1412void QQStyleKitDelegateProperties::emitGlobally(
1413 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1416 const QQStyleKitControlProperties *cp = controlProperties();
1423void QQStyleKitDelegateProperties::forEachExistingNestedGroup(
1424 const std::function<
void (QQStyleKitPropertyGroup *)> &f)
const
1435qreal QQStyleKitDelegateProperties::radius()
const
1437 return styleProperty<qreal>(QQSK::Property::Radius);
1440void QQStyleKitDelegateProperties::setRadius(qreal radius)
1442 if (setStyleProperty(QQSK::Property::Radius, radius))
1443 handleStylePropertiesChanged<QQStyleKitDelegateProperties>(
1444 &QQStyleKitDelegateProperties::radiusChanged,
1445 &QQStyleKitDelegateProperties::topLeftRadiusChanged,
1446 &QQStyleKitDelegateProperties::topRightRadiusChanged,
1447 &QQStyleKitDelegateProperties::bottomLeftRadiusChanged,
1448 &QQStyleKitDelegateProperties::bottomRightRadiusChanged);
1451qreal QQStyleKitDelegateProperties::topLeftRadius()
const
1453 return styleProperty<qreal>(QQSK::Property::TopLeftRadius, QQSK::Property::Radius);
1456void QQStyleKitDelegateProperties::setTopLeftRadius(qreal radius)
1458 if (setStyleProperty(QQSK::Property::TopLeftRadius, radius))
1459 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topLeftRadiusChanged);
1462qreal QQStyleKitDelegateProperties::topRightRadius()
const
1464 return styleProperty<qreal>(QQSK::Property::TopRightRadius, QQSK::Property::Radius);
1467void QQStyleKitDelegateProperties::setTopRightRadius(qreal radius)
1469 if (setStyleProperty(QQSK::Property::TopRightRadius, radius))
1470 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topRightRadiusChanged);
1473qreal QQStyleKitDelegateProperties::bottomLeftRadius()
const
1475 return styleProperty<qreal>(QQSK::Property::BottomLeftRadius, QQSK::Property::Radius);
1478void QQStyleKitDelegateProperties::setBottomLeftRadius(qreal radius)
1480 if (setStyleProperty(QQSK::Property::BottomLeftRadius, radius))
1481 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomLeftRadiusChanged);
1484qreal QQStyleKitDelegateProperties::bottomRightRadius()
const
1486 return styleProperty<qreal>(QQSK::Property::BottomRightRadius, QQSK::Property::Radius);
1489void QQStyleKitDelegateProperties::setBottomRightRadius(qreal radius)
1491 if (setStyleProperty(QQSK::Property::BottomRightRadius, radius))
1492 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomRightRadiusChanged);
1495qreal QQStyleKitDelegateProperties::scale()
const
1497 return styleProperty<qreal>(QQSK::Property::Scale, 1.0);
1500void QQStyleKitDelegateProperties::setScale(qreal scale)
1502 if (setStyleProperty(QQSK::Property::Scale, scale))
1503 handleStylePropertyChanged(&QQStyleKitDelegateProperties::scaleChanged);
1506qreal QQStyleKitDelegateProperties::rotation()
const
1508 return styleProperty<qreal>(QQSK::Property::Rotation);
1511void QQStyleKitDelegateProperties::setRotation(qreal rotation)
1513 if (setStyleProperty(QQSK::Property::Rotation, rotation))
1514 handleStylePropertyChanged(&QQStyleKitDelegateProperties::rotationChanged);
1517qreal QQStyleKitDelegateProperties::width()
const
1519 return styleProperty<qreal>(QQSK::Property::Width);
1522void QQStyleKitDelegateProperties::setWidth(qreal width)
1524 if (setStyleProperty(QQSK::Property::Width, width))
1525 handleStylePropertyChanged(&QQStyleKitDelegateProperties::widthChanged);
1528qreal QQStyleKitDelegateProperties::height()
const
1530 return styleProperty<qreal>(QQSK::Property::Height);
1533void QQStyleKitDelegateProperties::setHeight(qreal height)
1535 if (setStyleProperty(QQSK::Property::Height, height))
1536 handleStylePropertyChanged(&QQStyleKitDelegateProperties::heightChanged);
1539qreal QQStyleKitDelegateProperties::minimumWidth()
const
1541 return styleProperty<qreal>(QQSK::Property::MinimumWidth);
1544void QQStyleKitDelegateProperties::setMinimumWidth(qreal width)
1546 if (setStyleProperty(QQSK::Property::MinimumWidth, width))
1547 handleStylePropertyChanged(&QQStyleKitDelegateProperties::minimumWidthChanged);
1550qreal QQStyleKitDelegateProperties::minimumHeight()
const
1552 return styleProperty<qreal>(QQSK::Property::MinimumHeight);
1555void QQStyleKitDelegateProperties::setMinimumHeight(qreal height)
1557 if (setStyleProperty(QQSK::Property::MinimumHeight, height))
1558 handleStylePropertyChanged(&QQStyleKitDelegateProperties::minimumHeightChanged);
1561bool QQStyleKitDelegateProperties::fillWidth()
const
1563 return styleProperty<
bool>(QQSK::Property::FillWidth);
1566void QQStyleKitDelegateProperties::setFillWidth(
bool fill)
1568 if (setStyleProperty(QQSK::Property::FillWidth, fill))
1569 handleStylePropertyChanged(&QQStyleKitDelegateProperties::fillWidthChanged);
1572bool QQStyleKitDelegateProperties::fillHeight()
const
1574 return styleProperty<
bool>(QQSK::Property::FillHeight);
1577void QQStyleKitDelegateProperties::setFillHeight(
bool fill)
1579 if (setStyleProperty(QQSK::Property::FillHeight, fill))
1580 handleStylePropertyChanged(&QQStyleKitDelegateProperties::fillHeightChanged);
1583qreal QQStyleKitDelegateProperties::margins()
const
1585 return styleProperty<qreal>(QQSK::Property::Margins);
1588void QQStyleKitDelegateProperties::setMargins(qreal margins)
1590 if (setStyleProperty(QQSK::Property::Margins, margins))
1591 handleStylePropertiesChanged<QQStyleKitDelegateProperties>(
1592 &QQStyleKitDelegateProperties::marginsChanged,
1593 &QQStyleKitDelegateProperties::leftMarginChanged,
1594 &QQStyleKitDelegateProperties::rightMarginChanged,
1595 &QQStyleKitDelegateProperties::topMarginChanged,
1596 &QQStyleKitDelegateProperties::bottomMarginChanged);
1599qreal QQStyleKitDelegateProperties::leftMargin()
const
1601 return styleProperty<qreal>(QQSK::Property::LeftMargin, QQSK::Property::Margins);
1604void QQStyleKitDelegateProperties::setLeftMargin(qreal margin)
1606 if (setStyleProperty(QQSK::Property::LeftMargin, margin))
1607 handleStylePropertyChanged(&QQStyleKitDelegateProperties::leftMarginChanged);
1610qreal QQStyleKitDelegateProperties::rightMargin()
const
1612 return styleProperty<qreal>(QQSK::Property::RightMargin, QQSK::Property::Margins);
1615void QQStyleKitDelegateProperties::setRightMargin(qreal margin)
1617 if (setStyleProperty(QQSK::Property::RightMargin, margin))
1618 handleStylePropertyChanged(&QQStyleKitDelegateProperties::rightMarginChanged);
1621qreal QQStyleKitDelegateProperties::topMargin()
const
1623 return styleProperty<qreal>(QQSK::Property::TopMargin, QQSK::Property::Margins);
1626void QQStyleKitDelegateProperties::setTopMargin(qreal margin)
1628 if (setStyleProperty(QQSK::Property::TopMargin, margin))
1629 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topMarginChanged);
1632qreal QQStyleKitDelegateProperties::bottomMargin()
const
1634 return styleProperty<qreal>(QQSK::Property::BottomMargin, QQSK::Property::Margins);
1637void QQStyleKitDelegateProperties::setBottomMargin(qreal margin)
1639 if (setStyleProperty(QQSK::Property::BottomMargin, margin))
1640 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomMarginChanged);
1643Qt::Alignment QQStyleKitDelegateProperties::alignment()
const
1645 return styleProperty<Qt::Alignment>(QQSK::Property::Alignment, Qt::AlignLeft | Qt::AlignVCenter);
1648void QQStyleKitDelegateProperties::setAlignment(Qt::Alignment alignment)
1650 if (setStyleProperty(QQSK::Property::Alignment, alignment))
1651 handleStylePropertyChanged(&QQStyleKitDelegateProperties::alignmentChanged);
1654qreal QQStyleKitDelegateProperties::opacity()
const
1656 return styleProperty<qreal>(QQSK::Property::Opacity, 1.0);
1659void QQStyleKitDelegateProperties::setOpacity(qreal opacity)
1661 if (setStyleProperty(QQSK::Property::Opacity, opacity))
1662 handleStylePropertyChanged(&QQStyleKitDelegateProperties::opacityChanged);
1665QColor QQStyleKitDelegateProperties::color()
const
1667 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1670void QQStyleKitDelegateProperties::setColor(
const QColor &color)
1672 if (setStyleProperty(QQSK::Property::Color, color))
1673 handleStylePropertyChanged(&QQStyleKitDelegateProperties::colorChanged);
1676bool QQStyleKitDelegateProperties::visible()
const
1678 return styleProperty<
bool>(QQSK::Property::Visible,
true);
1681void QQStyleKitDelegateProperties::setVisible(
bool visible)
1683 if (setStyleProperty(QQSK::Property::Visible, visible))
1684 handleStylePropertyChanged(&QQStyleKitDelegateProperties::visibleChanged);
1687bool QQStyleKitDelegateProperties::clip()
const
1689 return styleProperty<
bool>(QQSK::Property::Clip,
false);
1692void QQStyleKitDelegateProperties::setClip(
bool clip)
1694 if (setStyleProperty(QQSK::Property::Clip, clip))
1695 handleStylePropertyChanged(&QQStyleKitDelegateProperties::clipChanged);
1698QQuickGradient *QQStyleKitDelegateProperties::gradient()
const
1700 return styleProperty<QQuickGradient *>(QQSK::Property::Gradient);
1703void QQStyleKitDelegateProperties::setGradient(QQuickGradient *gradient)
1705 if (setStyleProperty(QQSK::Property::Gradient, gradient))
1706 handleStylePropertyChanged(&QQStyleKitDelegateProperties::gradientChanged);
1709QObject *QQStyleKitDelegateProperties::data()
const
1711 return styleProperty<QObject *>(QQSK::Property::Data);
1714void QQStyleKitDelegateProperties::setData(QObject *data)
1716 if (setStyleProperty(QQSK::Property::Data, data))
1717 handleStylePropertyChanged(&QQStyleKitDelegateProperties::dataChanged);
1720QQmlComponent *QQStyleKitDelegateProperties::delegate()
const
1722 return styleProperty<QQmlComponent *>(QQSK::Property::Delegate);
1725void QQStyleKitDelegateProperties::setDelegate(QQmlComponent *delegate)
1727 if (setStyleProperty(QQSK::Property::Delegate, delegate))
1728 handleStylePropertyChanged(&QQStyleKitDelegateProperties::delegateChanged);
1731QQStyleKitBorderProperties *QQStyleKitDelegateProperties::border()
const
1733 return lazyCreateGroup(m_border, QQSK::PropertyGroup::Border);
1736QQStyleKitShadowProperties *QQStyleKitDelegateProperties::shadow()
const
1738 return lazyCreateGroup(m_shadow, QQSK::PropertyGroup::Shadow);
1741QQStyleKitImageProperties *QQStyleKitDelegateProperties::image()
const
1743 return lazyCreateGroup(m_image, QQSK::PropertyGroup::Image);
1749 : QQStyleKitDelegateProperties(group, parent)
1754 const std::function<
void (QQStyleKitPropertyGroup *)> &f)
const
1757 QQStyleKitDelegateProperties::forEachExistingNestedGroup(f);
1766 return lazyCreateGroup(m_first, QQSK::PropertyGroup::DelegateSubtype1);
1771 return lazyCreateGroup(m_second, QQSK::PropertyGroup::DelegateSubtype2);
1777 QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1778 : QQStyleKitDelegateProperties(group, parent)
1782template <
typename... CHANGED_SIGNALS>
1784 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1787 const QQStyleKitControlProperties *cp = controlProperties();
1793 const std::function<
void (QQStyleKitPropertyGroup *)> &f)
const
1796 QQStyleKitDelegateProperties::forEachExistingNestedGroup(f);
1803 return lazyCreateGroup(m_foreground, QQSK::PropertyGroup::Foreground);
1809 QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1810 : QQStyleKitDelegateProperties(group, parent)
1814template <
typename... CHANGED_SIGNALS>
1816 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1819 const QQStyleKitControlProperties *cp = controlProperties();
1824 const std::function<
void (QQStyleKitPropertyGroup *)> &f)
const
1827 QQStyleKitDelegateProperties::forEachExistingNestedGroup(f);
1838 return lazyCreateGroup(m_foreground, QQSK::PropertyGroup::Foreground);
1853 return lazyCreateGroup(m_first, QQSK::PropertyGroup::DelegateSubtype1);
1858 return lazyCreateGroup(m_second, QQSK::PropertyGroup::DelegateSubtype2);
1867template <
typename... CHANGED_SIGNALS>
1869 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1878 const std::function<
void (QQStyleKitPropertyGroup *)> &f)
const
1889 return styleProperty<QColor>(QQSK::Property::Color);
1894 if (setStyleProperty(QQSK::Property::Color, color))
1895 handleStylePropertyChanged(&QQStyleKitTextProperties::colorChanged);
1900 return styleProperty<Qt::Alignment>(QQSK::Property::Alignment);
1905 if (setStyleProperty(QQSK::Property::Alignment, alignment))
1906 handleStylePropertyChanged(&QQStyleKitTextProperties::alignmentChanged);
1911 return styleProperty<
bool>(QQSK::Property::Bold,
false);
1916 if (setStyleProperty(QQSK::Property::Bold, bold))
1922 return styleProperty<
bool>(QQSK::Property::Italic,
false);
1927 if (setStyleProperty(QQSK::Property::Italic, italic))
1933 return styleProperty<qreal>(QQSK::Property::PointSize, QFont().pointSize());
1938 if (setStyleProperty(QQSK::Property::PointSize, pointSize))
1944 return styleProperty<qreal>(QQSK::Property::Padding);
1949 if (setStyleProperty(QQSK::Property::Padding, padding))
1960 return styleProperty<qreal>(QQSK::Property::LeftPadding, QQSK::Property::Padding);
1965 if (setStyleProperty(QQSK::Property::LeftPadding, padding))
1971 return styleProperty<qreal>(QQSK::Property::RightPadding, QQSK::Property::Padding);
1976 if (setStyleProperty(QQSK::Property::RightPadding, padding))
1982 return styleProperty<qreal>(QQSK::Property::TopPadding, QQSK::Property::Padding);
1987 if (setStyleProperty(QQSK::Property::TopPadding, padding))
1993 return styleProperty<qreal>(QQSK::Property::BottomPadding, QQSK::Property::Padding);
1998 if (setStyleProperty(QQSK::Property::BottomPadding, padding))
2004 return lazyCreateGroup(m_first, QQSK::PropertyGroup::DelegateSubtype1);
2009 return lazyCreateGroup(m_second, QQSK::PropertyGroup::DelegateSubtype2);
2014QQStyleKitControlProperties::QQStyleKitControlProperties(QQSK::PropertyGroup group, QObject *parent)
2015 : QQStyleKitPropertyGroup(group, parent)
2018
2019
2020
2021
2022 m_groupSpace.size = nestedGroupsStartSize;
2023 m_groupSpace.start = 0;
2025 if (group == QQSK::PropertyGroup::GlobalFlag) {
2027
2028
2029
2030
2031
2032
2033 m_pathFlags.setFlag(QQSK::PropertyPathFlag::Global);
2037QQStyleKitStyle *QQStyleKitControlProperties::style()
const
2039 if (subclass() == QQSK::Subclass::QQStyleKitState) {
2041
2042
2043
2044
2045
2046
2047 QObject *obj = parent();
2048 while (obj && !obj->metaObject()->inherits(&QQStyleKitStyle::staticMetaObject))
2049 obj = obj->parent();
2050 return obj ?
static_cast<QQStyleKitStyle *>(obj) :
nullptr;
2053 if (subclass() == QQSK::Subclass::QQStyleKitReader) {
2054 const auto *reader =
static_cast<
const QQStyleKitReader *>(
this);
2055 if (reader->m_explicitStyle)
2056 return reader->m_explicitStyle;
2060 return QQStyleKitStyle::current();
2063QQSK::Subclass QQStyleKitControlProperties::subclass()
const
2066
2067
2068
2069
2070
2071 if (metaObject()->inherits(&QQStyleKitReader::staticMetaObject))
2072 return QQSK::Subclass::QQStyleKitReader;
2073 if (metaObject()->inherits(&QQStyleKitControlState::staticMetaObject))
2074 return QQSK::Subclass::QQStyleKitState;
2078QQStyleKitReader *QQStyleKitControlProperties::asQQStyleKitReader()
const
2080 Q_ASSERT(subclass() == QQSK::Subclass::QQStyleKitReader);
2081 return static_cast<QQStyleKitReader *>(
const_cast<QQStyleKitControlProperties *>(
this));
2084QQStyleKitControlState *QQStyleKitControlProperties::asQQStyleKitState()
const
2086 Q_ASSERT(subclass() == QQSK::Subclass::QQStyleKitState);
2087 Q_ASSERT(metaObject()->inherits(&QQStyleKitControlState::staticMetaObject));
2088 return static_cast<QQStyleKitControlState *>(
const_cast<QQStyleKitControlProperties *>(
this));
2091void QQStyleKitControlProperties::forEachUsedDelegate(
2092 std::function<
void (QQStyleKitDelegateProperties *, QQSK::Delegate,
const QString &)> f)
2096 f(m_background, QQSK::Delegate::Background,
"background"_L1);
2099 f(m_indicator, QQSK::Delegate::Indicator,
"indicator"_L1);
2100 if (m_indicator->m_foreground)
2101 f(m_indicator->m_foreground, QQSK::Delegate::IndicatorForeground,
"indicator.foreground"_L1);
2102 if (m_indicator->m_first) {
2103 f(m_indicator->m_first, QQSK::Delegate::IndicatorFirst,
"indicator.first"_L1);
2104 if (m_indicator->m_first->m_foreground)
2105 f(m_indicator->m_first->m_foreground, QQSK::Delegate::IndicatorFirstForeground,
"indicator.first.foreground"_L1);
2107 if (m_indicator->m_second) {
2108 f(m_indicator->m_second, QQSK::Delegate::IndicatorSecond,
"indicator.second"_L1);
2109 if (m_indicator->m_second->m_foreground)
2110 f(m_indicator->m_second->m_foreground, QQSK::Delegate::IndicatorSecondForeground,
"indicator.second.foreground"_L1);
2115 f(m_handle, QQSK::Delegate::Handle,
"handle"_L1);
2116 if (m_handle->m_first)
2117 f(m_handle->m_first, QQSK::Delegate::HandleFirst,
"handle.first"_L1);
2118 if (m_handle->m_second)
2119 f(m_handle->m_second, QQSK::Delegate::HandleSecond,
"handle.second"_L1);
2123void QQStyleKitControlProperties::emitChangedForAllStyleProperties(EmitFlags emitFlags)
2126
2127
2128 emitChangedForAllStylePropertiesRecursive(emitFlags);
2131template <
typename... CHANGED_SIGNALS>
2132void QQStyleKitControlProperties::emitGlobally(
2133 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
2135 for (QQStyleKitReader *reader : QQStyleKitReader::s_allReaders) {
2136 if (reader->controlType() != controlType)
2138 ((reader->*changedSignals)(), ...);
2142void QQStyleKitControlProperties::forEachExistingNestedGroup(
2143 const std::function<
void (QQStyleKitPropertyGroup *)> &f)
const
2156qreal QQStyleKitControlProperties::spacing()
const
2158 return styleProperty<qreal>(QQSK::Property::Spacing);
2161void QQStyleKitControlProperties::setSpacing(qreal spacing)
2163 if (setStyleProperty(QQSK::Property::Spacing, spacing))
2164 handleStylePropertyChanged(&QQStyleKitControlProperties::spacingChanged);
2167qreal QQStyleKitControlProperties::padding()
const
2169 return styleProperty<qreal>(QQSK::Property::Padding);
2172void QQStyleKitControlProperties::setPadding(qreal padding)
2174 if (setStyleProperty(QQSK::Property::Padding, padding))
2175 handleStylePropertiesChanged<QQStyleKitControlProperties>(
2176 &QQStyleKitControlProperties::paddingChanged,
2177 &QQStyleKitControlProperties::leftPaddingChanged,
2178 &QQStyleKitControlProperties::rightPaddingChanged,
2179 &QQStyleKitControlProperties::topPaddingChanged,
2180 &QQStyleKitControlProperties::bottomPaddingChanged);
2183qreal QQStyleKitControlProperties::leftPadding()
const
2185 return styleProperty<qreal>(QQSK::Property::LeftPadding, QQSK::Property::Padding);
2188void QQStyleKitControlProperties::setLeftPadding(qreal leftPadding)
2190 if (setStyleProperty(QQSK::Property::LeftPadding, leftPadding))
2191 handleStylePropertyChanged(&QQStyleKitControlProperties::leftPaddingChanged);
2194qreal QQStyleKitControlProperties::rightPadding()
const
2196 return styleProperty<qreal>(QQSK::Property::RightPadding, QQSK::Property::Padding);
2199void QQStyleKitControlProperties::setRightPadding(qreal rightPadding)
2201 if (setStyleProperty(QQSK::Property::RightPadding, rightPadding))
2202 handleStylePropertyChanged(&QQStyleKitControlProperties::rightPaddingChanged);
2205qreal QQStyleKitControlProperties::topPadding()
const
2207 return styleProperty<qreal>(QQSK::Property::TopPadding, QQSK::Property::Padding);
2210void QQStyleKitControlProperties::setTopPadding(qreal topPadding)
2212 if (setStyleProperty(QQSK::Property::TopPadding, topPadding))
2213 handleStylePropertyChanged(&QQStyleKitControlProperties::topPaddingChanged);
2216qreal QQStyleKitControlProperties::bottomPadding()
const
2218 return styleProperty<qreal>(QQSK::Property::BottomPadding, QQSK::Property::Padding);
2221void QQStyleKitControlProperties::setBottomPadding(qreal bottomPadding)
2223 if (setStyleProperty(QQSK::Property::BottomPadding, bottomPadding))
2224 handleStylePropertyChanged(&QQStyleKitControlProperties::bottomPaddingChanged);
2227QQuickTransition *QQStyleKitControlProperties::transition()
const
2229 return styleProperty<QQuickTransition *>(QQSK::Property::Transition);
2232void QQStyleKitControlProperties::setTransition(QQuickTransition *transition)
2234 if (setStyleProperty(QQSK::Property::Transition, transition))
2235 handleStylePropertyChanged(&QQStyleKitControlProperties::transitionChanged);
2238QQStyleKitTextProperties *QQStyleKitControlProperties::text()
const
2240 return lazyCreateGroup(m_text, QQSK::PropertyGroup::Text);
2243QQStyleKitDelegateProperties *QQStyleKitControlProperties::background()
const
2245 return lazyCreateGroup(m_background, QQSK::PropertyGroup::Background);
2248QQStyleKitHandleProperties *QQStyleKitControlProperties::handle()
const
2250 return lazyCreateGroup(m_handle, QQSK::PropertyGroup::Handle);
2253QQStyleKitIndicatorWithSubTypes *QQStyleKitControlProperties::indicator()
const
2255 return lazyCreateGroup(m_indicator, QQSK::PropertyGroup::Indicator);
2260#include "moc_qqstylekitcontrolproperties_p.cpp"
QQStyleKitDelegateProperties * first() const
void forEachExistingNestedGroup(const std::function< void(QQStyleKitPropertyGroup *)> &f) const override
QQStyleKitDelegateProperties * second() const
QQStyleKitDelegateProperties * foreground() const
void emitGlobally(QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals) const
void forEachExistingNestedGroup(const std::function< void(QQStyleKitPropertyGroup *)> &f) const override
void emitGlobally(QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals) const
void forEachExistingNestedGroup(const std::function< void(QQStyleKitPropertyGroup *)> &f) const override
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)())
virtual void forEachExistingNestedGroup(const std::function< void(QQStyleKitPropertyGroup *)> &f) const
void handleStylePropertiesChanged(CHANGED_SIGNALS... changedSignals)
QQStyleKitControlProperties * controlProperties() 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)
void forEachExistingNestedGroup(const std::function< void(QQStyleKitPropertyGroup *)> &f) const override
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)