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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
185
186
187
188
189
192
193
194
195
198
199
200
201
202
203
206
207
208
209
210
211
212
215
216
217
218
219
220
223
224
225
226
229
230
231
232
233
234
235
236
237
238
239
240
241
242
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
270
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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
321
322
323
324
325
326
329
330
331
332
335
336
337
338
339
342
343
344
345
346
347
348
351
352
353
354
355
356
357
358
361
362
363
364
365
368
369
370
371
372
373
374
377
378
379
380
381
382
383
384
387
388
389
390
391
392
393
396
397
398
399
402
403
404
405
408
409
410
411
412
413
416
417
418
419
420
421
424
425
426
427
428
429
430
433
434
435
436
437
438
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
460
461
462
463
464
465
466
467
468
469
470
471
472
475
476
477
478
479
482
483
484
485
486
487
490
491
492
493
498
499
500
501
502
503
504
505
506
507
508
509
510
513
514
515
516
519
520
521
522
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
551
552
553
554
555
556
559
560
561
562
563
564
565
568
569
570
571
572
573
576
577
578
579
582
583
584
585
586
587
588
591
592
593
594
595
598
599
600
601
604
605
606
607
608
609
610
611
612
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
639
640
641
642
643
644
647
648
649
650
651
652
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
677
678
679
680
681
682
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
722
723
724
725
726
727
728
729
732
733
734
735
736
737
738
739
740
741
742
743
746
747
748
749
750
751
752
753
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
780
781
782
783
786
787
788
789
790
791
792
795
796
797
798
799
800
801
804
805
806
807
810
811
812
813
814
815
816
819
820
821
822
823
824
825
828
829
830
831
832
833
834
835
838
839
840
841
844
845
846
847
848
849
850
853
854
855
856
857
858
859
863QHash<PropertyPathId_t, QString> QQStyleKitPropertyGroup::s_pathStrings;
872 if (flag == PropertyPathId::Flag::IncludeSubtype) {
873 if (m_pathFlags.testFlag(QQSK::PropertyPathFlag::DelegateSubtype1))
874 return PropertyPathId(property, m_groupSpace.start, QQSK::PropertyGroup::DelegateSubtype1);
875 else if (m_pathFlags.testFlag(QQSK::PropertyPathFlag::DelegateSubtype2))
876 return PropertyPathId(property, m_groupSpace.start, QQSK::PropertyGroup::DelegateSubtype2);
878 return PropertyPathId(property, m_groupSpace.start, QQSK::PropertyGroup::DelegateSubtype0);
884
885
886
887
888
889
890
891
892
893 if (s_pathStrings.contains(m_groupSpace.start))
894 return s_pathStrings[m_groupSpace.start];
896 constexpr PropertyPathId_t rootGroupsSize = nestedGroupsStartSize / nestedGroupCount;
897 const auto metaEnum = QMetaEnum::fromType<QQSK::PropertyGroup>();
899 PropertyPathId_t nestedGroupStart = m_groupSpace.start;
900 PropertyPathId_t nestedGroupSize = rootGroupsSize;
901 PropertyPathId_t nestedGroupIndex = nestedGroupStart / nestedGroupSize;
902 auto groupType = QQSK::PropertyGroup(nestedGroupIndex);
903 if (groupType == QQSK::PropertyGroup::Control)
906 QString groupName = QString::fromLatin1(metaEnum.valueToKey(
static_cast<
int>(groupType)));
907 groupName[0] = groupName[0].toLower();
908 QString pathString = groupName;
911 nestedGroupStart -= nestedGroupIndex * nestedGroupSize;
912 nestedGroupSize /= nestedGroupCount;
913 nestedGroupIndex = nestedGroupStart / nestedGroupSize;
914 groupType = QQSK::PropertyGroup(nestedGroupIndex);
915 if (groupType == QQSK::PropertyGroup::Control)
918 QString groupName = QString::fromLatin1(metaEnum.valueToKey(
static_cast<
int>(groupType)));
919 groupName[0] = groupName[0].toLower();
920 pathString +=
'.'_L1 + groupName;
923 s_pathStrings.insert(m_groupSpace.start, pathString);
930 Q_ASSERT(qobject_cast<
const QQStyleKitControlProperties *>(
this));
932 return static_cast<QQStyleKitControlProperties *>(self);
934 Q_ASSERT(qobject_cast<
const QQStyleKitControlProperties *>(parent()));
935 return static_cast<QQStyleKitControlProperties *>(parent());
941 T *nestedGroup = QQSK::lazyCreate(ptr, controlProperties(), group);
944 nestedGroup->m_pathFlags = m_pathFlags;
946 if (group == QQSK::PropertyGroup::DelegateSubtype1) {
948
949
950
951
952
953
954 nestedGroup->m_pathFlags.setFlag(QQSK::PropertyPathFlag::DelegateSubtype1);
955 nestedGroup->m_groupSpace = m_groupSpace;
956 }
else if (group == QQSK::PropertyGroup::DelegateSubtype2) {
957 nestedGroup->m_pathFlags.setFlag(QQSK::PropertyPathFlag::DelegateSubtype2);
958 nestedGroup->m_groupSpace = m_groupSpace;
961
962
963 const PropertyPathId_t nestedGroupIndex = PropertyPathId_t(group);
964 const PropertyPathId_t nestedGroupSize = m_groupSpace.size / nestedGroupCount;
965 nestedGroup->m_groupSpace.size = nestedGroupSize;
966 nestedGroup->m_groupSpace.start = m_groupSpace.start + (nestedGroupIndex * nestedGroupSize);
968
969
970
971
972
973 Q_ASSERT(nestedGroupSize >= PropertyPathId_t(QQSK::Property::COUNT));
979
980
981
982
983
984
985
986
987
988
989#define CONDITIONALLY_EMIT_SIGNALS_GLOBALLY_FOR(CONTROL_PROPERTIES, GROUP_PATH) if
990 (this == CONTROL_PROPERTIES -> GROUP_PATH ) {
991 for (QQStyleKitReader *reader : QQStyleKitReader::s_allReaders) {
992 const auto baseTypes = QQStyleKitPropertyResolver::baseTypesForType(reader->controlType());
993 if (reader->controlType() != controlType && !baseTypes.contains(controlType))
995 reader->clearLocalStorage();
996 ((reader-> GROUP_PATH ->*changedSignals)(), ...);
999}
1001template<
typename SUBCLASS>
1003 handleStylePropertiesChanged<SUBCLASS>(changedSignal);
1006template <
typename SUBCLASS,
typename... CHANGED_SIGNALS>
1010
1011
1012
1013
1014
1015
1016
1017 static_assert(std::is_base_of<QQStyleKitPropertyGroup, SUBCLASS>::value,
1018 "SUBCLASS must inherit QQStyleKitPropertyGroup");
1020 auto *group =
static_cast<SUBCLASS *>(
this);
1023 if (objectWrittenTo == QQSK::Subclass::QQStyleKitState) {
1024 ((group->*changedSignals)(), ...);
1026 if (shouldEmitGlobally()) {
1028 const QQStyleKitExtendableControlType type = control->controlType();
1029 group->emitGlobally(type, changedSignals...);
1034 if (objectWrittenTo == QQSK::Subclass::QQStyleKitReader) {
1036
1037
1038
1039 if (shouldEmitLocally()) {
1042
1043
1044
1045
1046 if (!reader->m_target)
1047 ((group->*changedSignals)(), ...);
1049 QCoreApplication::postEvent(reader->m_target,
new QEvent(QEvent::StyleAnimationUpdate));
1060
1061
1062 const int startIndex = QQStyleKitPropertyGroup::staticMetaObject.propertyOffset();
1063 const QMetaObject* meta = metaObject();
1064 for (
int i = startIndex; i < meta->propertyCount(); ++i) {
1065 const QMetaProperty prop = meta->property(i);
1066 const QMetaObject* propMetaObject = QMetaType::fromName(prop.typeName()).metaObject();
1067 if (propMetaObject) {
1068 if (propMetaObject->inherits(&QQStyleKitDelegateProperties::staticMetaObject)) {
1070
1071
1074 if (propMetaObject->inherits(&QQStyleKitPropertyGroup::staticMetaObject)) {
1076 QObject *childObj = qvariant_cast<QObject *>(property(prop.name()));
1077 if (
auto *child = qobject_cast<QQStyleKitPropertyGroup *>(childObj))
1078 child->emitChangedForAllStylePropertiesRecursive(emitFlags);
1083 if (!emitFlags.testFlag(EmitFlag::AllProperties)) {
1085 if (emitFlags.testFlag(EmitFlag::Colors)) {
1086 if (prop.metaType() != QMetaType::fromType<QColor>())
1092 Q_ASSERT(prop.hasNotifySignal());
1093 QMetaMethod notify = prop.notifySignal();
1094 notify.invoke(
this, Qt::DirectConnection);
1109 if (parentStyle->loaded() && !parentStyle->m_isUpdatingPalette) {
1111
1112
1113
1114
1115
1116
1117 return parentStyle == QQStyleKitStyle::current();
1124QQStyleKitImageProperties::QQStyleKitImageProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1125 : QQStyleKitPropertyGroup(group, parent)
1129template <
typename... CHANGED_SIGNALS>
1130void QQStyleKitImageProperties::emitGlobally(
1131 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1134 const QQStyleKitControlProperties *cp = controlProperties();
1141QUrl QQStyleKitImageProperties::source()
const
1143 return styleProperty<QUrl>(QQSK::Property::Source);
1146void QQStyleKitImageProperties::setSource(
const QUrl &source)
1148 if (setStyleProperty(QQSK::Property::Source, source))
1149 handleStylePropertyChanged(&QQStyleKitImageProperties::sourceChanged);
1152QColor QQStyleKitImageProperties::color()
const
1154 return styleProperty<QColor>(QQSK::Property::Color);
1157void QQStyleKitImageProperties::setColor(
const QColor &color)
1159 if (setStyleProperty(QQSK::Property::Color, color))
1160 handleStylePropertyChanged(&QQStyleKitImageProperties::colorChanged);
1163QQuickImage::FillMode QQStyleKitImageProperties::fillMode()
const
1165 return styleProperty<QQuickImage::FillMode>(QQSK::Property::FillMode);
1168void QQStyleKitImageProperties::setFillMode(QQuickImage::FillMode fillMode)
1170 if (setStyleProperty(QQSK::Property::FillMode, fillMode))
1171 handleStylePropertyChanged(&QQStyleKitImageProperties::fillModeChanged);
1176QQStyleKitBorderProperties::QQStyleKitBorderProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1177 : QQStyleKitPropertyGroup(group, parent)
1181template <
typename... CHANGED_SIGNALS>
1182void QQStyleKitBorderProperties::emitGlobally(
1183 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1186 const QQStyleKitControlProperties *cp = controlProperties();
1193qreal QQStyleKitBorderProperties::width()
const
1195 return styleProperty<qreal>(QQSK::Property::Width);
1198void QQStyleKitBorderProperties::setWidth(qreal width)
1200 if (setStyleProperty(QQSK::Property::Width, width))
1201 handleStylePropertyChanged(&QQStyleKitBorderProperties::widthChanged);
1204QColor QQStyleKitBorderProperties::color()
const
1206 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1209void QQStyleKitBorderProperties::setColor(
const QColor &color)
1211 if (setStyleProperty(QQSK::Property::Color, color))
1212 handleStylePropertyChanged(&QQStyleKitBorderProperties::colorChanged);
1217QQStyleKitShadowProperties::QQStyleKitShadowProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1218 : QQStyleKitPropertyGroup(group, parent)
1222template <
typename... CHANGED_SIGNALS>
1223void QQStyleKitShadowProperties::emitGlobally(
1224 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1227 const QQStyleKitControlProperties *cp = controlProperties();
1234QColor QQStyleKitShadowProperties::color()
const
1236 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1239void QQStyleKitShadowProperties::setColor(QColor color)
1241 if (setStyleProperty(QQSK::Property::Color, color))
1242 handleStylePropertyChanged(&QQStyleKitShadowProperties::colorChanged);
1245qreal QQStyleKitShadowProperties::opacity()
const
1247 return styleProperty<qreal>(QQSK::Property::Opacity, 1.0);
1250void QQStyleKitShadowProperties::setOpacity(qreal opacity)
1252 if (setStyleProperty(QQSK::Property::Opacity, opacity))
1253 handleStylePropertyChanged(&QQStyleKitShadowProperties::opacityChanged);
1256qreal QQStyleKitShadowProperties::scale()
const
1258 return styleProperty<qreal>(QQSK::Property::Scale, 1.0);
1261void QQStyleKitShadowProperties::setScale(qreal scale)
1263 if (setStyleProperty(QQSK::Property::Scale, scale))
1264 handleStylePropertyChanged(&QQStyleKitShadowProperties::scaleChanged);
1267qreal QQStyleKitShadowProperties::verticalOffset()
const
1269 return styleProperty<qreal>(QQSK::Property::VOffset);
1272void QQStyleKitShadowProperties::setVerticalOffset(qreal verticalOffset)
1274 if (setStyleProperty(QQSK::Property::VOffset, verticalOffset))
1275 handleStylePropertyChanged(&QQStyleKitShadowProperties::verticalOffsetChanged);
1278qreal QQStyleKitShadowProperties::horizontalOffset()
const
1280 return styleProperty<qreal>(QQSK::Property::HOffset);
1283void QQStyleKitShadowProperties::setHorizontalOffset(qreal horizontalOffset)
1285 if (setStyleProperty(QQSK::Property::HOffset, horizontalOffset))
1286 handleStylePropertyChanged(&QQStyleKitShadowProperties::horizontalOffsetChanged);
1289qreal QQStyleKitShadowProperties::blur()
const
1291 return styleProperty<qreal>(QQSK::Property::Blur, 10.0);
1294void QQStyleKitShadowProperties::setBlur(qreal blur)
1296 if (setStyleProperty(QQSK::Property::Blur, blur))
1297 handleStylePropertyChanged(&QQStyleKitShadowProperties::blurChanged);
1300bool QQStyleKitShadowProperties::visible()
const
1302 return styleProperty<
bool>(QQSK::Property::Visible,
true);
1305void QQStyleKitShadowProperties::setVisible(
bool visible)
1307 if (setStyleProperty(QQSK::Property::Visible, visible))
1308 handleStylePropertyChanged(&QQStyleKitShadowProperties::visibleChanged);
1311QQmlComponent *QQStyleKitShadowProperties::delegate()
const
1313 return styleProperty<QQmlComponent *>(QQSK::Property::Delegate);
1316void QQStyleKitShadowProperties::setDelegate(QQmlComponent *delegate)
1318 if (setStyleProperty(QQSK::Property::Delegate, delegate))
1319 handleStylePropertyChanged(&QQStyleKitShadowProperties::delegateChanged);
1324QQStyleKitDelegateProperties::QQStyleKitDelegateProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1325 : QQStyleKitPropertyGroup(group, parent)
1329template <
typename... CHANGED_SIGNALS>
1330void QQStyleKitDelegateProperties::emitGlobally(
1331 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1334 const QQStyleKitControlProperties *cp = controlProperties();
1341qreal QQStyleKitDelegateProperties::radius()
const
1343 return styleProperty<qreal>(QQSK::Property::Radius);
1346void QQStyleKitDelegateProperties::setRadius(qreal radius)
1348 if (setStyleProperty(QQSK::Property::Radius, radius))
1349 handleStylePropertiesChanged<QQStyleKitDelegateProperties>(
1350 &QQStyleKitDelegateProperties::radiusChanged,
1351 &QQStyleKitDelegateProperties::topLeftRadiusChanged,
1352 &QQStyleKitDelegateProperties::topRightRadiusChanged,
1353 &QQStyleKitDelegateProperties::bottomLeftRadiusChanged,
1354 &QQStyleKitDelegateProperties::bottomRightRadiusChanged);
1357qreal QQStyleKitDelegateProperties::topLeftRadius()
const
1359 return styleProperty<qreal>(QQSK::Property::TopLeftRadius, QQSK::Property::Radius);
1362void QQStyleKitDelegateProperties::setTopLeftRadius(qreal radius)
1364 if (setStyleProperty(QQSK::Property::TopLeftRadius, radius))
1365 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topLeftRadiusChanged);
1368qreal QQStyleKitDelegateProperties::topRightRadius()
const
1370 return styleProperty<qreal>(QQSK::Property::TopRightRadius, QQSK::Property::Radius);
1373void QQStyleKitDelegateProperties::setTopRightRadius(qreal radius)
1375 if (setStyleProperty(QQSK::Property::TopRightRadius, radius))
1376 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topRightRadiusChanged);
1379qreal QQStyleKitDelegateProperties::bottomLeftRadius()
const
1381 return styleProperty<qreal>(QQSK::Property::BottomLeftRadius, QQSK::Property::Radius);
1384void QQStyleKitDelegateProperties::setBottomLeftRadius(qreal radius)
1386 if (setStyleProperty(QQSK::Property::BottomLeftRadius, radius))
1387 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomLeftRadiusChanged);
1390qreal QQStyleKitDelegateProperties::bottomRightRadius()
const
1392 return styleProperty<qreal>(QQSK::Property::BottomRightRadius, QQSK::Property::Radius);
1395void QQStyleKitDelegateProperties::setBottomRightRadius(qreal radius)
1397 if (setStyleProperty(QQSK::Property::BottomRightRadius, radius))
1398 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomRightRadiusChanged);
1401qreal QQStyleKitDelegateProperties::scale()
const
1403 return styleProperty<qreal>(QQSK::Property::Scale, 1.0);
1406void QQStyleKitDelegateProperties::setScale(qreal scale)
1408 if (setStyleProperty(QQSK::Property::Scale, scale))
1409 handleStylePropertyChanged(&QQStyleKitDelegateProperties::scaleChanged);
1412qreal QQStyleKitDelegateProperties::rotation()
const
1414 return styleProperty<qreal>(QQSK::Property::Rotation);
1417void QQStyleKitDelegateProperties::setRotation(qreal rotation)
1419 if (setStyleProperty(QQSK::Property::Rotation, rotation))
1420 handleStylePropertyChanged(&QQStyleKitDelegateProperties::rotationChanged);
1423qreal QQStyleKitDelegateProperties::implicitWidth()
const
1425 return styleProperty<qreal>(QQSK::Property::ImplicitWidth);
1428void QQStyleKitDelegateProperties::setImplicitWidth(qreal width)
1430 if (setStyleProperty(QQSK::Property::ImplicitWidth, width))
1431 handleStylePropertyChanged(&QQStyleKitDelegateProperties::implicitWidthChanged);
1434qreal QQStyleKitDelegateProperties::implicitHeight()
const
1436 return styleProperty<qreal>(QQSK::Property::ImplicitHeight);
1439void QQStyleKitDelegateProperties::setImplicitHeight(qreal height)
1441 if (setStyleProperty(QQSK::Property::ImplicitHeight, height))
1442 handleStylePropertyChanged(&QQStyleKitDelegateProperties::implicitHeightChanged);
1445qreal QQStyleKitDelegateProperties::minimumWidth()
const
1447 return styleProperty<qreal>(QQSK::Property::MinimumWidth);
1450void QQStyleKitDelegateProperties::setMinimumWidth(qreal width)
1452 if (setStyleProperty(QQSK::Property::MinimumWidth, width))
1453 handleStylePropertyChanged(&QQStyleKitDelegateProperties::minimumWidthChanged);
1456qreal QQStyleKitDelegateProperties::margins()
const
1458 return styleProperty<qreal>(QQSK::Property::Margins);
1461void QQStyleKitDelegateProperties::setMargins(qreal margins)
1463 if (setStyleProperty(QQSK::Property::Margins, margins))
1464 handleStylePropertiesChanged<QQStyleKitDelegateProperties>(
1465 &QQStyleKitDelegateProperties::marginsChanged,
1466 &QQStyleKitDelegateProperties::leftMarginChanged,
1467 &QQStyleKitDelegateProperties::rightMarginChanged,
1468 &QQStyleKitDelegateProperties::topMarginChanged,
1469 &QQStyleKitDelegateProperties::bottomMarginChanged);
1472qreal QQStyleKitDelegateProperties::leftMargin()
const
1474 return styleProperty<qreal>(QQSK::Property::LeftMargin, QQSK::Property::Margins);
1477void QQStyleKitDelegateProperties::setLeftMargin(qreal margin)
1479 if (setStyleProperty(QQSK::Property::LeftMargin, margin))
1480 handleStylePropertyChanged(&QQStyleKitDelegateProperties::leftMarginChanged);
1483qreal QQStyleKitDelegateProperties::rightMargin()
const
1485 return styleProperty<qreal>(QQSK::Property::RightMargin, QQSK::Property::Margins);
1488void QQStyleKitDelegateProperties::setRightMargin(qreal margin)
1490 if (setStyleProperty(QQSK::Property::RightMargin, margin))
1491 handleStylePropertyChanged(&QQStyleKitDelegateProperties::rightMarginChanged);
1494qreal QQStyleKitDelegateProperties::topMargin()
const
1496 return styleProperty<qreal>(QQSK::Property::TopMargin, QQSK::Property::Margins);
1499void QQStyleKitDelegateProperties::setTopMargin(qreal margin)
1501 if (setStyleProperty(QQSK::Property::TopMargin, margin))
1502 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topMarginChanged);
1505qreal QQStyleKitDelegateProperties::bottomMargin()
const
1507 return styleProperty<qreal>(QQSK::Property::BottomMargin, QQSK::Property::Margins);
1510void QQStyleKitDelegateProperties::setBottomMargin(qreal margin)
1512 if (setStyleProperty(QQSK::Property::BottomMargin, margin))
1513 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomMarginChanged);
1516Qt::Alignment QQStyleKitDelegateProperties::alignment()
const
1518 return styleProperty<Qt::Alignment>(QQSK::Property::Alignment, Qt::AlignLeft | Qt::AlignVCenter);
1521void QQStyleKitDelegateProperties::setAlignment(Qt::Alignment alignment)
1523 if (setStyleProperty(QQSK::Property::Alignment, alignment))
1524 handleStylePropertyChanged(&QQStyleKitDelegateProperties::alignmentChanged);
1527qreal QQStyleKitDelegateProperties::opacity()
const
1529 return styleProperty<qreal>(QQSK::Property::Opacity, 1.0);
1532void QQStyleKitDelegateProperties::setOpacity(qreal opacity)
1534 if (setStyleProperty(QQSK::Property::Opacity, opacity))
1535 handleStylePropertyChanged(&QQStyleKitDelegateProperties::opacityChanged);
1538QColor QQStyleKitDelegateProperties::color()
const
1540 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1543void QQStyleKitDelegateProperties::setColor(
const QColor &color)
1545 if (setStyleProperty(QQSK::Property::Color, color))
1546 handleStylePropertyChanged(&QQStyleKitDelegateProperties::colorChanged);
1549bool QQStyleKitDelegateProperties::visible()
const
1551 return styleProperty<
bool>(QQSK::Property::Visible,
true);
1554void QQStyleKitDelegateProperties::setVisible(
bool visible)
1556 if (setStyleProperty(QQSK::Property::Visible, visible))
1557 handleStylePropertyChanged(&QQStyleKitDelegateProperties::visibleChanged);
1560bool QQStyleKitDelegateProperties::clip()
const
1562 return styleProperty<
bool>(QQSK::Property::Clip,
false);
1565void QQStyleKitDelegateProperties::setClip(
bool clip)
1567 if (setStyleProperty(QQSK::Property::Clip, clip))
1568 handleStylePropertyChanged(&QQStyleKitDelegateProperties::clipChanged);
1571QQuickGradient *QQStyleKitDelegateProperties::gradient()
const
1573 return styleProperty<QQuickGradient *>(QQSK::Property::Gradient);
1576void QQStyleKitDelegateProperties::setGradient(QQuickGradient *gradient)
1578 if (setStyleProperty(QQSK::Property::Gradient, gradient))
1579 handleStylePropertyChanged(&QQStyleKitDelegateProperties::gradientChanged);
1582QObject *QQStyleKitDelegateProperties::data()
const
1584 return styleProperty<QObject *>(QQSK::Property::Data);
1587void QQStyleKitDelegateProperties::setData(QObject *data)
1589 if (setStyleProperty(QQSK::Property::Data, data))
1590 handleStylePropertyChanged(&QQStyleKitDelegateProperties::dataChanged);
1593QQmlComponent *QQStyleKitDelegateProperties::delegate()
const
1595 return styleProperty<QQmlComponent *>(QQSK::Property::Delegate);
1598void QQStyleKitDelegateProperties::setDelegate(QQmlComponent *delegate)
1600 if (setStyleProperty(QQSK::Property::Delegate, delegate))
1601 handleStylePropertyChanged(&QQStyleKitDelegateProperties::delegateChanged);
1604QQStyleKitBorderProperties *QQStyleKitDelegateProperties::border()
const
1606 return lazyCreateGroup(m_border, QQSK::PropertyGroup::Border);
1609QQStyleKitShadowProperties *QQStyleKitDelegateProperties::shadow()
const
1611 return lazyCreateGroup(m_shadow, QQSK::PropertyGroup::Shadow);
1614QQStyleKitImageProperties *QQStyleKitDelegateProperties::image()
const
1616 return lazyCreateGroup(m_image, QQSK::PropertyGroup::Image);
1622 : QQStyleKitDelegateProperties(group, parent)
1628 return lazyCreateGroup(m_first, QQSK::PropertyGroup::DelegateSubtype1);
1633 return lazyCreateGroup(m_second, QQSK::PropertyGroup::DelegateSubtype2);
1639 QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1640 : QQStyleKitDelegateProperties(group, parent)
1644template <
typename... CHANGED_SIGNALS>
1646 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1649 const QQStyleKitControlProperties *cp = controlProperties();
1656 return lazyCreateGroup(m_foreground, QQSK::PropertyGroup::Foreground);
1662 QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1663 : QQStyleKitDelegateProperties(group, parent)
1667template <
typename... CHANGED_SIGNALS>
1669 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1672 const QQStyleKitControlProperties *cp = controlProperties();
1678 return lazyCreateGroup(m_foreground, QQSK::PropertyGroup::Foreground);
1683 return lazyCreateGroup(m_up, QQSK::PropertyGroup::DelegateSubtype1);
1688 return lazyCreateGroup(m_down, QQSK::PropertyGroup::DelegateSubtype2);
1697template <
typename... CHANGED_SIGNALS>
1699 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1707 return styleProperty<QColor>(QQSK::Property::Color);
1712 if (setStyleProperty(QQSK::Property::Color, color))
1713 handleStylePropertyChanged(&QQStyleKitTextProperties::colorChanged);
1718 return styleProperty<Qt::Alignment>(QQSK::Property::Alignment);
1723 if (setStyleProperty(QQSK::Property::Alignment, alignment))
1724 handleStylePropertyChanged(&QQStyleKitTextProperties::alignmentChanged);
1729 return styleProperty<
bool>(QQSK::Property::Bold,
false);
1734 if (setStyleProperty(QQSK::Property::Bold, bold))
1740 return styleProperty<
bool>(QQSK::Property::Italic,
false);
1745 if (setStyleProperty(QQSK::Property::Italic, italic))
1751 return styleProperty<qreal>(QQSK::Property::PointSize);
1756 if (setStyleProperty(QQSK::Property::PointSize, pointSize))
1762 return styleProperty<qreal>(QQSK::Property::Padding);
1767 if (setStyleProperty(QQSK::Property::Padding, padding))
1778 return styleProperty<qreal>(QQSK::Property::LeftPadding, QQSK::Property::Padding);
1783 if (setStyleProperty(QQSK::Property::LeftPadding, padding))
1789 return styleProperty<qreal>(QQSK::Property::RightPadding, QQSK::Property::Padding);
1794 if (setStyleProperty(QQSK::Property::RightPadding, padding))
1800 return styleProperty<qreal>(QQSK::Property::TopPadding, QQSK::Property::Padding);
1805 if (setStyleProperty(QQSK::Property::TopPadding, padding))
1811 return styleProperty<qreal>(QQSK::Property::BottomPadding, QQSK::Property::Padding);
1816 if (setStyleProperty(QQSK::Property::BottomPadding, padding))
1822QQStyleKitControlProperties::QQStyleKitControlProperties(QQSK::PropertyGroup group, QObject *parent)
1823 : QQStyleKitPropertyGroup(group, parent)
1826
1827
1828
1829
1830 m_groupSpace.size = nestedGroupsStartSize;
1831 m_groupSpace.start = 0;
1833 if (group == QQSK::PropertyGroup::GlobalFlag) {
1835
1836
1837
1838
1839
1840
1841 m_pathFlags.setFlag(QQSK::PropertyPathFlag::Global);
1845QQStyleKitStyle *QQStyleKitControlProperties::style()
const
1847 if (subclass() == QQSK::Subclass::QQStyleKitState) {
1849
1850
1851
1852
1853
1854
1855 QObject *obj = parent();
1856 while (obj && !obj->metaObject()->inherits(&QQStyleKitStyle::staticMetaObject))
1857 obj = obj->parent();
1858 return obj ?
static_cast<QQStyleKitStyle *>(obj) :
nullptr;
1861 if (subclass() == QQSK::Subclass::QQStyleKitReader) {
1862 const auto *reader =
static_cast<
const QQStyleKitReader *>(
this);
1863 if (reader->m_explicitStyle)
1864 return reader->m_explicitStyle;
1868 return QQStyleKitStyle::current();
1871QQSK::Subclass QQStyleKitControlProperties::subclass()
const
1874
1875
1876
1877
1878
1879 if (metaObject()->inherits(&QQStyleKitReader::staticMetaObject))
1880 return QQSK::Subclass::QQStyleKitReader;
1881 if (metaObject()->inherits(&QQStyleKitControlState::staticMetaObject))
1882 return QQSK::Subclass::QQStyleKitState;
1886QQStyleKitReader *QQStyleKitControlProperties::asQQStyleKitReader()
const
1888 Q_ASSERT(subclass() == QQSK::Subclass::QQStyleKitReader);
1889 return static_cast<QQStyleKitReader *>(
const_cast<QQStyleKitControlProperties *>(
this));
1892QQStyleKitControlState *QQStyleKitControlProperties::asQQStyleKitState()
const
1894 Q_ASSERT(subclass() == QQSK::Subclass::QQStyleKitState);
1895 Q_ASSERT(metaObject()->inherits(&QQStyleKitControlState::staticMetaObject));
1896 return static_cast<QQStyleKitControlState *>(
const_cast<QQStyleKitControlProperties *>(
this));
1899void QQStyleKitControlProperties::forEachUsedDelegate(
1900 std::function<
void (QQStyleKitDelegateProperties *, QQSK::Delegate,
const QString &)> f)
1904 f(m_background, QQSK::Delegate::Background,
"background"_L1);
1907 f(m_indicator, QQSK::Delegate::Indicator,
"indicator"_L1);
1908 if (m_indicator->m_foreground)
1909 f(m_indicator->m_foreground, QQSK::Delegate::IndicatorForeground,
"indicator.foreground"_L1);
1910 if (m_indicator->m_up) {
1911 f(m_indicator->m_up, QQSK::Delegate::IndicatorUp,
"indicator.up"_L1);
1912 if (m_indicator->m_up->m_foreground)
1913 f(m_indicator->m_up->m_foreground, QQSK::Delegate::IndicatorUpForeground,
"indicator.up.foreground"_L1);
1915 if (m_indicator->m_down) {
1916 f(m_indicator->m_down, QQSK::Delegate::IndicatorDown,
"indicator.down"_L1);
1917 if (m_indicator->m_down->m_foreground)
1918 f(m_indicator->m_down->m_foreground, QQSK::Delegate::IndicatorDownForeground,
"indicator.down.foreground"_L1);
1923 f(m_handle, QQSK::Delegate::Handle,
"handle"_L1);
1924 if (m_handle->m_first)
1925 f(m_handle->m_first, QQSK::Delegate::HandleFirst,
"handle.first"_L1);
1926 if (m_handle->m_second)
1927 f(m_handle->m_second, QQSK::Delegate::HandleSecond,
"handle.second"_L1);
1931void QQStyleKitControlProperties::emitChangedForAllStyleProperties(EmitFlags emitFlags)
1934
1935
1936 if (emitFlags.testFlag(EmitFlag::AllProperties)) {
1937 emit leftPaddingChanged();
1938 emit rightPaddingChanged();
1939 emit topPaddingChanged();
1940 emit bottomPaddingChanged();
1941 emit spacingChanged();
1942 emit transitionChanged();
1946 forEachUsedDelegate([=](QQStyleKitDelegateProperties *delegate, QQSK::Delegate,
const QString &){
1947 delegate->emitChangedForAllStylePropertiesRecursive(emitFlags);
1951template <
typename... CHANGED_SIGNALS>
1952void QQStyleKitControlProperties::emitGlobally(
1953 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1955 for (QQStyleKitReader *reader : QQStyleKitReader::s_allReaders) {
1956 if (reader->controlType() != controlType)
1958 ((reader->*changedSignals)(), ...);
1962qreal QQStyleKitControlProperties::spacing()
const
1964 return styleProperty<qreal>(QQSK::Property::Spacing);
1967void QQStyleKitControlProperties::setSpacing(qreal spacing)
1969 if (setStyleProperty(QQSK::Property::Spacing, spacing))
1970 handleStylePropertyChanged(&QQStyleKitControlProperties::spacingChanged);
1973qreal QQStyleKitControlProperties::padding()
const
1975 return styleProperty<qreal>(QQSK::Property::Padding);
1978void QQStyleKitControlProperties::setPadding(qreal padding)
1980 if (setStyleProperty(QQSK::Property::Padding, padding))
1981 handleStylePropertiesChanged<QQStyleKitControlProperties>(
1982 &QQStyleKitControlProperties::paddingChanged,
1983 &QQStyleKitControlProperties::leftPaddingChanged,
1984 &QQStyleKitControlProperties::rightPaddingChanged,
1985 &QQStyleKitControlProperties::topPaddingChanged,
1986 &QQStyleKitControlProperties::bottomPaddingChanged);
1989qreal QQStyleKitControlProperties::leftPadding()
const
1991 return styleProperty<qreal>(QQSK::Property::LeftPadding, QQSK::Property::Padding);
1994void QQStyleKitControlProperties::setLeftPadding(qreal leftPadding)
1996 if (setStyleProperty(QQSK::Property::LeftPadding, leftPadding))
1997 handleStylePropertyChanged(&QQStyleKitControlProperties::leftPaddingChanged);
2000qreal QQStyleKitControlProperties::rightPadding()
const
2002 return styleProperty<qreal>(QQSK::Property::RightPadding, QQSK::Property::Padding);
2005void QQStyleKitControlProperties::setRightPadding(qreal rightPadding)
2007 if (setStyleProperty(QQSK::Property::RightPadding, rightPadding))
2008 handleStylePropertyChanged(&QQStyleKitControlProperties::rightPaddingChanged);
2011qreal QQStyleKitControlProperties::topPadding()
const
2013 return styleProperty<qreal>(QQSK::Property::TopPadding, QQSK::Property::Padding);
2016void QQStyleKitControlProperties::setTopPadding(qreal topPadding)
2018 if (setStyleProperty(QQSK::Property::TopPadding, topPadding))
2019 handleStylePropertyChanged(&QQStyleKitControlProperties::topPaddingChanged);
2022qreal QQStyleKitControlProperties::bottomPadding()
const
2024 return styleProperty<qreal>(QQSK::Property::BottomPadding, QQSK::Property::Padding);
2027void QQStyleKitControlProperties::setBottomPadding(qreal bottomPadding)
2029 if (setStyleProperty(QQSK::Property::BottomPadding, bottomPadding))
2030 handleStylePropertyChanged(&QQStyleKitControlProperties::bottomPaddingChanged);
2033QQuickTransition *QQStyleKitControlProperties::transition()
const
2035 return styleProperty<QQuickTransition *>(QQSK::Property::Transition);
2038void QQStyleKitControlProperties::setTransition(QQuickTransition *transition)
2040 if (setStyleProperty(QQSK::Property::Transition, transition))
2041 handleStylePropertyChanged(&QQStyleKitControlProperties::transitionChanged);
2044QQStyleKitTextProperties *QQStyleKitControlProperties::text()
const
2046 return lazyCreateGroup(m_text, QQSK::PropertyGroup::Text);
2049QQStyleKitDelegateProperties *QQStyleKitControlProperties::background()
const
2051 return lazyCreateGroup(m_background, QQSK::PropertyGroup::Background);
2054QQStyleKitHandleProperties *QQStyleKitControlProperties::handle()
const
2056 return lazyCreateGroup(m_handle, QQSK::PropertyGroup::Handle);
2059QQStyleKitIndicatorWithSubTypes *QQStyleKitControlProperties::indicator()
const
2061 return lazyCreateGroup(m_indicator, QQSK::PropertyGroup::Indicator);
2066#include "moc_qqstylekitcontrolproperties_p.cpp"
QQStyleKitDelegateProperties * first() const
QQStyleKitDelegateProperties * second() const
QQStyleKitDelegateProperties * foreground() const
void emitGlobally(QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals) const
void emitGlobally(QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals) const
QQStyleKitDelegateProperties * foreground() const
QQStyleKitIndicatorProperties * down() const
QQStyleKitIndicatorProperties * up() const
void emitChangedForAllStylePropertiesRecursive(EmitFlags emitFlags)
T * lazyCreateGroup(T *const &ptr, QQSK::PropertyGroup group) const
void handleStylePropertyChanged(void(SUBCLASS::*changedSignal)())
void handleStylePropertiesChanged(CHANGED_SIGNALS... changedSignals)
QQStyleKitControlProperties * controlProperties() const
QString pathToString() const
bool isControlProperties() const
void setRightPadding(qreal rightPadding)
void setBottomPadding(qreal bottomPadding)
void setTopPadding(qreal topPadding)
void setLeftPadding(qreal leftPadding)
void setPadding(qreal padding)
qreal rightPadding() const
void setItalic(bool italic)
qreal bottomPadding() const
void setPointSize(qreal pointSize)
void setColor(const QColor &color)
void bottomPaddingChanged()
Qt::Alignment alignment() const
void emitGlobally(QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals) const
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)