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
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
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
457
458
459
460
461
462
463
464
465
466
467
468
469
472
473
474
475
476
479
480
481
482
483
484
487
488
489
490
495
496
497
498
499
500
501
502
503
504
505
506
507
510
511
512
513
516
517
518
519
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
548
549
550
551
552
553
556
557
558
559
560
561
562
565
566
567
568
569
570
573
574
575
576
579
580
581
582
583
584
585
588
589
590
591
592
595
596
597
598
601
602
603
604
605
606
607
608
609
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
636
637
638
639
640
641
644
645
646
647
648
649
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
674
675
676
677
678
679
684
685
686
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
719
720
721
722
723
724
725
726
729
730
731
732
733
734
735
736
737
738
739
740
743
744
745
746
747
748
749
750
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
777
778
779
780
783
784
785
786
787
788
789
792
793
794
795
796
797
798
801
802
803
804
807
808
809
810
811
812
813
816
817
818
819
820
821
822
825
826
827
828
829
830
831
832
835
836
837
838
841
842
843
844
845
846
847
850
851
852
853
854
855
856
860QHash<PropertyPathId_t, QString> QQStyleKitPropertyGroup::s_pathStrings;
869 if (flag == PropertyPathId::Flag::IncludeSubtype) {
870 if (m_pathFlags.testFlag(QQSK::PropertyPathFlag::DelegateSubtype1))
871 return PropertyPathId(property, m_groupSpace.start, QQSK::PropertyGroup::DelegateSubtype1);
872 else if (m_pathFlags.testFlag(QQSK::PropertyPathFlag::DelegateSubtype2))
873 return PropertyPathId(property, m_groupSpace.start, QQSK::PropertyGroup::DelegateSubtype2);
875 return PropertyPathId(property, m_groupSpace.start, QQSK::PropertyGroup::DelegateSubtype0);
881
882
883
884
885
886
887
888
889
890 if (s_pathStrings.contains(m_groupSpace.start))
891 return s_pathStrings[m_groupSpace.start];
893 constexpr PropertyPathId_t rootGroupsSize = nestedGroupsStartSize / nestedGroupCount;
894 const auto metaEnum = QMetaEnum::fromType<QQSK::PropertyGroup>();
896 PropertyPathId_t nestedGroupStart = m_groupSpace.start;
897 PropertyPathId_t nestedGroupSize = rootGroupsSize;
898 PropertyPathId_t nestedGroupIndex = nestedGroupStart / nestedGroupSize;
899 auto groupType = QQSK::PropertyGroup(nestedGroupIndex);
900 if (groupType == QQSK::PropertyGroup::Control)
903 QString groupName = QString::fromLatin1(metaEnum.valueToKey(
static_cast<
int>(groupType)));
904 groupName[0] = groupName[0].toLower();
905 QString pathString = groupName;
908 nestedGroupStart -= nestedGroupIndex * nestedGroupSize;
909 nestedGroupSize /= nestedGroupCount;
910 nestedGroupIndex = nestedGroupStart / nestedGroupSize;
911 groupType = QQSK::PropertyGroup(nestedGroupIndex);
912 if (groupType == QQSK::PropertyGroup::Control)
915 QString groupName = QString::fromLatin1(metaEnum.valueToKey(
static_cast<
int>(groupType)));
916 groupName[0] = groupName[0].toLower();
917 pathString +=
'.'_L1 + groupName;
920 s_pathStrings.insert(m_groupSpace.start, pathString);
927 Q_ASSERT(qobject_cast<
const QQStyleKitControlProperties *>(
this));
929 return static_cast<QQStyleKitControlProperties *>(self);
931 Q_ASSERT(qobject_cast<
const QQStyleKitControlProperties *>(parent()));
932 return static_cast<QQStyleKitControlProperties *>(parent());
938 T *nestedGroup = QQSK::lazyCreate(ptr, controlProperties(), group);
941 nestedGroup->m_pathFlags = m_pathFlags;
943 if (group == QQSK::PropertyGroup::DelegateSubtype1) {
945
946
947
948
949
950
951 nestedGroup->m_pathFlags.setFlag(QQSK::PropertyPathFlag::DelegateSubtype1);
952 nestedGroup->m_groupSpace = m_groupSpace;
953 }
else if (group == QQSK::PropertyGroup::DelegateSubtype2) {
954 nestedGroup->m_pathFlags.setFlag(QQSK::PropertyPathFlag::DelegateSubtype2);
955 nestedGroup->m_groupSpace = m_groupSpace;
958
959
960 const PropertyPathId_t nestedGroupIndex = PropertyPathId_t(group);
961 const PropertyPathId_t nestedGroupSize = m_groupSpace.size / nestedGroupCount;
962 nestedGroup->m_groupSpace.size = nestedGroupSize;
963 nestedGroup->m_groupSpace.start = m_groupSpace.start + (nestedGroupIndex * nestedGroupSize);
965
966
967
968
969
970 Q_ASSERT(nestedGroupSize >= PropertyPathId_t(QQSK::Property::COUNT));
976
977
978
979
980
981
982
983
984
985
986#define CONDITIONALLY_EMIT_SIGNALS_GLOBALLY_FOR(CONTROL_PROPERTIES, GROUP_PATH) if
987 (this == CONTROL_PROPERTIES -> GROUP_PATH ) {
988 for (QQStyleKitReader *reader : QQStyleKitReader::s_allReaders) {
989 const auto baseTypes = QQStyleKitPropertyResolver::baseTypesForType(reader->controlType());
990 if (reader->controlType() != controlType && !baseTypes.contains(controlType))
992 reader->clearLocalStorage();
993 ((reader-> GROUP_PATH ->*changedSignals)(), ...);
996}
998template<
typename SUBCLASS>
1000 handleStylePropertiesChanged<SUBCLASS>(changedSignal);
1003template <
typename SUBCLASS,
typename... CHANGED_SIGNALS>
1007
1008
1009
1010
1011
1012
1013
1014 static_assert(std::is_base_of<QQStyleKitPropertyGroup, SUBCLASS>::value,
1015 "SUBCLASS must inherit QQStyleKitPropertyGroup");
1017 auto *group =
static_cast<SUBCLASS *>(
this);
1020 if (objectWrittenTo == QQSK::Subclass::QQStyleKitState) {
1021 ((group->*changedSignals)(), ...);
1023 if (shouldEmitGlobally()) {
1025 const QQStyleKitExtendableControlType type = control->controlType();
1026 group->emitGlobally(type, changedSignals...);
1031 if (objectWrittenTo == QQSK::Subclass::QQStyleKitReader) {
1033
1034
1035
1036 if (shouldEmitLocally())
1037 ((group->*changedSignals)(), ...);
1047
1048
1049 const int startIndex = QQStyleKitPropertyGroup::staticMetaObject.propertyOffset();
1050 const QMetaObject* meta = metaObject();
1051 for (
int i = startIndex; i < meta->propertyCount(); ++i) {
1052 const QMetaProperty prop = meta->property(i);
1053 const QMetaObject* propMetaObject = QMetaType::fromName(prop.typeName()).metaObject();
1054 if (propMetaObject) {
1055 if (propMetaObject->inherits(&QQStyleKitDelegateProperties::staticMetaObject)) {
1057
1058
1061 if (propMetaObject->inherits(&QQStyleKitPropertyGroup::staticMetaObject)) {
1063 QObject *childObj = qvariant_cast<QObject *>(property(prop.name()));
1064 if (
auto *child = qobject_cast<QQStyleKitPropertyGroup *>(childObj))
1065 child->emitChangedForAllStylePropertiesRecursive(emitFlags);
1070 if (!emitFlags.testFlag(EmitFlag::AllProperties)) {
1072 if (emitFlags.testFlag(EmitFlag::Colors)) {
1073 if (prop.metaType() != QMetaType::fromType<QColor>())
1079 Q_ASSERT(prop.hasNotifySignal());
1080 QMetaMethod notify = prop.notifySignal();
1081 notify.invoke(
this, Qt::DirectConnection);
1096 if (parentStyle->loaded() && !parentStyle->m_isUpdatingPalette) {
1098
1099
1100
1101
1102
1103
1104 return parentStyle == QQStyleKitStyle::current();
1111QQStyleKitImageProperties::QQStyleKitImageProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1112 : QQStyleKitPropertyGroup(group, parent)
1116template <
typename... CHANGED_SIGNALS>
1117void QQStyleKitImageProperties::emitGlobally(
1118 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1121 const QQStyleKitControlProperties *cp = controlProperties();
1128QUrl QQStyleKitImageProperties::source()
const
1130 return styleProperty<QUrl>(QQSK::Property::Source);
1133void QQStyleKitImageProperties::setSource(
const QUrl &source)
1135 if (setStyleProperty(QQSK::Property::Source, source))
1136 handleStylePropertyChanged(&QQStyleKitImageProperties::sourceChanged);
1139QColor QQStyleKitImageProperties::color()
const
1141 return styleProperty<QColor>(QQSK::Property::Color);
1144void QQStyleKitImageProperties::setColor(
const QColor &color)
1146 if (setStyleProperty(QQSK::Property::Color, color))
1147 handleStylePropertyChanged(&QQStyleKitImageProperties::colorChanged);
1150QQuickImage::FillMode QQStyleKitImageProperties::fillMode()
const
1152 return styleProperty<QQuickImage::FillMode>(QQSK::Property::FillMode);
1155void QQStyleKitImageProperties::setFillMode(QQuickImage::FillMode fillMode)
1157 if (setStyleProperty(QQSK::Property::FillMode, fillMode))
1158 handleStylePropertyChanged(&QQStyleKitImageProperties::fillModeChanged);
1163QQStyleKitBorderProperties::QQStyleKitBorderProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1164 : QQStyleKitPropertyGroup(group, parent)
1168template <
typename... CHANGED_SIGNALS>
1169void QQStyleKitBorderProperties::emitGlobally(
1170 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1173 const QQStyleKitControlProperties *cp = controlProperties();
1180qreal QQStyleKitBorderProperties::width()
const
1182 return styleProperty<qreal>(QQSK::Property::Width);
1185void QQStyleKitBorderProperties::setWidth(qreal width)
1187 if (setStyleProperty(QQSK::Property::Width, width))
1188 handleStylePropertyChanged(&QQStyleKitBorderProperties::widthChanged);
1191QColor QQStyleKitBorderProperties::color()
const
1193 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1196void QQStyleKitBorderProperties::setColor(
const QColor &color)
1198 if (setStyleProperty(QQSK::Property::Color, color))
1199 handleStylePropertyChanged(&QQStyleKitBorderProperties::colorChanged);
1204QQStyleKitShadowProperties::QQStyleKitShadowProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1205 : QQStyleKitPropertyGroup(group, parent)
1209template <
typename... CHANGED_SIGNALS>
1210void QQStyleKitShadowProperties::emitGlobally(
1211 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1214 const QQStyleKitControlProperties *cp = controlProperties();
1221QColor QQStyleKitShadowProperties::color()
const
1223 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1226void QQStyleKitShadowProperties::setColor(QColor color)
1228 if (setStyleProperty(QQSK::Property::Color, color))
1229 handleStylePropertyChanged(&QQStyleKitShadowProperties::colorChanged);
1232qreal QQStyleKitShadowProperties::opacity()
const
1234 return styleProperty<qreal>(QQSK::Property::Opacity, 1.0);
1237void QQStyleKitShadowProperties::setOpacity(qreal opacity)
1239 if (setStyleProperty(QQSK::Property::Opacity, opacity))
1240 handleStylePropertyChanged(&QQStyleKitShadowProperties::opacityChanged);
1243qreal QQStyleKitShadowProperties::scale()
const
1245 return styleProperty<qreal>(QQSK::Property::Scale, 1.0);
1248void QQStyleKitShadowProperties::setScale(qreal scale)
1250 if (setStyleProperty(QQSK::Property::Scale, scale))
1251 handleStylePropertyChanged(&QQStyleKitShadowProperties::scaleChanged);
1254qreal QQStyleKitShadowProperties::verticalOffset()
const
1256 return styleProperty<qreal>(QQSK::Property::VOffset);
1259void QQStyleKitShadowProperties::setVerticalOffset(qreal verticalOffset)
1261 if (setStyleProperty(QQSK::Property::VOffset, verticalOffset))
1262 handleStylePropertyChanged(&QQStyleKitShadowProperties::verticalOffsetChanged);
1265qreal QQStyleKitShadowProperties::horizontalOffset()
const
1267 return styleProperty<qreal>(QQSK::Property::HOffset);
1270void QQStyleKitShadowProperties::setHorizontalOffset(qreal horizontalOffset)
1272 if (setStyleProperty(QQSK::Property::HOffset, horizontalOffset))
1273 handleStylePropertyChanged(&QQStyleKitShadowProperties::horizontalOffsetChanged);
1276qreal QQStyleKitShadowProperties::blur()
const
1278 return styleProperty<qreal>(QQSK::Property::Blur, 10.0);
1281void QQStyleKitShadowProperties::setBlur(qreal blur)
1283 if (setStyleProperty(QQSK::Property::Blur, blur))
1284 handleStylePropertyChanged(&QQStyleKitShadowProperties::blurChanged);
1287bool QQStyleKitShadowProperties::visible()
const
1289 return styleProperty<
bool>(QQSK::Property::Visible,
true);
1292void QQStyleKitShadowProperties::setVisible(
bool visible)
1294 if (setStyleProperty(QQSK::Property::Visible, visible))
1295 handleStylePropertyChanged(&QQStyleKitShadowProperties::visibleChanged);
1298QQmlComponent *QQStyleKitShadowProperties::delegate()
const
1300 return styleProperty<QQmlComponent *>(QQSK::Property::Delegate);
1303void QQStyleKitShadowProperties::setDelegate(QQmlComponent *delegate)
1305 if (setStyleProperty(QQSK::Property::Delegate, delegate))
1306 handleStylePropertyChanged(&QQStyleKitShadowProperties::delegateChanged);
1311QQStyleKitDelegateProperties::QQStyleKitDelegateProperties(QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1312 : QQStyleKitPropertyGroup(group, parent)
1316template <
typename... CHANGED_SIGNALS>
1317void QQStyleKitDelegateProperties::emitGlobally(
1318 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1321 const QQStyleKitControlProperties *cp = controlProperties();
1328qreal QQStyleKitDelegateProperties::radius()
const
1330 return styleProperty<qreal>(QQSK::Property::Radius);
1333void QQStyleKitDelegateProperties::setRadius(qreal radius)
1335 if (setStyleProperty(QQSK::Property::Radius, radius))
1336 handleStylePropertiesChanged<QQStyleKitDelegateProperties>(
1337 &QQStyleKitDelegateProperties::radiusChanged,
1338 &QQStyleKitDelegateProperties::topLeftRadiusChanged,
1339 &QQStyleKitDelegateProperties::topRightRadiusChanged,
1340 &QQStyleKitDelegateProperties::bottomLeftRadiusChanged,
1341 &QQStyleKitDelegateProperties::bottomRightRadiusChanged);
1344qreal QQStyleKitDelegateProperties::topLeftRadius()
const
1346 return styleProperty<qreal>(QQSK::Property::TopLeftRadius, QQSK::Property::Radius);
1349void QQStyleKitDelegateProperties::setTopLeftRadius(qreal radius)
1351 if (setStyleProperty(QQSK::Property::TopLeftRadius, radius))
1352 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topLeftRadiusChanged);
1355qreal QQStyleKitDelegateProperties::topRightRadius()
const
1357 return styleProperty<qreal>(QQSK::Property::TopRightRadius, QQSK::Property::Radius);
1360void QQStyleKitDelegateProperties::setTopRightRadius(qreal radius)
1362 if (setStyleProperty(QQSK::Property::TopRightRadius, radius))
1363 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topRightRadiusChanged);
1366qreal QQStyleKitDelegateProperties::bottomLeftRadius()
const
1368 return styleProperty<qreal>(QQSK::Property::BottomLeftRadius, QQSK::Property::Radius);
1371void QQStyleKitDelegateProperties::setBottomLeftRadius(qreal radius)
1373 if (setStyleProperty(QQSK::Property::BottomLeftRadius, radius))
1374 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomLeftRadiusChanged);
1377qreal QQStyleKitDelegateProperties::bottomRightRadius()
const
1379 return styleProperty<qreal>(QQSK::Property::BottomRightRadius, QQSK::Property::Radius);
1382void QQStyleKitDelegateProperties::setBottomRightRadius(qreal radius)
1384 if (setStyleProperty(QQSK::Property::BottomRightRadius, radius))
1385 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomRightRadiusChanged);
1388qreal QQStyleKitDelegateProperties::scale()
const
1390 return styleProperty<qreal>(QQSK::Property::Scale, 1.0);
1393void QQStyleKitDelegateProperties::setScale(qreal scale)
1395 if (setStyleProperty(QQSK::Property::Scale, scale))
1396 handleStylePropertyChanged(&QQStyleKitDelegateProperties::scaleChanged);
1399qreal QQStyleKitDelegateProperties::rotation()
const
1401 return styleProperty<qreal>(QQSK::Property::Rotation);
1404void QQStyleKitDelegateProperties::setRotation(qreal rotation)
1406 if (setStyleProperty(QQSK::Property::Rotation, rotation))
1407 handleStylePropertyChanged(&QQStyleKitDelegateProperties::rotationChanged);
1410qreal QQStyleKitDelegateProperties::implicitWidth()
const
1412 return styleProperty<qreal>(QQSK::Property::ImplicitWidth);
1415void QQStyleKitDelegateProperties::setImplicitWidth(qreal width)
1417 if (setStyleProperty(QQSK::Property::ImplicitWidth, width))
1418 handleStylePropertyChanged(&QQStyleKitDelegateProperties::implicitWidthChanged);
1421qreal QQStyleKitDelegateProperties::implicitHeight()
const
1423 return styleProperty<qreal>(QQSK::Property::ImplicitHeight);
1426void QQStyleKitDelegateProperties::setImplicitHeight(qreal height)
1428 if (setStyleProperty(QQSK::Property::ImplicitHeight, height))
1429 handleStylePropertyChanged(&QQStyleKitDelegateProperties::implicitHeightChanged);
1432qreal QQStyleKitDelegateProperties::minimumWidth()
const
1434 return styleProperty<qreal>(QQSK::Property::MinimumWidth);
1437void QQStyleKitDelegateProperties::setMinimumWidth(qreal width)
1439 if (setStyleProperty(QQSK::Property::MinimumWidth, width))
1440 handleStylePropertyChanged(&QQStyleKitDelegateProperties::minimumWidthChanged);
1443qreal QQStyleKitDelegateProperties::margins()
const
1445 return styleProperty<qreal>(QQSK::Property::Margins);
1448void QQStyleKitDelegateProperties::setMargins(qreal margins)
1450 if (setStyleProperty(QQSK::Property::Margins, margins))
1451 handleStylePropertiesChanged<QQStyleKitDelegateProperties>(
1452 &QQStyleKitDelegateProperties::marginsChanged,
1453 &QQStyleKitDelegateProperties::leftMarginChanged,
1454 &QQStyleKitDelegateProperties::rightMarginChanged,
1455 &QQStyleKitDelegateProperties::topMarginChanged,
1456 &QQStyleKitDelegateProperties::bottomMarginChanged);
1459qreal QQStyleKitDelegateProperties::leftMargin()
const
1461 return styleProperty<qreal>(QQSK::Property::LeftMargin, QQSK::Property::Margins);
1464void QQStyleKitDelegateProperties::setLeftMargin(qreal margin)
1466 if (setStyleProperty(QQSK::Property::LeftMargin, margin))
1467 handleStylePropertyChanged(&QQStyleKitDelegateProperties::leftMarginChanged);
1470qreal QQStyleKitDelegateProperties::rightMargin()
const
1472 return styleProperty<qreal>(QQSK::Property::RightMargin, QQSK::Property::Margins);
1475void QQStyleKitDelegateProperties::setRightMargin(qreal margin)
1477 if (setStyleProperty(QQSK::Property::RightMargin, margin))
1478 handleStylePropertyChanged(&QQStyleKitDelegateProperties::rightMarginChanged);
1481qreal QQStyleKitDelegateProperties::topMargin()
const
1483 return styleProperty<qreal>(QQSK::Property::TopMargin, QQSK::Property::Margins);
1486void QQStyleKitDelegateProperties::setTopMargin(qreal margin)
1488 if (setStyleProperty(QQSK::Property::TopMargin, margin))
1489 handleStylePropertyChanged(&QQStyleKitDelegateProperties::topMarginChanged);
1492qreal QQStyleKitDelegateProperties::bottomMargin()
const
1494 return styleProperty<qreal>(QQSK::Property::BottomMargin, QQSK::Property::Margins);
1497void QQStyleKitDelegateProperties::setBottomMargin(qreal margin)
1499 if (setStyleProperty(QQSK::Property::BottomMargin, margin))
1500 handleStylePropertyChanged(&QQStyleKitDelegateProperties::bottomMarginChanged);
1503Qt::Alignment QQStyleKitDelegateProperties::alignment()
const
1505 return styleProperty<Qt::Alignment>(QQSK::Property::Alignment, Qt::AlignLeft | Qt::AlignVCenter);
1508void QQStyleKitDelegateProperties::setAlignment(Qt::Alignment alignment)
1510 if (setStyleProperty(QQSK::Property::Alignment, alignment))
1511 handleStylePropertyChanged(&QQStyleKitDelegateProperties::alignmentChanged);
1514qreal QQStyleKitDelegateProperties::opacity()
const
1516 return styleProperty<qreal>(QQSK::Property::Opacity, 1.0);
1519void QQStyleKitDelegateProperties::setOpacity(qreal opacity)
1521 if (setStyleProperty(QQSK::Property::Opacity, opacity))
1522 handleStylePropertyChanged(&QQStyleKitDelegateProperties::opacityChanged);
1525QColor QQStyleKitDelegateProperties::color()
const
1527 return styleProperty<QColor>(QQSK::Property::Color, Qt::transparent);
1530void QQStyleKitDelegateProperties::setColor(
const QColor &color)
1532 if (setStyleProperty(QQSK::Property::Color, color))
1533 handleStylePropertyChanged(&QQStyleKitDelegateProperties::colorChanged);
1536bool QQStyleKitDelegateProperties::visible()
const
1538 return styleProperty<
bool>(QQSK::Property::Visible,
true);
1541void QQStyleKitDelegateProperties::setVisible(
bool visible)
1543 if (setStyleProperty(QQSK::Property::Visible, visible))
1544 handleStylePropertyChanged(&QQStyleKitDelegateProperties::visibleChanged);
1547bool QQStyleKitDelegateProperties::clip()
const
1549 return styleProperty<
bool>(QQSK::Property::Clip,
false);
1552void QQStyleKitDelegateProperties::setClip(
bool clip)
1554 if (setStyleProperty(QQSK::Property::Clip, clip))
1555 handleStylePropertyChanged(&QQStyleKitDelegateProperties::clipChanged);
1558QQuickGradient *QQStyleKitDelegateProperties::gradient()
const
1560 return styleProperty<QQuickGradient *>(QQSK::Property::Gradient);
1563void QQStyleKitDelegateProperties::setGradient(QQuickGradient *gradient)
1565 if (setStyleProperty(QQSK::Property::Gradient, gradient))
1566 handleStylePropertyChanged(&QQStyleKitDelegateProperties::gradientChanged);
1569QObject *QQStyleKitDelegateProperties::data()
const
1571 return styleProperty<QObject *>(QQSK::Property::Data);
1574void QQStyleKitDelegateProperties::setData(QObject *data)
1576 if (setStyleProperty(QQSK::Property::Data, data))
1577 handleStylePropertyChanged(&QQStyleKitDelegateProperties::dataChanged);
1580QQmlComponent *QQStyleKitDelegateProperties::delegate()
const
1582 return styleProperty<QQmlComponent *>(QQSK::Property::Delegate);
1585void QQStyleKitDelegateProperties::setDelegate(QQmlComponent *delegate)
1587 if (setStyleProperty(QQSK::Property::Delegate, delegate))
1588 handleStylePropertyChanged(&QQStyleKitDelegateProperties::delegateChanged);
1591QQStyleKitBorderProperties *QQStyleKitDelegateProperties::border()
const
1593 return lazyCreateGroup(m_border, QQSK::PropertyGroup::Border);
1596QQStyleKitShadowProperties *QQStyleKitDelegateProperties::shadow()
const
1598 return lazyCreateGroup(m_shadow, QQSK::PropertyGroup::Shadow);
1601QQStyleKitImageProperties *QQStyleKitDelegateProperties::image()
const
1603 return lazyCreateGroup(m_image, QQSK::PropertyGroup::Image);
1609 : QQStyleKitDelegateProperties(group, parent)
1615 return lazyCreateGroup(m_first, QQSK::PropertyGroup::DelegateSubtype1);
1620 return lazyCreateGroup(m_second, QQSK::PropertyGroup::DelegateSubtype2);
1626 QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1627 : QQStyleKitDelegateProperties(group, parent)
1631template <
typename... CHANGED_SIGNALS>
1633 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1636 const QQStyleKitControlProperties *cp = controlProperties();
1643 return lazyCreateGroup(m_foreground, QQSK::PropertyGroup::Foreground);
1649 QQSK::PropertyGroup group, QQStyleKitControlProperties *parent)
1650 : QQStyleKitDelegateProperties(group, parent)
1654template <
typename... CHANGED_SIGNALS>
1656 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1659 const QQStyleKitControlProperties *cp = controlProperties();
1665 return lazyCreateGroup(m_foreground, QQSK::PropertyGroup::Foreground);
1670 return lazyCreateGroup(m_up, QQSK::PropertyGroup::DelegateSubtype1);
1675 return lazyCreateGroup(m_down, QQSK::PropertyGroup::DelegateSubtype2);
1684template <
typename... CHANGED_SIGNALS>
1686 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1694 return styleProperty<QColor>(QQSK::Property::Color);
1699 if (setStyleProperty(QQSK::Property::Color, color))
1700 handleStylePropertyChanged(&QQStyleKitTextProperties::colorChanged);
1705 return styleProperty<Qt::Alignment>(QQSK::Property::Alignment);
1710 if (setStyleProperty(QQSK::Property::Alignment, alignment))
1711 handleStylePropertyChanged(&QQStyleKitTextProperties::alignmentChanged);
1716 return styleProperty<
bool>(QQSK::Property::Bold,
false);
1721 if (setStyleProperty(QQSK::Property::Bold, bold))
1727 return styleProperty<
bool>(QQSK::Property::Italic,
false);
1732 if (setStyleProperty(QQSK::Property::Italic, italic))
1738 return styleProperty<qreal>(QQSK::Property::PointSize);
1743 if (setStyleProperty(QQSK::Property::PointSize, pointSize))
1749 return styleProperty<qreal>(QQSK::Property::Padding);
1754 if (setStyleProperty(QQSK::Property::Padding, padding))
1765 return styleProperty<qreal>(QQSK::Property::LeftPadding, QQSK::Property::Padding);
1770 if (setStyleProperty(QQSK::Property::LeftPadding, padding))
1776 return styleProperty<qreal>(QQSK::Property::RightPadding, QQSK::Property::Padding);
1781 if (setStyleProperty(QQSK::Property::RightPadding, padding))
1787 return styleProperty<qreal>(QQSK::Property::TopPadding, QQSK::Property::Padding);
1792 if (setStyleProperty(QQSK::Property::TopPadding, padding))
1798 return styleProperty<qreal>(QQSK::Property::BottomPadding, QQSK::Property::Padding);
1803 if (setStyleProperty(QQSK::Property::BottomPadding, padding))
1809QQStyleKitControlProperties::QQStyleKitControlProperties(QQSK::PropertyGroup group, QObject *parent)
1810 : QQStyleKitPropertyGroup(group, parent)
1813
1814
1815
1816
1817 m_groupSpace.size = nestedGroupsStartSize;
1818 m_groupSpace.start = 0;
1820 if (group == QQSK::PropertyGroup::GlobalFlag) {
1822
1823
1824
1825
1826
1827
1828 m_pathFlags.setFlag(QQSK::PropertyPathFlag::Global);
1832QQStyleKitStyle *QQStyleKitControlProperties::style()
const
1834 if (subclass() == QQSK::Subclass::QQStyleKitState) {
1836
1837
1838
1839
1840
1841
1842 QObject *obj = parent();
1843 while (obj && !obj->metaObject()->inherits(&QQStyleKitStyle::staticMetaObject))
1844 obj = obj->parent();
1845 return obj ?
static_cast<QQStyleKitStyle *>(obj) :
nullptr;
1848 if (subclass() == QQSK::Subclass::QQStyleKitReader) {
1849 const auto *reader =
static_cast<
const QQStyleKitReader *>(
this);
1850 if (reader->m_explicitStyle)
1851 return reader->m_explicitStyle;
1855 return QQStyleKitStyle::current();
1858QQSK::Subclass QQStyleKitControlProperties::subclass()
const
1861
1862
1863
1864
1865
1866 if (metaObject()->inherits(&QQStyleKitReader::staticMetaObject))
1867 return QQSK::Subclass::QQStyleKitReader;
1868 if (metaObject()->inherits(&QQStyleKitControlState::staticMetaObject))
1869 return QQSK::Subclass::QQStyleKitState;
1873QQStyleKitReader *QQStyleKitControlProperties::asQQStyleKitReader()
const
1875 Q_ASSERT(subclass() == QQSK::Subclass::QQStyleKitReader);
1876 return static_cast<QQStyleKitReader *>(
const_cast<QQStyleKitControlProperties *>(
this));
1879QQStyleKitControlState *QQStyleKitControlProperties::asQQStyleKitState()
const
1881 Q_ASSERT(subclass() == QQSK::Subclass::QQStyleKitState);
1882 Q_ASSERT(metaObject()->inherits(&QQStyleKitControlState::staticMetaObject));
1883 return static_cast<QQStyleKitControlState *>(
const_cast<QQStyleKitControlProperties *>(
this));
1886void QQStyleKitControlProperties::forEachUsedDelegate(
1887 std::function<
void (QQStyleKitDelegateProperties *, QQSK::Delegate,
const QString &)> f)
1891 f(m_background, QQSK::Delegate::Background,
"background"_L1);
1894 f(m_indicator, QQSK::Delegate::Indicator,
"indicator"_L1);
1895 if (m_indicator->m_foreground)
1896 f(m_indicator->m_foreground, QQSK::Delegate::IndicatorForeground,
"indicator.foreground"_L1);
1897 if (m_indicator->m_up) {
1898 f(m_indicator->m_up, QQSK::Delegate::IndicatorUp,
"indicator.up"_L1);
1899 if (m_indicator->m_up->m_foreground)
1900 f(m_indicator->m_up->m_foreground, QQSK::Delegate::IndicatorUpForeground,
"indicator.up.foreground"_L1);
1902 if (m_indicator->m_down) {
1903 f(m_indicator->m_down, QQSK::Delegate::IndicatorDown,
"indicator.down"_L1);
1904 if (m_indicator->m_down->m_foreground)
1905 f(m_indicator->m_down->m_foreground, QQSK::Delegate::IndicatorDownForeground,
"indicator.down.foreground"_L1);
1910 f(m_handle, QQSK::Delegate::Handle,
"handle"_L1);
1911 if (m_handle->m_first)
1912 f(m_handle->m_first, QQSK::Delegate::HandleFirst,
"handle.first"_L1);
1913 if (m_handle->m_second)
1914 f(m_handle->m_second, QQSK::Delegate::HandleSecond,
"handle.second"_L1);
1918void QQStyleKitControlProperties::emitChangedForAllStyleProperties(EmitFlags emitFlags)
1921
1922
1923 if (emitFlags.testFlag(EmitFlag::AllProperties)) {
1924 emit leftPaddingChanged();
1925 emit rightPaddingChanged();
1926 emit topPaddingChanged();
1927 emit bottomPaddingChanged();
1928 emit spacingChanged();
1929 emit transitionChanged();
1933 forEachUsedDelegate([=](QQStyleKitDelegateProperties *delegate, QQSK::Delegate,
const QString &){
1934 delegate->emitChangedForAllStylePropertiesRecursive(emitFlags);
1938template <
typename... CHANGED_SIGNALS>
1939void QQStyleKitControlProperties::emitGlobally(
1940 QQStyleKitExtendableControlType controlType, CHANGED_SIGNALS... changedSignals)
const
1942 for (QQStyleKitReader *reader : QQStyleKitReader::s_allReaders) {
1943 if (reader->controlType() != controlType)
1945 ((reader->*changedSignals)(), ...);
1949qreal QQStyleKitControlProperties::spacing()
const
1951 return styleProperty<qreal>(QQSK::Property::Spacing);
1954void QQStyleKitControlProperties::setSpacing(qreal spacing)
1956 if (setStyleProperty(QQSK::Property::Spacing, spacing))
1957 handleStylePropertyChanged(&QQStyleKitControlProperties::spacingChanged);
1960qreal QQStyleKitControlProperties::padding()
const
1962 return styleProperty<qreal>(QQSK::Property::Padding);
1965void QQStyleKitControlProperties::setPadding(qreal padding)
1967 if (setStyleProperty(QQSK::Property::Padding, padding))
1968 handleStylePropertiesChanged<QQStyleKitControlProperties>(
1969 &QQStyleKitControlProperties::paddingChanged,
1970 &QQStyleKitControlProperties::leftPaddingChanged,
1971 &QQStyleKitControlProperties::rightPaddingChanged,
1972 &QQStyleKitControlProperties::topPaddingChanged,
1973 &QQStyleKitControlProperties::bottomPaddingChanged);
1976qreal QQStyleKitControlProperties::leftPadding()
const
1978 return styleProperty<qreal>(QQSK::Property::LeftPadding, QQSK::Property::Padding);
1981void QQStyleKitControlProperties::setLeftPadding(qreal leftPadding)
1983 if (setStyleProperty(QQSK::Property::LeftPadding, leftPadding))
1984 handleStylePropertyChanged(&QQStyleKitControlProperties::leftPaddingChanged);
1987qreal QQStyleKitControlProperties::rightPadding()
const
1989 return styleProperty<qreal>(QQSK::Property::RightPadding, QQSK::Property::Padding);
1992void QQStyleKitControlProperties::setRightPadding(qreal rightPadding)
1994 if (setStyleProperty(QQSK::Property::RightPadding, rightPadding))
1995 handleStylePropertyChanged(&QQStyleKitControlProperties::rightPaddingChanged);
1998qreal QQStyleKitControlProperties::topPadding()
const
2000 return styleProperty<qreal>(QQSK::Property::TopPadding, QQSK::Property::Padding);
2003void QQStyleKitControlProperties::setTopPadding(qreal topPadding)
2005 if (setStyleProperty(QQSK::Property::TopPadding, topPadding))
2006 handleStylePropertyChanged(&QQStyleKitControlProperties::topPaddingChanged);
2009qreal QQStyleKitControlProperties::bottomPadding()
const
2011 return styleProperty<qreal>(QQSK::Property::BottomPadding, QQSK::Property::Padding);
2014void QQStyleKitControlProperties::setBottomPadding(qreal bottomPadding)
2016 if (setStyleProperty(QQSK::Property::BottomPadding, bottomPadding))
2017 handleStylePropertyChanged(&QQStyleKitControlProperties::bottomPaddingChanged);
2020QQuickTransition *QQStyleKitControlProperties::transition()
const
2022 return styleProperty<QQuickTransition *>(QQSK::Property::Transition);
2025void QQStyleKitControlProperties::setTransition(QQuickTransition *transition)
2027 if (setStyleProperty(QQSK::Property::Transition, transition))
2028 handleStylePropertyChanged(&QQStyleKitControlProperties::transitionChanged);
2031QQStyleKitTextProperties *QQStyleKitControlProperties::text()
const
2033 return lazyCreateGroup(m_text, QQSK::PropertyGroup::Text);
2036QQStyleKitDelegateProperties *QQStyleKitControlProperties::background()
const
2038 return lazyCreateGroup(m_background, QQSK::PropertyGroup::Background);
2041QQStyleKitHandleProperties *QQStyleKitControlProperties::handle()
const
2043 return lazyCreateGroup(m_handle, QQSK::PropertyGroup::Handle);
2046QQStyleKitIndicatorWithSubTypes *QQStyleKitControlProperties::indicator()
const
2048 return lazyCreateGroup(m_indicator, QQSK::PropertyGroup::Indicator);
2053#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)