14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
52
53
54
55
56
57
58
61
62
63
64
65
66
67
68
69
70
71
74
75
76
77
78
79
80
81
82
83
86
87
88
89
90
91
92
95
96
97
98
99
100
101
102
103
104
107
108
109
110
111
112
113
116
117
118
119
120
123
124
125
126
129
130
131
132
133
134
135
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
186
187
188
189
190
193
194
195
196
199
200
201
202
203
204
207
208
209
210
211
212
213
216
217
218
219
220
221
224
225
226
227
230
231
232
233
234
235
236
237
238
239
240
241
242
243
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
306
307
308
309
310
311
312
313
314
315
316
317
318
319
322
323
324
325
326
327
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
364
365
366
367
368
369
370
373
374
375
376
377
378
379
380
383
384
385
386
387
390
391
392
393
394
397
398
399
400
401
402
403
404
405
406
407
408
409
410
413
414
415
416
417
418
419
420
421
422
423
424
425
426
429
430
431
432
433
434
435
438
439
440
441
442
443
444
445
448
449
450
451
452
453
454
457
458
459
460
463
464
465
466
469
470
471
472
473
474
477
478
479
480
481
482
485
486
487
488
489
490
491
494
495
496
497
498
499
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
521
522
523
524
525
526
527
528
529
530
531
532
533
536
537
538
539
540
543
544
545
546
547
548
551
552
553
554
559
560
561
562
563
564
565
566
567
568
569
570
571
574
575
576
577
580
581
582
583
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
612
613
614
615
616
617
620
621
622
623
624
625
626
629
630
631
632
633
634
637
638
639
640
643
644
645
646
647
648
649
652
653
654
655
656
659
660
661
662
665
666
667
668
669
670
671
672
673
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
700
701
702
703
704
705
708
709
710
711
712
713
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
740
741
742
743
744
745
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
793
794
795
796
797
798
799
800
801
802
803
804
807
808
809
810
811
812
813
814
815
816
817
818
819
820
823
824
825
826
827
828
829
830
831
832
833
834
835
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
862
863
864
865
868
869
870
871
872
873
874
877
878
879
880
881
882
883
886
887
888
889
892
893
894
895
896
897
898
901
902
903
904
905
906
907
910
911
912
913
914
915
916
917
920
921
922
923
926
927
928
929
930
931
932
935
936
937
938
939
940
941
944
945
946
947
948
949
950
951
954
955
956
957
958
959
960
961
973 Q_ASSERT(qobject_cast<
const QQStyleKitControlProperties *>(
this));
975 return static_cast<QQStyleKitControlProperties *>(self);
977 Q_ASSERT(qobject_cast<
const QQStyleKitControlProperties *>(parent()));
978 return static_cast<QQStyleKitControlProperties *>(parent());
984 T *nestedGroup = QQSK::lazyCreate(ptr, controlProperties(), group);
987 nestedGroup->m_pathFlags = m_pathFlags;
989 if (group == QQSK::PropertyGroup::DelegateSubtype1) {
991
992
993
994
995 nestedGroup->m_pathFlags.setFlag(QQSK::PropertyPathFlag::DelegateSubtype1);
996 nestedGroup->m_groupSpace = m_groupSpace;
997 }
else if (group == QQSK::PropertyGroup::DelegateSubtype2) {
998 nestedGroup->m_pathFlags.setFlag(QQSK::PropertyPathFlag::DelegateSubtype2);
999 nestedGroup->m_groupSpace = m_groupSpace;
1002
1003
1004 const PropertyPathId nestedGroupIndex = PropertyPathId(group);
1005 const PropertyPathId nestedGroupSize = m_groupSpace.size / nestedGroupCount;
1006 nestedGroup->m_groupSpace.size = nestedGroupSize;
1007 nestedGroup->m_groupSpace.start = m_groupSpace.start + (nestedGroupIndex * nestedGroupSize);
1009
1010
1011
1012
1013
1014 Q_ASSERT(nestedGroupSize >= PropertyPathId(QQSK::Property::COUNT));
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030#define CONDITIONALLY_EMIT_SIGNALS_GLOBALLY_FOR(CONTROL_PROPERTIES, GROUP_PATH) if
1031 (this == CONTROL_PROPERTIES -> GROUP_PATH ) {
1032 for (QQStyleKitReader *reader : QQStyleKitReader::s_allReaders) {
1033 const auto baseTypes = QQStyleKitPropertyResolver::baseTypesForType(reader->controlType());
1034 if (reader->controlType() != controlType && !baseTypes.contains(controlType))
1036 reader->clearLocalStorage();
1037 ((reader-> GROUP_PATH ->*changedSignals)(), ...);
1040}
1042template<
typename SUBCLASS>
1044 handleStylePropertiesChanged<SUBCLASS>(changedSignal);
1047template <
typename SUBCLASS,
typename... CHANGED_SIGNALS>
1051
1052
1053
1054
1055
1056
1057
1058 static_assert(std::is_base_of<QQStyleKitPropertyGroup, SUBCLASS>::value,
1059 "SUBCLASS must inherit QQStyleKitPropertyGroup");
1061 auto *group =
static_cast<SUBCLASS *>(
this);
1064 if (objectWrittenTo == QQSK::Subclass::QQStyleKitState) {
1065 ((group->*changedSignals)(), ...);
1067 if (shouldEmitGlobally()) {
1069 const QQStyleKitExtendableControlType type = control->controlType();
1070 group->emitGlobally(type, changedSignals...);
1075 if (objectWrittenTo == QQSK::Subclass::QQStyleKitReader) {
1077
1078
1079
1080 if (shouldEmitLocally()) {
1083
1084
1085
1086
1087 if (!reader->m_target)
1088 ((group->*changedSignals)(), ...);
1090 QCoreApplication::postEvent(reader->m_target,
new QEvent(QEvent::StyleAnimationUpdate));
1101
1102
1103 const QMetaObject *meta = metaObject();
1104 if (meta->inherits(&QQStyleKitControlProperties::staticMetaObject)) {
1106
1107
1108 meta = &QQStyleKitControlProperties::staticMetaObject;
1111 const int startIndex = QQStyleKitPropertyGroup::staticMetaObject.propertyOffset();
1112 for (
int i = startIndex; i < meta->propertyCount(); ++i) {
1113 const QMetaProperty prop = meta->property(i);
1114 const QMetaObject* propMetaObject = QMetaType::fromName(prop.typeName()).metaObject();
1115 if (propMetaObject && propMetaObject->inherits(&QQStyleKitPropertyGroup::staticMetaObject)) {
1117
1121 if (!emitFlags.testFlag(EmitFlag::AllProperties)) {
1123 if (emitFlags.testFlag(EmitFlag::Colors)) {
1124 if (prop.metaType() != QMetaType::fromType<QColor>())
1130
1131
1132
1133 Q_ASSERT(prop.hasNotifySignal());
1134 QMetaMethod notify = prop.notifySignal();
1135 notify.invoke(
this, Qt::DirectConnection);
1139
1140
1141 forEachExistingNestedGroup([emitFlags](QQStyleKitPropertyGroup *group) {
1142 group->emitChangedForAllStylePropertiesRecursive(emitFlags);
1147 const std::function<
void (QQStyleKitPropertyGroup *)> &f)
const
1150
1151
1152
1153
1154
1159
1160 const QMetaObject *meta = metaObject();
1161 const int startIndex = QQStyleKitPropertyGroup::staticMetaObject.propertyOffset();
1162 for (
int i = startIndex; i < meta->propertyCount(); ++i) {
1163 const QMetaProperty prop = meta->property(i);
1164 const QMetaObject *propMetaObject = QMetaType::fromName(prop.typeName()).metaObject();
1165 Q_ASSERT_X(!propMetaObject || !propMetaObject->inherits(&QQStyleKitPropertyGroup::staticMetaObject),
1166 meta->className(),
"Classes with nested property groups must override forEachExistingNestedGroup()");
1182 if (parentStyle->loaded() && !parentStyle->m_isUpdatingPalette) {
1184
1185
1186
1187
1188
1189
1190 return parentStyle == QQStyleKitStyle::current();
1197QQStyleKitImageProperties::QQStyleKitImageProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1198 : QQStyleKitPropertyGroup(group, parent)
1202template <
typename... CHANGED_SIGNALS>
1203void QQStyleKitImageProperties::emitGlobally(
1204 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1207 const QQStyleKitControlProperties *cp = controlProperties();
1214QUrl QQStyleKitImageProperties::source()
const
1216 return styleProperty<QUrl>(QQSK::Property::Source);
1219void QQStyleKitImageProperties::setSource(
const QUrl &source)
1221 if (setStyleProperty(QQSK::Property::Source, source))
1222 handleStylePropertyChanged(&QQStyleKitImageProperties::sourceChanged);
1225QColor QQStyleKitImageProperties::color()
const
1227 return styleProperty<QColor>(QQSK::Property::Color);
1230void QQStyleKitImageProperties::setColor(
const QColor &color)
1232 if (setStyleProperty(QQSK::Property::Color, color))
1233 handleStylePropertyChanged(&QQStyleKitImageProperties::colorChanged);
1236QQuickImage::FillMode QQStyleKitImageProperties::fillMode()
const
1238 return styleProperty<QQuickImage::FillMode>(QQSK::Property::FillMode);
1241void QQStyleKitImageProperties::setFillMode(QQuickImage::FillMode fillMode)
1243 if (setStyleProperty(QQSK::Property::FillMode, fillMode))
1244 handleStylePropertyChanged(&QQStyleKitImageProperties::fillModeChanged);
1249QQStyleKitBorderProperties::QQStyleKitBorderProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1250 : QQStyleKitPropertyGroup(group, parent)
1254template <
typename... CHANGED_SIGNALS>
1255void QQStyleKitBorderProperties::emitGlobally(
1256 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1259 const QQStyleKitControlProperties *cp = controlProperties();
1266qreal QQStyleKitBorderProperties::width()
const
1268 return styleProperty<qreal>(QQSK::Property::Width);
1271void QQStyleKitBorderProperties::setWidth(qreal width)
1273 if (setStyleProperty(QQSK::Property::Width, width))
1274 handleStylePropertyChanged(&QQStyleKitBorderProperties::widthChanged);
1277QColor QQStyleKitBorderProperties::color()
const
1279 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1282void QQStyleKitBorderProperties::setColor(
const QColor &color)
1284 if (setStyleProperty(QQSK::Property::Color, color))
1285 handleStylePropertyChanged(&QQStyleKitBorderProperties::colorChanged);
1290QQStyleKitShadowProperties::QQStyleKitShadowProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1291 : QQStyleKitPropertyGroup(group, parent)
1295template <
typename... CHANGED_SIGNALS>
1296void QQStyleKitShadowProperties::emitGlobally(
1297 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1300 const QQStyleKitControlProperties *cp = controlProperties();
1307QColor QQStyleKitShadowProperties::color()
const
1309 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1312void QQStyleKitShadowProperties::setColor(QColor color)
1314 if (setStyleProperty(QQSK::Property::Color, color))
1315 handleStylePropertyChanged(&QQStyleKitShadowProperties::colorChanged);
1318qreal QQStyleKitShadowProperties::opacity()
const
1320 return styleProperty<qreal>(QQSK::Property::Opacity, 1.0);
1323void QQStyleKitShadowProperties::setOpacity(qreal opacity)
1325 if (setStyleProperty(QQSK::Property::Opacity, opacity))
1326 handleStylePropertyChanged(&QQStyleKitShadowProperties::opacityChanged);
1329qreal QQStyleKitShadowProperties::scale()
const
1331 return styleProperty<qreal>(QQSK::Property::Scale, 1.0);
1334void QQStyleKitShadowProperties::setScale(qreal scale)
1336 if (setStyleProperty(QQSK::Property::Scale, scale))
1337 handleStylePropertyChanged(&QQStyleKitShadowProperties::scaleChanged);
1340qreal QQStyleKitShadowProperties::verticalOffset()
const
1342 return styleProperty<qreal>(QQSK::Property::VOffset);
1345void QQStyleKitShadowProperties::setVerticalOffset(qreal verticalOffset)
1347 if (setStyleProperty(QQSK::Property::VOffset, verticalOffset))
1348 handleStylePropertyChanged(&QQStyleKitShadowProperties::verticalOffsetChanged);
1351qreal QQStyleKitShadowProperties::horizontalOffset()
const
1353 return styleProperty<qreal>(QQSK::Property::HOffset);
1356void QQStyleKitShadowProperties::setHorizontalOffset(qreal horizontalOffset)
1358 if (setStyleProperty(QQSK::Property::HOffset, horizontalOffset))
1359 handleStylePropertyChanged(&QQStyleKitShadowProperties::horizontalOffsetChanged);
1362qreal QQStyleKitShadowProperties::blur()
const
1364 return styleProperty<qreal>(QQSK::Property::Blur, 10.0);
1367void QQStyleKitShadowProperties::setBlur(qreal blur)
1369 if (setStyleProperty(QQSK::Property::Blur, blur))
1370 handleStylePropertyChanged(&QQStyleKitShadowProperties::blurChanged);
1373bool QQStyleKitShadowProperties::visible()
const
1375 return styleProperty<
bool>(QQSK::Property::Visible,
true);
1378void QQStyleKitShadowProperties::setVisible(
bool visible)
1380 if (setStyleProperty(QQSK::Property::Visible, visible))
1381 handleStylePropertyChanged(&QQStyleKitShadowProperties::visibleChanged);
1384QQmlComponent *QQStyleKitShadowProperties::delegate()
const
1386 return styleProperty<QQmlComponent *>(QQSK::Property::Delegate);
1389void QQStyleKitShadowProperties::setDelegate(QQmlComponent *delegate)
1391 if (setStyleProperty(QQSK::Property::Delegate, delegate))
1392 handleStylePropertyChanged(&QQStyleKitShadowProperties::delegateChanged);
1397QQStyleKitDelegateProperties::QQStyleKitDelegateProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1398 : QQStyleKitPropertyGroup(group, parent)
1402template <
typename... CHANGED_SIGNALS>
1403void QQStyleKitDelegateProperties::emitGlobally(
1404 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1407 const QQStyleKitControlProperties *cp = controlProperties();
1414void QQStyleKitDelegateProperties::forEachExistingNestedGroup(
1415 const std::function<
void (QQStyleKitPropertyGroup *)> &f)
const
1426qreal QQStyleKitDelegateProperties::radius()
const
1428 return styleProperty<qreal>(QQSK::Property::Radius);
1431void QQStyleKitDelegateProperties::setRadius(qreal radius)
1433 if (setStyleProperty(QQSK::Property::Radius, radius))
1434 handleStylePropertiesChanged<QQStyleKitDelegateProperties>(
1435 &QQStyleKitDelegateProperties::radiusChanged,
1436 &QQStyleKitDelegateProperties::topLeftRadiusChanged,
1437 &QQStyleKitDelegateProperties::topRightRadiusChanged,
1438 &QQStyleKitDelegateProperties::bottomLeftRadiusChanged,
1439 &QQStyleKitDelegateProperties::bottomRightRadiusChanged);
1442qreal QQStyleKitDelegateProperties::topLeftRadius()
const
1444 return styleProperty<qreal>(QQSK::Property::TopLeftRadius, QQSK::Property::Radius);
1447void QQStyleKitDelegateProperties::setTopLeftRadius(qreal radius)
1449 if (setStyleProperty(QQSK::Property::TopLeftRadius, radius))
1450 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topLeftRadiusChanged);
1453qreal QQStyleKitDelegateProperties::topRightRadius()
const
1455 return styleProperty<qreal>(QQSK::Property::TopRightRadius, QQSK::Property::Radius);
1458void QQStyleKitDelegateProperties::setTopRightRadius(qreal radius)
1460 if (setStyleProperty(QQSK::Property::TopRightRadius, radius))
1461 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topRightRadiusChanged);
1464qreal QQStyleKitDelegateProperties::bottomLeftRadius()
const
1466 return styleProperty<qreal>(QQSK::Property::BottomLeftRadius, QQSK::Property::Radius);
1469void QQStyleKitDelegateProperties::setBottomLeftRadius(qreal radius)
1471 if (setStyleProperty(QQSK::Property::BottomLeftRadius, radius))
1472 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomLeftRadiusChanged);
1475qreal QQStyleKitDelegateProperties::bottomRightRadius()
const
1477 return styleProperty<qreal>(QQSK::Property::BottomRightRadius, QQSK::Property::Radius);
1480void QQStyleKitDelegateProperties::setBottomRightRadius(qreal radius)
1482 if (setStyleProperty(QQSK::Property::BottomRightRadius, radius))
1483 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomRightRadiusChanged);
1486qreal QQStyleKitDelegateProperties::scale()
const
1488 return styleProperty<qreal>(QQSK::Property::Scale, 1.0);
1491void QQStyleKitDelegateProperties::setScale(qreal scale)
1493 if (setStyleProperty(QQSK::Property::Scale, scale))
1494 handleStylePropertyChanged(&QQStyleKitDelegateProperties::scaleChanged);
1497qreal QQStyleKitDelegateProperties::rotation()
const
1499 return styleProperty<qreal>(QQSK::Property::Rotation);
1502void QQStyleKitDelegateProperties::setRotation(qreal rotation)
1504 if (setStyleProperty(QQSK::Property::Rotation, rotation))
1505 handleStylePropertyChanged(&QQStyleKitDelegateProperties::rotationChanged);
1508qreal QQStyleKitDelegateProperties::width()
const
1510 return styleProperty<qreal>(QQSK::Property::Width);
1513void QQStyleKitDelegateProperties::setWidth(qreal width)
1515 if (setStyleProperty(QQSK::Property::Width, width))
1516 handleStylePropertyChanged(&QQStyleKitDelegateProperties::widthChanged);
1519qreal QQStyleKitDelegateProperties::height()
const
1521 return styleProperty<qreal>(QQSK::Property::Height);
1524void QQStyleKitDelegateProperties::setHeight(qreal height)
1526 if (setStyleProperty(QQSK::Property::Height, height))
1527 handleStylePropertyChanged(&QQStyleKitDelegateProperties::heightChanged);
1530qreal QQStyleKitDelegateProperties::minimumWidth()
const
1532 return styleProperty<qreal>(QQSK::Property::MinimumWidth);
1535void QQStyleKitDelegateProperties::setMinimumWidth(qreal width)
1537 if (setStyleProperty(QQSK::Property::MinimumWidth, width))
1538 handleStylePropertyChanged(&QQStyleKitDelegateProperties::minimumWidthChanged);
1541qreal QQStyleKitDelegateProperties::minimumHeight()
const
1543 return styleProperty<qreal>(QQSK::Property::MinimumHeight);
1546void QQStyleKitDelegateProperties::setMinimumHeight(qreal height)
1548 if (setStyleProperty(QQSK::Property::MinimumHeight, height))
1549 handleStylePropertyChanged(&QQStyleKitDelegateProperties::minimumHeightChanged);
1552bool QQStyleKitDelegateProperties::fillWidth()
const
1554 return styleProperty<
bool>(QQSK::Property::FillWidth);
1557void QQStyleKitDelegateProperties::setFillWidth(
bool fill)
1559 if (setStyleProperty(QQSK::Property::FillWidth, fill))
1560 handleStylePropertyChanged(&QQStyleKitDelegateProperties::fillWidthChanged);
1563bool QQStyleKitDelegateProperties::fillHeight()
const
1565 return styleProperty<
bool>(QQSK::Property::FillHeight);
1568void QQStyleKitDelegateProperties::setFillHeight(
bool fill)
1570 if (setStyleProperty(QQSK::Property::FillHeight, fill))
1571 handleStylePropertyChanged(&QQStyleKitDelegateProperties::fillHeightChanged);
1574qreal QQStyleKitDelegateProperties::margins()
const
1576 return styleProperty<qreal>(QQSK::Property::Margins);
1579void QQStyleKitDelegateProperties::setMargins(qreal margins)
1581 if (setStyleProperty(QQSK::Property::Margins, margins))
1582 handleStylePropertiesChanged<QQStyleKitDelegateProperties>(
1583 &QQStyleKitDelegateProperties::marginsChanged,
1584 &QQStyleKitDelegateProperties::leftMarginChanged,
1585 &QQStyleKitDelegateProperties::rightMarginChanged,
1586 &QQStyleKitDelegateProperties::topMarginChanged,
1587 &QQStyleKitDelegateProperties::bottomMarginChanged);
1590qreal QQStyleKitDelegateProperties::leftMargin()
const
1592 return styleProperty<qreal>(QQSK::Property::LeftMargin, QQSK::Property::Margins);
1595void QQStyleKitDelegateProperties::setLeftMargin(qreal margin)
1597 if (setStyleProperty(QQSK::Property::LeftMargin, margin))
1598 handleStylePropertyChanged(&QQStyleKitDelegateProperties::leftMarginChanged);
1601qreal QQStyleKitDelegateProperties::rightMargin()
const
1603 return styleProperty<qreal>(QQSK::Property::RightMargin, QQSK::Property::Margins);
1606void QQStyleKitDelegateProperties::setRightMargin(qreal margin)
1608 if (setStyleProperty(QQSK::Property::RightMargin, margin))
1609 handleStylePropertyChanged(&QQStyleKitDelegateProperties::rightMarginChanged);
1612qreal QQStyleKitDelegateProperties::topMargin()
const
1614 return styleProperty<qreal>(QQSK::Property::TopMargin, QQSK::Property::Margins);
1617void QQStyleKitDelegateProperties::setTopMargin(qreal margin)
1619 if (setStyleProperty(QQSK::Property::TopMargin, margin))
1620 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topMarginChanged);
1623qreal QQStyleKitDelegateProperties::bottomMargin()
const
1625 return styleProperty<qreal>(QQSK::Property::BottomMargin, QQSK::Property::Margins);
1628void QQStyleKitDelegateProperties::setBottomMargin(qreal margin)
1630 if (setStyleProperty(QQSK::Property::BottomMargin, margin))
1631 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomMarginChanged);
1634Qt::Alignment QQStyleKitDelegateProperties::alignment()
const
1636 return styleProperty<Qt::Alignment>(QQSK::Property::Alignment, Qt::AlignLeft | Qt::AlignVCenter);
1639void QQStyleKitDelegateProperties::setAlignment(Qt::Alignment alignment)
1641 if (setStyleProperty(QQSK::Property::Alignment, alignment))
1642 handleStylePropertyChanged(&QQStyleKitDelegateProperties::alignmentChanged);
1645qreal QQStyleKitDelegateProperties::opacity()
const
1647 return styleProperty<qreal>(QQSK::Property::Opacity, 1.0);
1650void QQStyleKitDelegateProperties::setOpacity(qreal opacity)
1652 if (setStyleProperty(QQSK::Property::Opacity, opacity))
1653 handleStylePropertyChanged(&QQStyleKitDelegateProperties::opacityChanged);
1656QColor QQStyleKitDelegateProperties::color()
const
1658 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1661void QQStyleKitDelegateProperties::setColor(
const QColor &color)
1663 if (setStyleProperty(QQSK::Property::Color, color))
1664 handleStylePropertyChanged(&QQStyleKitDelegateProperties::colorChanged);
1667bool QQStyleKitDelegateProperties::visible()
const
1669 return styleProperty<
bool>(QQSK::Property::Visible,
true);
1672void QQStyleKitDelegateProperties::setVisible(
bool visible)
1674 if (setStyleProperty(QQSK::Property::Visible, visible))
1675 handleStylePropertyChanged(&QQStyleKitDelegateProperties::visibleChanged);
1678bool QQStyleKitDelegateProperties::clip()
const
1680 return styleProperty<
bool>(QQSK::Property::Clip,
false);
1683void QQStyleKitDelegateProperties::setClip(
bool clip)
1685 if (setStyleProperty(QQSK::Property::Clip, clip))
1686 handleStylePropertyChanged(&QQStyleKitDelegateProperties::clipChanged);
1689QQuickGradient *QQStyleKitDelegateProperties::gradient()
const
1691 return styleProperty<QQuickGradient *>(QQSK::Property::Gradient);
1694void QQStyleKitDelegateProperties::setGradient(QQuickGradient *gradient)
1696 if (setStyleProperty(QQSK::Property::Gradient, gradient))
1697 handleStylePropertyChanged(&QQStyleKitDelegateProperties::gradientChanged);
1700QObject *QQStyleKitDelegateProperties::data()
const
1702 return styleProperty<QObject *>(QQSK::Property::Data);
1705void QQStyleKitDelegateProperties::setData(QObject *data)
1707 if (setStyleProperty(QQSK::Property::Data, data))
1708 handleStylePropertyChanged(&QQStyleKitDelegateProperties::dataChanged);
1711QQmlComponent *QQStyleKitDelegateProperties::delegate()
const
1713 return styleProperty<QQmlComponent *>(QQSK::Property::Delegate);
1716void QQStyleKitDelegateProperties::setDelegate(QQmlComponent *delegate)
1718 if (setStyleProperty(QQSK::Property::Delegate, delegate))
1719 handleStylePropertyChanged(&QQStyleKitDelegateProperties::delegateChanged);
1722QQStyleKitBorderProperties *QQStyleKitDelegateProperties::border()
const
1724 return lazyCreateGroup(m_border, QQSK::PropertyGroup::Border);
1727QQStyleKitShadowProperties *QQStyleKitDelegateProperties::shadow()
const
1729 return lazyCreateGroup(m_shadow, QQSK::PropertyGroup::Shadow);
1732QQStyleKitImageProperties *QQStyleKitDelegateProperties::image()
const
1734 return lazyCreateGroup(m_image, QQSK::PropertyGroup::Image);
1740 : QQStyleKitDelegateProperties(group, parent)
1745 const std::function<
void (QQStyleKitPropertyGroup *)> &f)
const
1748 QQStyleKitDelegateProperties::forEachExistingNestedGroup(f);
1757 return lazyCreateGroup(m_first, QQSK::PropertyGroup::DelegateSubtype1);
1762 return lazyCreateGroup(m_second, QQSK::PropertyGroup::DelegateSubtype2);
1768 QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1769 : QQStyleKitDelegateProperties(group, parent)
1773template <
typename... CHANGED_SIGNALS>
1775 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1778 const QQStyleKitControlProperties *cp = controlProperties();
1784 const std::function<
void (QQStyleKitPropertyGroup *)> &f)
const
1787 QQStyleKitDelegateProperties::forEachExistingNestedGroup(f);
1794 return lazyCreateGroup(m_foreground, QQSK::PropertyGroup::Foreground);
1800 QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1801 : QQStyleKitDelegateProperties(group, parent)
1805template <
typename... CHANGED_SIGNALS>
1807 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1810 const QQStyleKitControlProperties *cp = controlProperties();
1815 const std::function<
void (QQStyleKitPropertyGroup *)> &f)
const
1818 QQStyleKitDelegateProperties::forEachExistingNestedGroup(f);
1829 return lazyCreateGroup(m_foreground, QQSK::PropertyGroup::Foreground);
1844 return lazyCreateGroup(m_first, QQSK::PropertyGroup::DelegateSubtype1);
1849 return lazyCreateGroup(m_second, QQSK::PropertyGroup::DelegateSubtype2);
1858template <
typename... CHANGED_SIGNALS>
1860 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1869 const std::function<
void (QQStyleKitPropertyGroup *)> &f)
const
1880 return styleProperty<QColor>(QQSK::Property::Color);
1885 if (setStyleProperty(QQSK::Property::Color, color))
1886 handleStylePropertyChanged(&QQStyleKitTextProperties::colorChanged);
1891 return styleProperty<Qt::Alignment>(QQSK::Property::Alignment);
1896 if (setStyleProperty(QQSK::Property::Alignment, alignment))
1897 handleStylePropertyChanged(&QQStyleKitTextProperties::alignmentChanged);
1902 return styleProperty<
bool>(QQSK::Property::Bold,
false);
1907 if (setStyleProperty(QQSK::Property::Bold, bold))
1913 return styleProperty<
bool>(QQSK::Property::Italic,
false);
1918 if (setStyleProperty(QQSK::Property::Italic, italic))
1924 return styleProperty<qreal>(QQSK::Property::PointSize, QFont().pointSize());
1929 if (setStyleProperty(QQSK::Property::PointSize, pointSize))
1935 return styleProperty<qreal>(QQSK::Property::Padding);
1940 if (setStyleProperty(QQSK::Property::Padding, padding))
1951 return styleProperty<qreal>(QQSK::Property::LeftPadding, QQSK::Property::Padding);
1956 if (setStyleProperty(QQSK::Property::LeftPadding, padding))
1962 return styleProperty<qreal>(QQSK::Property::RightPadding, QQSK::Property::Padding);
1967 if (setStyleProperty(QQSK::Property::RightPadding, padding))
1973 return styleProperty<qreal>(QQSK::Property::TopPadding, QQSK::Property::Padding);
1978 if (setStyleProperty(QQSK::Property::TopPadding, padding))
1984 return styleProperty<qreal>(QQSK::Property::BottomPadding, QQSK::Property::Padding);
1989 if (setStyleProperty(QQSK::Property::BottomPadding, padding))
1995 return lazyCreateGroup(m_first, QQSK::PropertyGroup::DelegateSubtype1);
2000 return lazyCreateGroup(m_second, QQSK::PropertyGroup::DelegateSubtype2);
2005QQStyleKitControlProperties::QQStyleKitControlProperties(QQSK::PropertyGroup group, QObject *parent)
2006 : QQStyleKitPropertyGroup(group, parent)
2009
2010
2011
2012
2013 m_groupSpace.size = nestedGroupsStartSize;
2014 m_groupSpace.start = 0;
2016 if (group == QQSK::PropertyGroup::GlobalFlag) {
2018
2019
2020
2021
2022
2023
2024 m_pathFlags.setFlag(QQSK::PropertyPathFlag::Global);
2028QQStyleKitStyle *QQStyleKitControlProperties::style()
const
2030 if (subclass() == QQSK::Subclass::QQStyleKitState) {
2032
2033
2034
2035
2036
2037
2038 QObject *obj = parent();
2039 while (obj && !obj->metaObject()->inherits(&QQStyleKitStyle::staticMetaObject))
2040 obj = obj->parent();
2041 return obj ?
static_cast<QQStyleKitStyle *>(obj) :
nullptr;
2044 if (subclass() == QQSK::Subclass::QQStyleKitReader) {
2045 const auto *reader =
static_cast<
const QQStyleKitReader *>(
this);
2046 if (reader->m_explicitStyle)
2047 return reader->m_explicitStyle;
2051 return QQStyleKitStyle::current();
2054QQSK::Subclass QQStyleKitControlProperties::subclass()
const
2057
2058
2059
2060
2061
2062 if (metaObject()->inherits(&QQStyleKitReader::staticMetaObject))
2063 return QQSK::Subclass::QQStyleKitReader;
2064 if (metaObject()->inherits(&QQStyleKitControlState::staticMetaObject))
2065 return QQSK::Subclass::QQStyleKitState;
2069QQStyleKitReader *QQStyleKitControlProperties::asQQStyleKitReader()
const
2071 Q_ASSERT(subclass() == QQSK::Subclass::QQStyleKitReader);
2072 return static_cast<QQStyleKitReader *>(
const_cast<QQStyleKitControlProperties *>(
this));
2075QQStyleKitControlState *QQStyleKitControlProperties::asQQStyleKitState()
const
2077 Q_ASSERT(subclass() == QQSK::Subclass::QQStyleKitState);
2078 Q_ASSERT(metaObject()->inherits(&QQStyleKitControlState::staticMetaObject));
2079 return static_cast<QQStyleKitControlState *>(
const_cast<QQStyleKitControlProperties *>(
this));
2082void QQStyleKitControlProperties::forEachUsedDelegate(
2083 std::function<
void (QQStyleKitDelegateProperties *, QQSK::Delegate,
const QString &)> f)
2087 f(m_background, QQSK::Delegate::Background,
"background"_L1);
2090 f(m_indicator, QQSK::Delegate::Indicator,
"indicator"_L1);
2091 if (m_indicator->m_foreground)
2092 f(m_indicator->m_foreground, QQSK::Delegate::IndicatorForeground,
"indicator.foreground"_L1);
2093 if (m_indicator->m_first) {
2094 f(m_indicator->m_first, QQSK::Delegate::IndicatorFirst,
"indicator.first"_L1);
2095 if (m_indicator->m_first->m_foreground)
2096 f(m_indicator->m_first->m_foreground, QQSK::Delegate::IndicatorFirstForeground,
"indicator.first.foreground"_L1);
2098 if (m_indicator->m_second) {
2099 f(m_indicator->m_second, QQSK::Delegate::IndicatorSecond,
"indicator.second"_L1);
2100 if (m_indicator->m_second->m_foreground)
2101 f(m_indicator->m_second->m_foreground, QQSK::Delegate::IndicatorSecondForeground,
"indicator.second.foreground"_L1);
2106 f(m_handle, QQSK::Delegate::Handle,
"handle"_L1);
2107 if (m_handle->m_first)
2108 f(m_handle->m_first, QQSK::Delegate::HandleFirst,
"handle.first"_L1);
2109 if (m_handle->m_second)
2110 f(m_handle->m_second, QQSK::Delegate::HandleSecond,
"handle.second"_L1);
2114void QQStyleKitControlProperties::emitChangedForAllStyleProperties(EmitFlags emitFlags)
2117
2118
2119 emitChangedForAllStylePropertiesRecursive(emitFlags);
2122template <
typename... CHANGED_SIGNALS>
2123void QQStyleKitControlProperties::emitGlobally(
2124 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
2126 for (QQStyleKitReader *reader : QQStyleKitReader::s_allReaders) {
2127 if (reader->controlType() != controlType)
2129 ((reader->*changedSignals)(), ...);
2133void QQStyleKitControlProperties::forEachExistingNestedGroup(
2134 const std::function<
void (QQStyleKitPropertyGroup *)> &f)
const
2147qreal QQStyleKitControlProperties::spacing()
const
2149 return styleProperty<qreal>(QQSK::Property::Spacing);
2152void QQStyleKitControlProperties::setSpacing(qreal spacing)
2154 if (setStyleProperty(QQSK::Property::Spacing, spacing))
2155 handleStylePropertyChanged(&QQStyleKitControlProperties::spacingChanged);
2158qreal QQStyleKitControlProperties::padding()
const
2160 return styleProperty<qreal>(QQSK::Property::Padding);
2163void QQStyleKitControlProperties::setPadding(qreal padding)
2165 if (setStyleProperty(QQSK::Property::Padding, padding))
2166 handleStylePropertiesChanged<QQStyleKitControlProperties>(
2167 &QQStyleKitControlProperties::paddingChanged,
2168 &QQStyleKitControlProperties::leftPaddingChanged,
2169 &QQStyleKitControlProperties::rightPaddingChanged,
2170 &QQStyleKitControlProperties::topPaddingChanged,
2171 &QQStyleKitControlProperties::bottomPaddingChanged);
2174qreal QQStyleKitControlProperties::leftPadding()
const
2176 return styleProperty<qreal>(QQSK::Property::LeftPadding, QQSK::Property::Padding);
2179void QQStyleKitControlProperties::setLeftPadding(qreal leftPadding)
2181 if (setStyleProperty(QQSK::Property::LeftPadding, leftPadding))
2182 handleStylePropertyChanged(&QQStyleKitControlProperties::leftPaddingChanged);
2185qreal QQStyleKitControlProperties::rightPadding()
const
2187 return styleProperty<qreal>(QQSK::Property::RightPadding, QQSK::Property::Padding);
2190void QQStyleKitControlProperties::setRightPadding(qreal rightPadding)
2192 if (setStyleProperty(QQSK::Property::RightPadding, rightPadding))
2193 handleStylePropertyChanged(&QQStyleKitControlProperties::rightPaddingChanged);
2196qreal QQStyleKitControlProperties::topPadding()
const
2198 return styleProperty<qreal>(QQSK::Property::TopPadding, QQSK::Property::Padding);
2201void QQStyleKitControlProperties::setTopPadding(qreal topPadding)
2203 if (setStyleProperty(QQSK::Property::TopPadding, topPadding))
2204 handleStylePropertyChanged(&QQStyleKitControlProperties::topPaddingChanged);
2207qreal QQStyleKitControlProperties::bottomPadding()
const
2209 return styleProperty<qreal>(QQSK::Property::BottomPadding, QQSK::Property::Padding);
2212void QQStyleKitControlProperties::setBottomPadding(qreal bottomPadding)
2214 if (setStyleProperty(QQSK::Property::BottomPadding, bottomPadding))
2215 handleStylePropertyChanged(&QQStyleKitControlProperties::bottomPaddingChanged);
2218QQuickTransition *QQStyleKitControlProperties::transition()
const
2220 return styleProperty<QQuickTransition *>(QQSK::Property::Transition);
2223void QQStyleKitControlProperties::setTransition(QQuickTransition *transition)
2225 if (setStyleProperty(QQSK::Property::Transition, transition))
2226 handleStylePropertyChanged(&QQStyleKitControlProperties::transitionChanged);
2229QQStyleKitTextProperties *QQStyleKitControlProperties::text()
const
2231 return lazyCreateGroup(m_text, QQSK::PropertyGroup::Text);
2234QQStyleKitDelegateProperties *QQStyleKitControlProperties::background()
const
2236 return lazyCreateGroup(m_background, QQSK::PropertyGroup::Background);
2239QQStyleKitHandleProperties *QQStyleKitControlProperties::handle()
const
2241 return lazyCreateGroup(m_handle, QQSK::PropertyGroup::Handle);
2244QQStyleKitIndicatorWithSubTypes *QQStyleKitControlProperties::indicator()
const
2246 return lazyCreateGroup(m_indicator, QQSK::PropertyGroup::Indicator);
2251#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)