8#include <QtWidgets/qapplication.h>
9#include <QtWidgets/qlabel.h>
10#include <QtWidgets/qstyle.h>
11#include <QtWidgets/qstyleoption.h>
13#include <QtGui/qfontdatabase.h>
14#include <QtGui/qicon.h>
15#include <QtGui/qpainter.h>
17#include <QtCore/qdatetime.h>
18#include <QtCore/qhash.h>
19#include <QtCore/qlocale.h>
20#include <QtCore/qmap.h>
21#include <QtCore/qmetaobject.h>
22#include <QtCore/qregularexpression.h>
23#include <QtCore/qtimer.h>
32using DisambiguatedTranslation = std::pair<
const char *,
const char *>;
35 QFont::Thin, QFont::ExtraLight, QFont::Light, QFont::Normal, QFont::Medium, QFont::DemiBold,
36 QFont::Bold, QFont::ExtraBold, QFont::Black
41 auto it =
std::find(
std::begin(weightValues),
std::end(weightValues), w);
42 return int(it -
std::begin(weightValues));
47 return weightValues[i];
50template <
class PrivateData,
class Value>
53 data->minVal = minVal;
54 if (data->maxVal < data->minVal)
55 data->maxVal = data->minVal;
57 if (data->val < data->minVal)
58 data->val = data->minVal;
61template <
class PrivateData,
class Value>
64 data->maxVal = maxVal;
65 if (data->minVal > data->maxVal)
66 data->minVal = data->maxVal;
68 if (data->val > data->maxVal)
69 data->val = data->maxVal;
72template <
class PrivateData,
class Value>
75 data->minVal = newMinVal;
76 if (data->maxVal.width() < data->minVal.width())
77 data->maxVal.setWidth(data->minVal.width());
78 if (data->maxVal.height() < data->minVal.height())
79 data->maxVal.setHeight(data->minVal.height());
81 if (data->val.width() < data->minVal.width())
82 data->val.setWidth(data->minVal.width());
83 if (data->val.height() < data->minVal.height())
84 data->val.setHeight(data->minVal.height());
87template <
class PrivateData,
class Value>
90 data->maxVal = newMaxVal;
91 if (data->minVal.width() > data->maxVal.width())
92 data->minVal.setWidth(data->maxVal.width());
93 if (data->minVal.height() > data->maxVal.height())
94 data->minVal.setHeight(data->maxVal.height());
96 if (data->val.width() > data->maxVal.width())
97 data->val.setWidth(data->maxVal.width());
98 if (data->val.height() > data->maxVal.height())
99 data->val.setHeight(data->maxVal.height());
102template <
class SizeValue>
103static SizeValue
qBoundSize(
const SizeValue &minVal,
const SizeValue &val,
const SizeValue &maxVal)
105 SizeValue croppedVal = val;
106 if (minVal.width() > val.width())
107 croppedVal.setWidth(minVal.width());
108 else if (maxVal.width() < val.width())
109 croppedVal.setWidth(maxVal.width());
111 if (minVal.height() > val.height())
112 croppedVal.setHeight(minVal.height());
113 else if (maxVal.height() < val.height())
114 croppedVal.setHeight(maxVal.height());
122 return qBoundSize(minVal, val, maxVal);
127 return qBoundSize(minVal, val, maxVal);
133template <
class Value>
134void orderBorders(Value &minVal, Value &maxVal)
137 qSwap(minVal, maxVal);
140template <
class Value>
141static void orderSizeBorders(Value &minVal, Value &maxVal)
143 Value fromSize = minVal;
144 Value toSize = maxVal;
145 if (fromSize.width() > toSize.width()) {
146 fromSize.setWidth(maxVal.width());
147 toSize.setWidth(minVal.width());
149 if (fromSize.height() > toSize.height()) {
150 fromSize.setHeight(maxVal.height());
151 toSize.setHeight(minVal.height());
157void orderBorders(QSize &minVal, QSize &maxVal)
159 orderSizeBorders(minVal, maxVal);
162void orderBorders(QSizeF &minVal, QSizeF &maxVal)
164 orderSizeBorders(minVal, maxVal);
171template <
class Value,
class PrivateData>
172static Value
getData(
const QHash<
const QtProperty *, PrivateData> &propertyMap,
173 Value PrivateData::*data,
174 const QtProperty *property,
const Value &defaultValue = Value())
176 const auto it = propertyMap.constFind(property);
177 if (it == propertyMap.constEnd())
179 return it.value().*data;
182template <
class Value,
class PrivateData>
183static Value
getValue(
const QHash<
const QtProperty *, PrivateData> &propertyMap,
184 const QtProperty *property,
const Value &defaultValue = Value())
186 return getData<Value>(propertyMap, &PrivateData::val, property, defaultValue);
189template <
class Value,
class PrivateData>
190static Value
getMinimum(
const QHash<
const QtProperty *, PrivateData> &propertyMap,
191 const QtProperty *property,
const Value &defaultValue = Value())
193 return getData<Value>(propertyMap, &PrivateData::minVal, property, defaultValue);
196template <
class Value,
class PrivateData>
197static Value
getMaximum(
const QHash<
const QtProperty *, PrivateData> &propertyMap,
198 const QtProperty *property,
const Value &defaultValue = Value())
200 return getData<Value>(propertyMap, &PrivateData::maxVal, property, defaultValue);
203template <
class ValueChangeParameter,
class Value,
class PropertyManager>
205 PropertyManager *manager,
206 void (PropertyManager::*propertyChangedSignal)(
QtProperty *),
207 void (PropertyManager::*valueChangedSignal)(
QtProperty *, ValueChangeParameter),
210 const auto it = propertyMap.find(property);
211 if (it == propertyMap.end())
214 if (it.value() == val)
219 emit (manager->*propertyChangedSignal)(property);
220 emit (manager->*valueChangedSignal)(property, val);
223template <
class ValueChangeParameter,
class PropertyManagerPrivate,
class PropertyManager,
class Value>
224static void setValueInRange(PropertyManager *manager, PropertyManagerPrivate *managerPrivate,
225 void (PropertyManager::*propertyChangedSignal)(
QtProperty *),
226 void (PropertyManager::*valueChangedSignal)(
QtProperty *, ValueChangeParameter),
228 void (PropertyManagerPrivate::*setSubPropertyValue)(
QtProperty *, ValueChangeParameter))
230 const auto it = managerPrivate->m_values.find(property);
231 if (it == managerPrivate->m_values.end())
234 auto &data = it.value();
239 const Value oldVal = data.val;
241 data.val = qBound(data.minVal, val, data.maxVal);
243 if (data.val == oldVal)
246 if (setSubPropertyValue)
247 (managerPrivate->*setSubPropertyValue)(property, data.val);
249 emit (manager->*propertyChangedSignal)(property);
250 emit (manager->*valueChangedSignal)(property, data.val);
253template <
class ValueChangeParameter,
class PropertyManagerPrivate,
class PropertyManager,
class Value>
254static void setBorderValues(PropertyManager *manager, PropertyManagerPrivate *managerPrivate,
255 void (PropertyManager::*propertyChangedSignal)(
QtProperty *),
256 void (PropertyManager::*valueChangedSignal)(
QtProperty *, ValueChangeParameter),
257 void (PropertyManager::*rangeChangedSignal)(
QtProperty *, ValueChangeParameter, ValueChangeParameter),
258 QtProperty *property, ValueChangeParameter minVal, ValueChangeParameter maxVal,
259 void (PropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *,
260 ValueChangeParameter, ValueChangeParameter, ValueChangeParameter))
262 const auto it = managerPrivate->m_values.find(property);
263 if (it == managerPrivate->m_values.end())
266 Value fromVal = minVal;
267 Value toVal = maxVal;
268 orderBorders(fromVal, toVal);
270 auto &data = it.value();
272 if (data.minVal == fromVal && data.maxVal == toVal)
275 const Value oldVal = data.val;
277 data.setMinimumValue(fromVal);
278 data.setMaximumValue(toVal);
280 emit (manager->*rangeChangedSignal)(property, data.minVal, data.maxVal);
282 if (setSubPropertyRange)
283 (managerPrivate->*setSubPropertyRange)(property, data.minVal, data.maxVal, data.val);
285 if (data.val == oldVal)
288 emit (manager->*propertyChangedSignal)(property);
289 emit (manager->*valueChangedSignal)(property, data.val);
292template <
class ValueChangeParameter,
class PropertyManagerPrivate,
class PropertyManager,
class Value,
class PrivateData>
293static void setBorderValue(PropertyManager *manager, PropertyManagerPrivate *managerPrivate,
294 void (PropertyManager::*propertyChangedSignal)(
QtProperty *),
295 void (PropertyManager::*valueChangedSignal)(
QtProperty *, ValueChangeParameter),
296 void (PropertyManager::*rangeChangedSignal)(
QtProperty *, ValueChangeParameter, ValueChangeParameter),
298 Value (PrivateData::*getRangeVal)()
const,
299 void (PrivateData::*setRangeVal)(ValueChangeParameter),
const Value &borderVal,
300 void (PropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *,
301 ValueChangeParameter, ValueChangeParameter, ValueChangeParameter))
303 const auto it = managerPrivate->m_values.find(property);
304 if (it == managerPrivate->m_values.end())
307 PrivateData &data = it.value();
309 if ((data.*getRangeVal)() == borderVal)
312 const Value oldVal = data.val;
314 (data.*setRangeVal)(borderVal);
316 emit (manager->*rangeChangedSignal)(property, data.minVal, data.maxVal);
318 if (setSubPropertyRange)
319 (managerPrivate->*setSubPropertyRange)(property, data.minVal, data.maxVal, data.val);
321 if (data.val == oldVal)
324 emit (manager->*propertyChangedSignal)(property);
325 emit (manager->*valueChangedSignal)(property, data.val);
328template <
class ValueChangeParameter,
class PropertyManagerPrivate,
class PropertyManager,
class Value,
class PrivateData>
329static void setMinimumValue(PropertyManager *manager, PropertyManagerPrivate *managerPrivate,
330 void (PropertyManager::*propertyChangedSignal)(
QtProperty *),
331 void (PropertyManager::*valueChangedSignal)(
QtProperty *, ValueChangeParameter),
332 void (PropertyManager::*rangeChangedSignal)(
QtProperty *, ValueChangeParameter, ValueChangeParameter),
335 void (PropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *,
336 ValueChangeParameter, ValueChangeParameter, ValueChangeParameter) =
nullptr;
337 setBorderValue<ValueChangeParameter, PropertyManagerPrivate, PropertyManager, Value, PrivateData>(manager, managerPrivate,
338 propertyChangedSignal, valueChangedSignal, rangeChangedSignal,
339 property, &PropertyManagerPrivate::Data::minimumValue, &PropertyManagerPrivate::Data::setMinimumValue, minVal, setSubPropertyRange);
342template <
class ValueChangeParameter,
class PropertyManagerPrivate,
class PropertyManager,
class Value,
class PrivateData>
343static void setMaximumValue(PropertyManager *manager, PropertyManagerPrivate *managerPrivate,
344 void (PropertyManager::*propertyChangedSignal)(
QtProperty *),
345 void (PropertyManager::*valueChangedSignal)(
QtProperty *, ValueChangeParameter),
346 void (PropertyManager::*rangeChangedSignal)(
QtProperty *, ValueChangeParameter, ValueChangeParameter),
349 void (PropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *,
350 ValueChangeParameter, ValueChangeParameter, ValueChangeParameter) =
nullptr;
351 setBorderValue<ValueChangeParameter, PropertyManagerPrivate, PropertyManager, Value, PrivateData>(manager, managerPrivate,
352 propertyChangedSignal, valueChangedSignal, rangeChangedSignal,
353 property, &PropertyManagerPrivate::Data::maximumValue, &PropertyManagerPrivate::Data::setMaximumValue, maxVal, setSubPropertyRange);
359 Q_PROPERTY(QSizePolicy::Policy policy READ policy)
378 void indexToLocale(
int languageIndex,
int territoryIndex, QLocale::Language *language, QLocale::Territory *territory)
const;
379 void localeToIndex(QLocale::Language language, QLocale::Territory territory,
int *languageIndex,
int *territoryIndex)
const;
384 QStringList m_policyEnumNames;
385 QStringList m_languageEnumNames;
386 QMap<QLocale::Language, QStringList> m_territoryEnumNames;
387 QMap<
int, QLocale::Language> m_indexToLanguage;
388 QMap<QLocale::Language,
int> m_languageToIndex;
389 QMap<
int, QMap<
int, QLocale::Territory> > m_indexToTerritory;
391 QMetaEnum m_policyEnum;
396 QMultiMap<QString, QLocale::Territory> nameToTerritory;
397 for (
const QLocale &locale : locales) {
398 const auto territory = locale.territory();
399 nameToTerritory.insert(QLocale::territoryToString(territory), territory);
401 return nameToTerritory.values();
406 QMultiMap<QString, QLocale::Language> nameToLanguage;
407 for (
int l = QLocale::C, last = QLocale::LastLanguage; l <= last; ++l) {
408 const QLocale::Language language =
static_cast<QLocale::Language>(l);
409 QLocale locale(language);
410 if (locale.language() == language)
411 nameToLanguage.insert(QLocale::languageToString(language), language);
414 const QLocale system = QLocale::system();
415 if (!nameToLanguage.contains(QLocale::languageToString(system.language())))
416 nameToLanguage.insert(QLocale::languageToString(system.language()), system.language());
418 const auto languages = nameToLanguage.values();
419 for (QLocale::Language language : languages) {
420 auto locales = QLocale::matchingLocales(language, QLocale::AnyScript,
421 QLocale::AnyTerritory);
423 if (!locales.isEmpty() && !m_languageToIndex.contains(language)) {
424 const auto territories = sortedTerritories(locales);
425 qsizetype langIdx = m_languageEnumNames.size();
426 m_indexToLanguage[langIdx] = language;
427 m_languageToIndex[language] = langIdx;
428 QStringList territoryNames;
429 int territoryIdx = 0;
430 for (QLocale::Territory territory : territories) {
431 territoryNames << QLocale::territoryToString(territory);
432 m_indexToTerritory[langIdx][territoryIdx] = territory;
433 m_territoryToIndex[language][territory] = territoryIdx;
436 m_languageEnumNames << QLocale::languageToString(language);
437 m_territoryEnumNames[language] = territoryNames;
446 p = QtMetaEnumWrapper::staticMetaObject.property(
447 QtMetaEnumWrapper::staticMetaObject.propertyOffset() + 0);
448 m_policyEnum = p.enumerator();
449 const int keyCount = m_policyEnum.keyCount();
450 for (
int i = 0; i < keyCount; i++)
451 m_policyEnumNames << QLatin1StringView(m_policyEnum.key(i));
458 return static_cast<QSizePolicy::Policy>(m_policyEnum.value(index));
463 const int keyCount = m_policyEnum.keyCount();
464 for (
int i = 0; i < keyCount; i++)
465 if (indexToSizePolicy(i) == policy)
472 QLocale::Language l = QLocale::C;
473 QLocale::Territory c = QLocale::AnyTerritory;
474 const auto lit = m_indexToLanguage.constFind(languageIndex);
475 if (lit != m_indexToLanguage.cend()) {
477 const auto tit = m_indexToTerritory.constFind(languageIndex);
478 if (tit != m_indexToTerritory.end()) {
479 const auto tit2 = tit.value().constFind(territoryIndex);
480 if (tit2 != tit.value().cend())
494 const auto lit = m_languageToIndex.constFind(language);
495 if (lit != m_languageToIndex.cend()) {
497 const auto tit = m_territoryToIndex.constFind(language);
498 if (tit != m_territoryToIndex.cend()) {
499 const auto tit2 = tit.value().constFind(territory);
500 if (tit2 != tit.value().cend())
516
517
518
519
520
521
522
523
524
525
526
529
530
538
539
540QtGroupPropertyManager::~QtGroupPropertyManager() =
default;
543
544
552
553
560
561
572 Q_DECLARE_PUBLIC(QtIntPropertyManager)
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
616
617
618
619
620
621
622
623
626
627
628
629
630
631
632
633
636
637
638
639
640
641
642
643
646
647
655
656
663
664
665
666
667
668
669
672 return getValue<
int>(d_ptr->m_values, property, 0);
676
677
678
679
682 return getMinimum<
int>(d_ptr->m_values, property, 0);
686
687
688
689
692 return getMaximum<
int>(d_ptr->m_values, property, 0);
696
697
698
699
700
701
704 return getData<
int>(d_ptr->m_values, &QtIntPropertyManagerPrivate::Data::singleStep, property, 0);
708
709
712 const auto it = d_ptr->m_values.constFind(property);
713 if (it == d_ptr->m_values.constEnd())
715 return QString::number(it.value().val);
719
720
721
722
723
724
725
726
727
728
731 void (QtIntPropertyManagerPrivate::*setSubPropertyValue)(
QtProperty *,
int) =
nullptr;
734 &QtIntPropertyManager::valueChanged,
735 property, val, setSubPropertyValue);
739
740
741
742
743
744
745
746
749 setMinimumValue<
int, QtIntPropertyManagerPrivate, QtIntPropertyManager,
int, QtIntPropertyManagerPrivate::Data>(
this, d_ptr.data(),
750 &QtIntPropertyManager::propertyChanged,
751 &QtIntPropertyManager::valueChanged,
752 &QtIntPropertyManager::rangeChanged,
757
758
759
760
761
762
763
764
767 setMaximumValue<
int, QtIntPropertyManagerPrivate, QtIntPropertyManager,
int, QtIntPropertyManagerPrivate::Data>(
this, d_ptr.data(),
768 &QtIntPropertyManager::propertyChanged,
769 &QtIntPropertyManager::valueChanged,
770 &QtIntPropertyManager::rangeChanged,
775
776
777
778
779
780
781
782
783
784
785
786
787
790 void (QtIntPropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *,
int,
int,
int) =
nullptr;
793 &QtIntPropertyManager::valueChanged,
795 property, minVal, maxVal, setSubPropertyRange);
799
800
801
802
803
804
807 const auto it = d_ptr->m_values.find(property);
808 if (it == d_ptr->m_values.end())
811 QtIntPropertyManagerPrivate::Data data = it.value();
816 if (data.singleStep == step)
819 data.singleStep = step;
823 emit singleStepChanged(property, data.singleStep);
827
828
831 d_ptr->m_values[property] = QtIntPropertyManagerPrivate::Data();
835
836
839 d_ptr->m_values.remove(property);
847 Q_DECLARE_PUBLIC(QtDoublePropertyManager)
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
893
894
895
896
897
898
899
900
903
904
905
906
907
908
909
910
913
914
915
916
917
918
919
920
923
924
925
926
927
928
929
930
933
934
942
943
950
951
952
953
954
955
956
959 return getValue<
double>(d_ptr->m_values, property, 0.0);
963
964
965
966
969 return getMinimum<
double>(d_ptr->m_values, property, 0.0);
973
974
975
976
979 return getMaximum<
double>(d_ptr->m_values, property, 0.0);
983
984
985
986
987
988
991 return getData<
double>(d_ptr->m_values, &QtDoublePropertyManagerPrivate::Data::singleStep, property, 0);
995
996
997
998
1001 return getData<
int>(d_ptr->m_values, &QtDoublePropertyManagerPrivate::Data::decimals, property, 0);
1005
1006
1009 const auto it = d_ptr->m_values.constFind(property);
1010 if (it == d_ptr->m_values.constEnd())
1012 return QString::number(it.value().val,
'f', it.value().decimals);
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1028 void (QtDoublePropertyManagerPrivate::*setSubPropertyValue)(
QtProperty *,
double) =
nullptr;
1031 &QtDoublePropertyManager::valueChanged,
1032 property, val, setSubPropertyValue);
1036
1037
1038
1039
1040
1041
1044 const auto it = d_ptr->m_values.find(property);
1045 if (it == d_ptr->m_values.end())
1048 QtDoublePropertyManagerPrivate::Data data = it.value();
1053 if (data.singleStep == step)
1056 data.singleStep = step;
1060 emit singleStepChanged(property, data.singleStep);
1064
1065
1066
1067
1068
1069
1070
1071
1074 const auto it = d_ptr->m_values.find(property);
1075 if (it == d_ptr->m_values.end())
1078 QtDoublePropertyManagerPrivate::Data data = it.value();
1085 if (data.decimals == prec)
1088 data.decimals = prec;
1092 emit decimalsChanged(property, data.decimals);
1096
1097
1098
1099
1100
1101
1102
1103
1106 setMinimumValue<
double, QtDoublePropertyManagerPrivate, QtDoublePropertyManager,
double, QtDoublePropertyManagerPrivate::Data>(
this, d_ptr.data(),
1107 &QtDoublePropertyManager::propertyChanged,
1108 &QtDoublePropertyManager::valueChanged,
1109 &QtDoublePropertyManager::rangeChanged,
1114
1115
1116
1117
1118
1119
1120
1121
1124 setMaximumValue<
double, QtDoublePropertyManagerPrivate, QtDoublePropertyManager,
double, QtDoublePropertyManagerPrivate::Data>(
this, d_ptr.data(),
1125 &QtDoublePropertyManager::propertyChanged,
1126 &QtDoublePropertyManager::valueChanged,
1127 &QtDoublePropertyManager::rangeChanged,
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1147 void (QtDoublePropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *,
double,
double,
double) =
nullptr;
1150 &QtDoublePropertyManager::valueChanged,
1152 property, minVal, maxVal, setSubPropertyRange);
1156
1157
1160 d_ptr->m_values[property] = QtDoublePropertyManagerPrivate::Data();
1164
1165
1168 d_ptr->m_values.remove(property);
1176 Q_DECLARE_PUBLIC(QtStringPropertyManager)
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1212
1213
1214
1215
1216
1217
1218
1219
1222
1223
1224
1225
1226
1227
1228
1229
1232
1233
1237 d_ptr->q_ptr =
this;
1241
1242
1249
1250
1251
1252
1253
1254
1255
1258 return getValue<QString>(d_ptr->m_values, property);
1262
1263
1264
1265
1266
1267
1268
1271 return getData<QRegularExpression>(d_ptr->m_values, &QtStringPropertyManagerPrivate::Data::regExp, property, QRegularExpression());
1275
1276
1279 const auto it = d_ptr->m_values.constFind(property);
1280 if (it == d_ptr->m_values.constEnd())
1282 return it.value().val;
1286
1287
1288
1289
1290
1291
1292
1293
1294
1297 const auto it = d_ptr->m_values.find(property);
1298 if (it == d_ptr->m_values.end())
1301 QtStringPropertyManagerPrivate::Data data = it.value();
1303 if (data.val == val)
1306 if (data.regExp.isValid() && !data.regExp.pattern().isEmpty()
1307 && !data.regExp.match(val).hasMatch()) {
1315 emit propertyChanged(property);
1316 emit valueChanged(property, data.val);
1320
1321
1322
1323
1326 const auto it = d_ptr->m_values.find(property);
1327 if (it == d_ptr->m_values.end())
1330 QtStringPropertyManagerPrivate::Data data = it.value() ;
1332 if (data.regExp == regExp)
1335 data.regExp = regExp;
1339 emit regExpChanged(property, data.regExp);
1343
1344
1347 d_ptr->m_values[property] = QtStringPropertyManagerPrivate::Data();
1351
1352
1355 d_ptr->m_values.remove(property);
1403 Q_DECLARE_PUBLIC(QtBoolPropertyManager)
1413 m_checkedIcon(
new QCheckBoxIconEngine(
true)),
1414 m_uncheckedIcon(
new QCheckBoxIconEngine(
false))
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1437
1438
1439
1440
1441
1442
1445
1446
1450 d_ptr->q_ptr =
this;
1454
1455
1462
1463
1464
1465
1466
1467
1468
1471 return d_ptr->m_values.value(property,
false);
1475
1476
1479 const auto it = d_ptr->m_values.constFind(property);
1480 if (it == d_ptr->m_values.constEnd())
1483 static const QString trueText = tr(
"True");
1484 static const QString falseText = tr(
"False");
1485 return it.value() ? trueText : falseText;
1489
1490
1493 const auto it = d_ptr->m_values.constFind(property);
1494 if (it == d_ptr->m_values.constEnd())
1497 return it.value() ? d_ptr->m_checkedIcon : d_ptr->m_uncheckedIcon;
1501
1502
1503
1504
1505
1506
1511 &QtBoolPropertyManager::valueChanged,
1516
1517
1520 d_ptr->m_values[property] =
false;
1524
1525
1528 d_ptr->m_values.remove(property);
1536 Q_DECLARE_PUBLIC(QtDatePropertyManager)
1558 m_format(QtPropertyBrowserUtils::dateFormat())
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1588
1589
1590
1591
1592
1593
1594
1595
1598
1599
1600
1601
1602
1603
1604
1605
1608
1609
1616
1617
1624
1625
1626
1627
1628
1629
1630
1633 return getValue<QDate>(d_ptr->m_values, property);
1637
1638
1639
1640
1643 return getMinimum<QDate>(d_ptr->m_values, property);
1647
1648
1649
1650
1653 return getMaximum<QDate>(d_ptr->m_values, property);
1657
1658
1661 const auto it = d_ptr->m_values.constFind(property);
1662 if (it == d_ptr->m_values.constEnd())
1664 return it.value().val.toString(d_ptr->m_format);
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1680 void (QtDatePropertyManagerPrivate::*setSubPropertyValue)(
QtProperty *, QDate) =
nullptr;
1683 &QtDatePropertyManager::valueChanged,
1684 property, val, setSubPropertyValue);
1688
1689
1690
1691
1692
1693
1694
1695
1700 &QtDatePropertyManager::valueChanged,
1706
1707
1708
1709
1710
1711
1712
1713
1718 &QtDatePropertyManager::valueChanged,
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1739 void (QtDatePropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *, QDate, QDate, QDate) =
nullptr;
1742 &QtDatePropertyManager::valueChanged,
1744 property, minVal, maxVal, setSubPropertyRange);
1748
1749
1752 d_ptr->m_values[property] = QtDatePropertyManagerPrivate::Data();
1756
1757
1760 d_ptr->m_values.remove(property);
1768 Q_DECLARE_PUBLIC(QtTimePropertyManager)
1779 m_format(QtPropertyBrowserUtils::timeFormat())
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1802
1803
1804
1805
1806
1807
1808
1809
1812
1813
1820
1821
1828
1829
1830
1831
1832
1833
1834
1837 return d_ptr->m_values.value(property, QTime());
1841
1842
1845 const auto it = d_ptr->m_values.constFind(property);
1846 if (it == d_ptr->m_values.constEnd())
1848 return it.value().toString(d_ptr->m_format);
1852
1853
1854
1855
1856
1857
1862 &QtTimePropertyManager::valueChanged,
1867
1868
1871 d_ptr->m_values[property] = QTime::currentTime();
1875
1876
1879 d_ptr->m_values.remove(property);
1887 Q_DECLARE_PUBLIC(QtDateTimePropertyManager)
1898 m_format(QtPropertyBrowserUtils::dateTimeFormat())
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1919
1920
1921
1922
1923
1924
1927
1928
1935
1936
1943
1944
1945
1946
1947
1948
1949
1952 return d_ptr->m_values.value(property, QDateTime());
1956
1957
1960 const auto it = d_ptr->m_values.constFind(property);
1961 if (it == d_ptr->m_values.constEnd())
1963 return it.value().toString(d_ptr->m_format);
1967
1968
1969
1970
1971
1972
1977 &QtDateTimePropertyManager::valueChanged,
1982
1983
1986 d_ptr->m_values[property] = QDateTime::currentDateTime();
1990
1991
1994 d_ptr->m_values.remove(property);
2002 Q_DECLARE_PUBLIC(QtKeySequencePropertyManager)
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2028
2029
2030
2031
2032
2033
2036
2037
2041 d_ptr->q_ptr =
this;
2045
2046
2053
2054
2055
2056
2057
2058
2059
2062 return d_ptr->m_values.value(property, QKeySequence());
2066
2067
2070 const auto it = d_ptr->m_values.constFind(property);
2071 if (it == d_ptr->m_values.constEnd())
2073 return it.value().toString(QKeySequence::NativeText);
2077
2078
2079
2080
2081
2082
2085 setSimpleValue<
const QKeySequence &, QKeySequence, QtKeySequencePropertyManager>(d_ptr->m_values,
this,
2086 &QtKeySequencePropertyManager::propertyChanged,
2087 &QtKeySequencePropertyManager::valueChanged,
2092
2093
2096 d_ptr->m_values[property] = QKeySequence();
2100
2101
2104 d_ptr->m_values.remove(property);
2112 Q_DECLARE_PUBLIC(QtCharPropertyManager)
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2136
2137
2138
2139
2140
2141
2144
2145
2149 d_ptr->q_ptr =
this;
2153
2154
2161
2162
2163
2164
2165
2166
2167
2170 return d_ptr->m_values.value(property, QChar());
2174
2175
2178 const auto it = d_ptr->m_values.constFind(property);
2179 if (it == d_ptr->m_values.constEnd())
2181 const QChar c = it.value();
2182 return c.isNull() ? QString() : QString(c);
2186
2187
2188
2189
2190
2191
2194 setSimpleValue<
const QChar &, QChar, QtCharPropertyManager>(d_ptr->m_values,
this,
2195 &QtCharPropertyManager::propertyChanged,
2196 &QtCharPropertyManager::valueChanged,
2201
2202
2205 d_ptr->m_values[property] = QChar();
2209
2210
2213 d_ptr->m_values.remove(property);
2221 Q_DECLARE_PUBLIC(QtLocalePropertyManager)
2240 if (
QtProperty *prop = m_languageToProperty.value(property,
nullptr)) {
2241 const QLocale loc = m_values[prop];
2242 QLocale::Language newLanguage = loc.language();
2243 QLocale::Territory newTerritory = loc.territory();
2244 metaEnumProvider()->indexToLocale(value, 0, &newLanguage,
nullptr);
2245 QLocale newLoc(newLanguage, newTerritory);
2246 q_ptr->setValue(prop, newLoc);
2247 }
else if (
QtProperty *prop = m_territoryToProperty.value(property,
nullptr)) {
2248 const QLocale loc = m_values[prop];
2249 QLocale::Language newLanguage = loc.language();
2250 QLocale::Territory newTerritory = loc.territory();
2252 QLocale newLoc(newLanguage, newTerritory);
2253 q_ptr->setValue(prop, newLoc);
2259 if (
QtProperty *subProp = m_languageToProperty.value(property,
nullptr)) {
2260 m_propertyToLanguage[subProp] =
nullptr;
2261 m_languageToProperty.remove(property);
2262 }
else if (
QtProperty *subProp = m_territoryToProperty.value(property,
nullptr)) {
2263 m_propertyToTerritory[subProp] =
nullptr;
2264 m_territoryToProperty.remove(property);
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2293
2294
2295
2296
2297
2298
2299
2300
2303
2304
2308 d_ptr->q_ptr =
this;
2310 d_ptr->m_enumPropertyManager =
new QtEnumPropertyManager(
this);
2311 connect(d_ptr->m_enumPropertyManager, &QtEnumPropertyManager::valueChanged,
this,
2312 [
this](
QtProperty *property,
int value) { d_ptr->slotEnumChanged(property, value); });
2314 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
2318
2319
2326
2327
2328
2329
2330
2331
2332
2333
2334
2337 return d_ptr->m_enumPropertyManager;
2341
2342
2343
2344
2345
2346
2347
2350 return d_ptr->m_values.value(property, QLocale());
2354
2355
2358 const auto it = d_ptr->m_values.constFind(property);
2359 if (it == d_ptr->m_values.constEnd())
2362 const QLocale &loc = it.value();
2365 int territoryIdx = 0;
2367 me->localeToIndex(loc.language(), loc.territory(), &langIdx, &territoryIdx);
2369 qWarning(
"QtLocalePropertyManager::valueText: Unknown language %d", loc.language());
2370 return tr(
"<Invalid>");
2372 QString languageName = me->languageEnumNames().at(langIdx);
2373 if (territoryIdx < 0) {
2374 qWarning(
"QtLocalePropertyManager::valueText: Unknown territory %d for %s", loc.territory(), qPrintable(languageName));
2375 return languageName;
2377 const QString territoryName = me->territoryEnumNames(loc.language()).at(territoryIdx);
2378 return tr(
"%1, %2").arg(languageName, territoryName);
2382
2383
2384
2385
2386
2387
2388
2391 const auto it = d_ptr->m_values.find(property);
2392 if (it == d_ptr->m_values.end())
2395 const QLocale &loc = it.value();
2402 int territoryIdx = 0;
2403 metaEnumProvider()->localeToIndex(val.language(), val.territory(), &langIdx, &territoryIdx);
2404 if (loc.language() != val.language()) {
2405 d_ptr->m_enumPropertyManager->setValue(d_ptr->m_propertyToLanguage.value(property), langIdx);
2406 d_ptr->m_enumPropertyManager->setEnumNames(d_ptr->m_propertyToTerritory.value(property),
2407 metaEnumProvider()->territoryEnumNames(val.language()));
2409 d_ptr->m_enumPropertyManager->setValue(d_ptr->m_propertyToTerritory.value(property), territoryIdx);
2411 emit propertyChanged(property);
2412 emit valueChanged(property, val);
2416
2417
2421 d_ptr->m_values[property] = val;
2424 int territoryIdx = 0;
2425 metaEnumProvider()->localeToIndex(val.language(), val.territory(), &langIdx, &territoryIdx);
2427 QtProperty *languageProp = d_ptr->m_enumPropertyManager->addProperty();
2428 languageProp->setPropertyName(tr(
"Language"));
2429 d_ptr->m_enumPropertyManager->setEnumNames(languageProp, metaEnumProvider()->languageEnumNames());
2430 d_ptr->m_enumPropertyManager->setValue(languageProp, langIdx);
2431 d_ptr->m_propertyToLanguage[property] = languageProp;
2432 d_ptr->m_languageToProperty[languageProp] = property;
2435 QtProperty *territoryProp = d_ptr->m_enumPropertyManager->addProperty();
2436 territoryProp->setPropertyName(tr(
"Territory"));
2437 d_ptr->m_enumPropertyManager->setEnumNames(territoryProp, metaEnumProvider()->territoryEnumNames(val.language()));
2438 d_ptr->m_enumPropertyManager->setValue(territoryProp, territoryIdx);
2439 d_ptr->m_propertyToTerritory[property] = territoryProp;
2440 d_ptr->m_territoryToProperty[territoryProp] = property;
2445
2446
2449 QtProperty *languageProp = d_ptr->m_propertyToLanguage[property];
2451 d_ptr->m_languageToProperty.remove(languageProp);
2452 delete languageProp;
2454 d_ptr->m_propertyToLanguage.remove(property);
2456 QtProperty *territoryProp = d_ptr->m_propertyToTerritory[property];
2457 if (territoryProp) {
2458 d_ptr->m_territoryToProperty.remove(territoryProp);
2459 delete territoryProp;
2461 d_ptr->m_propertyToTerritory.remove(property);
2463 d_ptr->m_values.remove(property);
2471 Q_DECLARE_PUBLIC(QtPointPropertyManager)
2490 if (
QtProperty *xprop = m_xToProperty.value(property,
nullptr)) {
2491 QPoint p = m_values[xprop];
2493 q_ptr->setValue(xprop, p);
2494 }
else if (
QtProperty *yprop = m_yToProperty.value(property,
nullptr)) {
2495 QPoint p = m_values[yprop];
2497 q_ptr->setValue(yprop, p);
2503 if (
QtProperty *pointProp = m_xToProperty.value(property,
nullptr)) {
2504 m_propertyToX[pointProp] =
nullptr;
2505 m_xToProperty.remove(property);
2506 }
else if (
QtProperty *pointProp = m_yToProperty.value(property,
nullptr)) {
2507 m_propertyToY[pointProp] =
nullptr;
2508 m_yToProperty.remove(property);
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2536
2537
2538
2539
2540
2541
2542
2543
2546
2547
2551 d_ptr->q_ptr =
this;
2553 d_ptr->m_intPropertyManager =
new QtIntPropertyManager(
this);
2554 connect(d_ptr->m_intPropertyManager, &QtIntPropertyManager::valueChanged,
this,
2555 [
this](
QtProperty *property,
int value) { d_ptr->slotIntChanged(property, value); });
2557 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
2561
2562
2569
2570
2571
2572
2573
2574
2575
2576
2577
2580 return d_ptr->m_intPropertyManager;
2584
2585
2586
2587
2588
2589
2590
2593 return d_ptr->m_values.value(property, QPoint());
2597
2598
2601 const auto it = d_ptr->m_values.constFind(property);
2602 if (it == d_ptr->m_values.constEnd())
2604 const QPoint v = it.value();
2605 return tr(
"(%1, %2)").arg(v.x()).arg(v.y());
2609
2610
2611
2612
2613
2614
2615
2618 const auto it = d_ptr->m_values.find(property);
2619 if (it == d_ptr->m_values.end())
2622 if (it.value() == val)
2626 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToX[property], val.x());
2627 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToY[property], val.y());
2629 emit propertyChanged(property);
2630 emit valueChanged(property, val);
2634
2635
2638 d_ptr->m_values[property] = QPoint(0, 0);
2640 QtProperty *xProp = d_ptr->m_intPropertyManager->addProperty();
2641 xProp->setPropertyName(tr(
"X"));
2642 d_ptr->m_intPropertyManager->setValue(xProp, 0);
2643 d_ptr->m_propertyToX[property] = xProp;
2644 d_ptr->m_xToProperty[xProp] = property;
2647 QtProperty *yProp = d_ptr->m_intPropertyManager->addProperty();
2648 yProp->setPropertyName(tr(
"Y"));
2649 d_ptr->m_intPropertyManager->setValue(yProp, 0);
2650 d_ptr->m_propertyToY[property] = yProp;
2651 d_ptr->m_yToProperty[yProp] = property;
2656
2657
2660 QtProperty *xProp = d_ptr->m_propertyToX[property];
2662 d_ptr->m_xToProperty.remove(xProp);
2665 d_ptr->m_propertyToX.remove(property);
2667 QtProperty *yProp = d_ptr->m_propertyToY[property];
2669 d_ptr->m_yToProperty.remove(yProp);
2672 d_ptr->m_propertyToY.remove(property);
2674 d_ptr->m_values.remove(property);
2682 Q_DECLARE_PUBLIC(QtPointFPropertyManager)
2707 if (
QtProperty *prop = m_xToProperty.value(property,
nullptr)) {
2708 QPointF p = m_values[prop].val;
2710 q_ptr->setValue(prop, p);
2711 }
else if (
QtProperty *prop = m_yToProperty.value(property,
nullptr)) {
2712 QPointF p = m_values[prop].val;
2714 q_ptr->setValue(prop, p);
2720 if (
QtProperty *pointProp = m_xToProperty.value(property,
nullptr)) {
2721 m_propertyToX[pointProp] =
nullptr;
2722 m_xToProperty.remove(property);
2723 }
else if (
QtProperty *pointProp = m_yToProperty.value(property,
nullptr)) {
2724 m_propertyToY[pointProp] =
nullptr;
2725 m_yToProperty.remove(property);
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2753
2754
2755
2756
2757
2758
2759
2760
2763
2764
2765
2766
2767
2768
2769
2770
2773
2774
2778 d_ptr->q_ptr =
this;
2780 d_ptr->m_doublePropertyManager =
new QtDoublePropertyManager(
this);
2781 connect(d_ptr->m_doublePropertyManager, &QtDoublePropertyManager::valueChanged,
this,
2782 [
this](
QtProperty *property,
double value) { d_ptr->slotDoubleChanged(property, value); });
2784 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
2788
2789
2796
2797
2798
2799
2800
2801
2802
2803
2804
2807 return d_ptr->m_doublePropertyManager;
2811
2812
2813
2814
2815
2816
2817
2820 return getValue<QPointF>(d_ptr->m_values, property);
2824
2825
2826
2827
2830 return getData<
int>(d_ptr->m_values, &QtPointFPropertyManagerPrivate::Data::decimals, property, 0);
2834
2835
2838 const auto it = d_ptr->m_values.constFind(property);
2839 if (it == d_ptr->m_values.constEnd())
2841 const QPointF v = it.value().val;
2842 const int dec = it.value().decimals;
2843 return tr(
"(%1, %2)").arg(QString::number(v.x(),
'f', dec),
2844 QString::number(v.y(),
'f', dec));
2848
2849
2850
2851
2852
2853
2854
2857 const auto it = d_ptr->m_values.find(property);
2858 if (it == d_ptr->m_values.end())
2861 if (it.value().val == val)
2864 it.value().val = val;
2865 d_ptr->m_doublePropertyManager->setValue(d_ptr->m_propertyToX[property], val.x());
2866 d_ptr->m_doublePropertyManager->setValue(d_ptr->m_propertyToY[property], val.y());
2868 emit propertyChanged(property);
2869 emit valueChanged(property, val);
2873
2874
2875
2876
2877
2878
2879
2880
2883 const auto it = d_ptr->m_values.find(property);
2884 if (it == d_ptr->m_values.end())
2887 QtPointFPropertyManagerPrivate::Data data = it.value();
2894 if (data.decimals == prec)
2897 data.decimals = prec;
2898 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToX[property], prec);
2899 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToY[property], prec);
2903 emit decimalsChanged(property, data.decimals);
2907
2908
2911 d_ptr->m_values[property] = QtPointFPropertyManagerPrivate::Data();
2913 QtProperty *xProp = d_ptr->m_doublePropertyManager->addProperty();
2914 xProp->setPropertyName(tr(
"X"));
2915 d_ptr->m_doublePropertyManager->setDecimals(xProp, decimals(property));
2916 d_ptr->m_doublePropertyManager->setValue(xProp, 0);
2917 d_ptr->m_propertyToX[property] = xProp;
2918 d_ptr->m_xToProperty[xProp] = property;
2921 QtProperty *yProp = d_ptr->m_doublePropertyManager->addProperty();
2922 yProp->setPropertyName(tr(
"Y"));
2923 d_ptr->m_doublePropertyManager->setDecimals(yProp, decimals(property));
2924 d_ptr->m_doublePropertyManager->setValue(yProp, 0);
2925 d_ptr->m_propertyToY[property] = yProp;
2926 d_ptr->m_yToProperty[yProp] = property;
2931
2932
2935 QtProperty *xProp = d_ptr->m_propertyToX[property];
2937 d_ptr->m_xToProperty.remove(xProp);
2940 d_ptr->m_propertyToX.remove(property);
2942 QtProperty *yProp = d_ptr->m_propertyToY[property];
2944 d_ptr->m_yToProperty.remove(yProp);
2947 d_ptr->m_propertyToY.remove(property);
2949 d_ptr->m_values.remove(property);
2957 Q_DECLARE_PUBLIC(QtSizePropertyManager)
2964 QSize minVal, QSize maxVal, QSize val);
2990 if (
QtProperty *prop = m_wToProperty.value(property,
nullptr)) {
2991 QSize s = m_values[prop].val;
2993 q_ptr->setValue(prop, s);
2994 }
else if (
QtProperty *prop = m_hToProperty.value(property,
nullptr)) {
2995 QSize s = m_values[prop].val;
2997 q_ptr->setValue(prop, s);
3003 if (
QtProperty *pointProp = m_wToProperty.value(property,
nullptr)) {
3004 m_propertyToW[pointProp] =
nullptr;
3005 m_wToProperty.remove(property);
3006 }
else if (
QtProperty *pointProp = m_hToProperty.value(property,
nullptr)) {
3007 m_propertyToH[pointProp] =
nullptr;
3008 m_hToProperty.remove(property);
3019 QSize minVal, QSize maxVal, QSize val)
3021 QtProperty *wProperty = m_propertyToW.value(property);
3022 QtProperty *hProperty = m_propertyToH.value(property);
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3062
3063
3064
3065
3066
3067
3068
3069
3072
3073
3074
3075
3076
3077
3078
3079
3082
3083
3087 d_ptr->q_ptr =
this;
3089 d_ptr->m_intPropertyManager =
new QtIntPropertyManager(
this);
3090 connect(d_ptr->m_intPropertyManager, &QtIntPropertyManager::valueChanged,
this,
3091 [
this](
QtProperty *property,
int value) { d_ptr->slotIntChanged(property, value); });
3093 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
3097
3098
3105
3106
3107
3108
3109
3110
3111
3112
3113
3116 return d_ptr->m_intPropertyManager;
3120
3121
3122
3123
3124
3125
3126
3129 return getValue<QSize>(d_ptr->m_values, property);
3133
3134
3135
3136
3139 return getMinimum<QSize>(d_ptr->m_values, property);
3143
3144
3145
3146
3149 return getMaximum<QSize>(d_ptr->m_values, property);
3153
3154
3157 const auto it = d_ptr->m_values.constFind(property);
3158 if (it == d_ptr->m_values.constEnd())
3160 const QSize v = it.value().val;
3161 return tr(
"%1 x %2").arg(v.width()).arg(v.height());
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3177 setValueInRange<QSize, QtSizePropertyManagerPrivate, QtSizePropertyManager,
const QSize>(
this, d_ptr.data(),
3178 &QtSizePropertyManager::propertyChanged,
3179 &QtSizePropertyManager::valueChanged,
3180 property, val, &QtSizePropertyManagerPrivate::setValue);
3184
3185
3186
3187
3188
3189
3190
3191
3194 setBorderValue<QSize, QtSizePropertyManagerPrivate, QtSizePropertyManager, QSize, QtSizePropertyManagerPrivate::Data>(
this, d_ptr.data(),
3195 &QtSizePropertyManager::propertyChanged,
3196 &QtSizePropertyManager::valueChanged,
3197 &QtSizePropertyManager::rangeChanged,
3199 &QtSizePropertyManagerPrivate::Data::minimumValue,
3200 &QtSizePropertyManagerPrivate::Data::setMinimumValue,
3201 minVal, &QtSizePropertyManagerPrivate::setRange);
3205
3206
3207
3208
3209
3210
3211
3212
3215 setBorderValue<QSize, QtSizePropertyManagerPrivate, QtSizePropertyManager, QSize, QtSizePropertyManagerPrivate::Data>(
this, d_ptr.data(),
3216 &QtSizePropertyManager::propertyChanged,
3217 &QtSizePropertyManager::valueChanged,
3218 &QtSizePropertyManager::rangeChanged,
3220 &QtSizePropertyManagerPrivate::Data::maximumValue,
3221 &QtSizePropertyManagerPrivate::Data::setMaximumValue,
3222 maxVal, &QtSizePropertyManagerPrivate::setRange);
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3241 setBorderValues<QSize, QtSizePropertyManagerPrivate, QtSizePropertyManager, QSize>(
this, d_ptr.data(),
3242 &QtSizePropertyManager::propertyChanged,
3243 &QtSizePropertyManager::valueChanged,
3244 &QtSizePropertyManager::rangeChanged,
3245 property, minVal, maxVal, &QtSizePropertyManagerPrivate::setRange);
3249
3250
3253 d_ptr->m_values[property] = QtSizePropertyManagerPrivate::Data();
3255 QtProperty *wProp = d_ptr->m_intPropertyManager->addProperty();
3256 wProp->setPropertyName(tr(
"Width"));
3257 d_ptr->m_intPropertyManager->setValue(wProp, 0);
3258 d_ptr->m_intPropertyManager->setMinimum(wProp, 0);
3259 d_ptr->m_propertyToW[property] = wProp;
3260 d_ptr->m_wToProperty[wProp] = property;
3263 QtProperty *hProp = d_ptr->m_intPropertyManager->addProperty();
3264 hProp->setPropertyName(tr(
"Height"));
3265 d_ptr->m_intPropertyManager->setValue(hProp, 0);
3266 d_ptr->m_intPropertyManager->setMinimum(hProp, 0);
3267 d_ptr->m_propertyToH[property] = hProp;
3268 d_ptr->m_hToProperty[hProp] = property;
3273
3274
3277 QtProperty *wProp = d_ptr->m_propertyToW[property];
3279 d_ptr->m_wToProperty.remove(wProp);
3282 d_ptr->m_propertyToW.remove(property);
3284 QtProperty *hProp = d_ptr->m_propertyToH[property];
3286 d_ptr->m_hToProperty.remove(hProp);
3289 d_ptr->m_propertyToH.remove(property);
3291 d_ptr->m_values.remove(property);
3299 Q_DECLARE_PUBLIC(QtSizeFPropertyManager)
3306 QSizeF minVal, QSizeF maxVal, QSizeF val);
3333 if (
QtProperty *prop = m_wToProperty.value(property,
nullptr)) {
3334 QSizeF s = m_values[prop].val;
3336 q_ptr->setValue(prop, s);
3337 }
else if (
QtProperty *prop = m_hToProperty.value(property,
nullptr)) {
3338 QSizeF s = m_values[prop].val;
3340 q_ptr->setValue(prop, s);
3346 if (
QtProperty *pointProp = m_wToProperty.value(property,
nullptr)) {
3347 m_propertyToW[pointProp] =
nullptr;
3348 m_wToProperty.remove(property);
3349 }
else if (
QtProperty *pointProp = m_hToProperty.value(property,
nullptr)) {
3350 m_propertyToH[pointProp] =
nullptr;
3351 m_hToProperty.remove(property);
3362 QSizeF minVal, QSizeF maxVal, QSizeF val)
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3403
3404
3405
3406
3407
3408
3409
3410
3413
3414
3415
3416
3417
3418
3419
3420
3423
3424
3425
3426
3427
3428
3429
3430
3433
3434
3438 d_ptr->q_ptr =
this;
3440 d_ptr->m_doublePropertyManager =
new QtDoublePropertyManager(
this);
3441 connect(d_ptr->m_doublePropertyManager, &QtDoublePropertyManager::valueChanged,
this,
3442 [
this](
QtProperty *property,
double value) { d_ptr->slotDoubleChanged(property, value); });
3444 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
3448
3449
3456
3457
3458
3459
3460
3461
3462
3463
3464
3467 return d_ptr->m_doublePropertyManager;
3471
3472
3473
3474
3475
3476
3477
3480 return getValue<QSizeF>(d_ptr->m_values, property);
3484
3485
3486
3487
3494
3495
3496
3497
3500 return getMinimum<QSizeF>(d_ptr->m_values, property);
3504
3505
3506
3507
3510 return getMaximum<QSizeF>(d_ptr->m_values, property);
3514
3515
3518 const auto it = d_ptr->m_values.constFind(property);
3519 if (it == d_ptr->m_values.constEnd())
3521 const QSizeF v = it.value().val;
3522 const int dec = it.value().decimals;
3523 return tr(
"%1 x %2").arg(QString::number(v.width(),
'f', dec),
3524 QString::number(v.height(),
'f', dec));
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3540 setValueInRange<QSizeF, QtSizeFPropertyManagerPrivate, QtSizeFPropertyManager, QSizeF>(
this, d_ptr.data(),
3541 &QtSizeFPropertyManager::propertyChanged,
3542 &QtSizeFPropertyManager::valueChanged,
3543 property, val, &QtSizeFPropertyManagerPrivate::setValue);
3547
3548
3549
3550
3551
3552
3553
3554
3557 const auto it = d_ptr->m_values.find(property);
3558 if (it == d_ptr->m_values.end())
3572 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToW[property], prec);
3573 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToH[property], prec);
3577 emit decimalsChanged(property, data
.decimals);
3581
3582
3583
3584
3585
3586
3587
3588
3591 setBorderValue<QSizeF, QtSizeFPropertyManagerPrivate, QtSizeFPropertyManager, QSizeF, QtSizeFPropertyManagerPrivate::Data>(
this, d_ptr.data(),
3592 &QtSizeFPropertyManager::propertyChanged,
3593 &QtSizeFPropertyManager::valueChanged,
3594 &QtSizeFPropertyManager::rangeChanged,
3596 &QtSizeFPropertyManagerPrivate::Data::minimumValue,
3597 &QtSizeFPropertyManagerPrivate::Data::setMinimumValue,
3598 minVal, &QtSizeFPropertyManagerPrivate::setRange);
3602
3603
3604
3605
3606
3607
3608
3609
3612 setBorderValue<QSizeF, QtSizeFPropertyManagerPrivate, QtSizeFPropertyManager, QSizeF, QtSizeFPropertyManagerPrivate::Data>(
this, d_ptr.data(),
3613 &QtSizeFPropertyManager::propertyChanged,
3614 &QtSizeFPropertyManager::valueChanged,
3615 &QtSizeFPropertyManager::rangeChanged,
3617 &QtSizeFPropertyManagerPrivate::Data::maximumValue,
3618 &QtSizeFPropertyManagerPrivate::Data::setMaximumValue,
3619 maxVal, &QtSizeFPropertyManagerPrivate::setRange);
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3638 setBorderValues<QSizeF, QtSizeFPropertyManagerPrivate, QtSizeFPropertyManager, QSizeF>(
this, d_ptr.data(),
3639 &QtSizeFPropertyManager::propertyChanged,
3640 &QtSizeFPropertyManager::valueChanged,
3641 &QtSizeFPropertyManager::rangeChanged,
3642 property, minVal, maxVal, &QtSizeFPropertyManagerPrivate::setRange);
3646
3647
3650 d_ptr->m_values[property] = QtSizeFPropertyManagerPrivate::Data();
3652 QtProperty *wProp = d_ptr->m_doublePropertyManager->addProperty();
3653 wProp->setPropertyName(tr(
"Width"));
3654 d_ptr->m_doublePropertyManager->setDecimals(wProp, decimals(property));
3655 d_ptr->m_doublePropertyManager->setValue(wProp, 0);
3656 d_ptr->m_doublePropertyManager->setMinimum(wProp, 0);
3657 d_ptr->m_propertyToW[property] = wProp;
3658 d_ptr->m_wToProperty[wProp] = property;
3661 QtProperty *hProp = d_ptr->m_doublePropertyManager->addProperty();
3662 hProp->setPropertyName(tr(
"Height"));
3663 d_ptr->m_doublePropertyManager->setDecimals(hProp, decimals(property));
3664 d_ptr->m_doublePropertyManager->setValue(hProp, 0);
3665 d_ptr->m_doublePropertyManager->setMinimum(hProp, 0);
3666 d_ptr->m_propertyToH[property] = hProp;
3667 d_ptr->m_hToProperty[hProp] = property;
3672
3673
3676 QtProperty *wProp = d_ptr->m_propertyToW[property];
3678 d_ptr->m_wToProperty.remove(wProp);
3681 d_ptr->m_propertyToW.remove(property);
3683 QtProperty *hProp = d_ptr->m_propertyToH[property];
3685 d_ptr->m_hToProperty.remove(hProp);
3688 d_ptr->m_propertyToH.remove(property);
3690 d_ptr->m_values.remove(property);
3698 Q_DECLARE_PUBLIC(QtRectPropertyManager)
3728 if (
QtProperty *prop = m_xToProperty.value(property,
nullptr)) {
3729 QRect r = m_values[prop].val;
3731 q_ptr->setValue(prop, r);
3732 }
else if (
QtProperty *prop = m_yToProperty.value(property)) {
3733 QRect r = m_values[prop].val;
3735 q_ptr->setValue(prop, r);
3736 }
else if (
QtProperty *prop = m_wToProperty.value(property,
nullptr)) {
3737 Data data = m_values[prop];
3740 if (!data.constraint.isNull() && data.constraint.x() + data.constraint.width() < r.x() + r.width()) {
3741 r.moveLeft(data.constraint.left() + data.constraint.width() - r.width());
3743 q_ptr->setValue(prop, r);
3744 }
else if (
QtProperty *prop = m_hToProperty.value(property,
nullptr)) {
3745 Data data = m_values[prop];
3748 if (!data.constraint.isNull() && data.constraint.y() + data.constraint.height() < r.y() + r.height()) {
3749 r.moveTop(data.constraint.top() + data.constraint.height() - r.height());
3751 q_ptr->setValue(prop, r);
3757 if (
QtProperty *pointProp = m_xToProperty.value(property,
nullptr)) {
3758 m_propertyToX[pointProp] =
nullptr;
3759 m_xToProperty.remove(property);
3760 }
else if (
QtProperty *pointProp = m_yToProperty.value(property,
nullptr)) {
3761 m_propertyToY[pointProp] =
nullptr;
3762 m_yToProperty.remove(property);
3763 }
else if (
QtProperty *pointProp = m_wToProperty.value(property,
nullptr)) {
3764 m_propertyToW[pointProp] =
nullptr;
3765 m_wToProperty.remove(property);
3766 }
else if (
QtProperty *pointProp = m_hToProperty.value(property,
nullptr)) {
3767 m_propertyToH[pointProp] =
nullptr;
3768 m_hToProperty.remove(property);
3773 QRect constraint, QRect val)
3775 const bool isNull = constraint.isNull();
3776 const int left = isNull ?
std::numeric_limits<
int>::min() : constraint.left();
3777 const int right = isNull
3778 ?
std::numeric_limits<
int>::max() : constraint.left() + constraint.width();
3779 const int top = isNull ?
std::numeric_limits<
int>::min() : constraint.top();
3780 const int bottom = isNull
3781 ?
std::numeric_limits<
int>::max() : constraint.top() + constraint.height();
3782 const int width = isNull ?
std::numeric_limits<
int>::max() : constraint.width();
3783 const int height = isNull ?
std::numeric_limits<
int>::max() : constraint.height();
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3827
3828
3829
3830
3831
3832
3833
3834
3837
3838
3839
3840
3841
3842
3843
3844
3847
3848
3852 d_ptr->q_ptr =
this;
3854 d_ptr->m_intPropertyManager =
new QtIntPropertyManager(
this);
3855 connect(d_ptr->m_intPropertyManager, &QtIntPropertyManager::valueChanged,
this,
3856 [
this](
QtProperty *property,
int value) { d_ptr->slotIntChanged(property, value); });
3858 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
3862
3863
3870
3871
3872
3873
3874
3875
3876
3877
3878
3881 return d_ptr->m_intPropertyManager;
3885
3886
3887
3888
3889
3890
3891
3894 return getValue<QRect>(d_ptr->m_values, property);
3898
3899
3900
3901
3904 return getData<QRect>(d_ptr->m_values, &QtRectPropertyManagerPrivate::Data::constraint, property, QRect());
3908
3909
3912 const auto it = d_ptr->m_values.constFind(property);
3913 if (it == d_ptr->m_values.constEnd())
3915 const QRect v = it.value().val;
3916 return tr(
"[(%1, %2), %3 x %4]").arg(v.x()) .arg(v.y())
3917 .arg(v.width()).arg(v.height());
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3934 const auto it = d_ptr->m_values.find(property);
3935 if (it == d_ptr->m_values.end())
3940 QRect newRect = val.normalized();
3941 if (!data.constraint.isNull() && !data.constraint.contains(newRect)) {
3942 const QRect r1 = data.constraint;
3943 const QRect r2 = newRect;
3944 newRect.setLeft(qMax(r1.left(), r2.left()));
3945 newRect.setRight(qMin(r1.right(), r2.right()));
3946 newRect.setTop(qMax(r1.top(), r2.top()));
3947 newRect.setBottom(qMin(r1.bottom(), r2.bottom()));
3948 if (newRect.width() < 0 || newRect.height() < 0)
3952 if (data.val == newRect)
3958 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToX[property], newRect.x());
3959 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToY[property], newRect.y());
3960 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToW[property], newRect.width());
3961 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToH[property], newRect.height());
3963 emit propertyChanged(property);
3964 emit valueChanged(property, data.val);
3968
3969
3970
3971
3972
3973
3974
3975
3976
3979 const auto it = d_ptr->m_values.find(property);
3980 if (it == d_ptr->m_values.end())
3985 QRect newConstraint = constraint.normalized();
3986 if (data.constraint == newConstraint)
3989 const QRect oldVal = data.val;
3991 data.constraint = newConstraint;
3993 if (!data.constraint.isNull() && !data.constraint.contains(oldVal)) {
3994 QRect r1 = data.constraint;
3995 QRect r2 = data.val;
3997 if (r2.width() > r1.width())
3998 r2.setWidth(r1.width());
3999 if (r2.height() > r1.height())
4000 r2.setHeight(r1.height());
4001 if (r2.left() < r1.left())
4002 r2.moveLeft(r1.left());
4003 else if (r2.right() > r1.right())
4004 r2.moveRight(r1.right());
4005 if (r2.top() < r1.top())
4006 r2.moveTop(r1.top());
4007 else if (r2.bottom() > r1.bottom())
4008 r2.moveBottom(r1.bottom());
4015 emit constraintChanged(property, data.constraint);
4017 d_ptr->setConstraint(property, data.constraint, data.val);
4019 if (data.val == oldVal)
4022 emit propertyChanged(property);
4023 emit valueChanged(property, data.val);
4027
4028
4031 d_ptr->m_values[property] = QtRectPropertyManagerPrivate::Data();
4033 QtProperty *xProp = d_ptr->m_intPropertyManager->addProperty();
4034 xProp->setPropertyName(tr(
"X"));
4035 d_ptr->m_intPropertyManager->setValue(xProp, 0);
4036 d_ptr->m_propertyToX[property] = xProp;
4037 d_ptr->m_xToProperty[xProp] = property;
4040 QtProperty *yProp = d_ptr->m_intPropertyManager->addProperty();
4041 yProp->setPropertyName(tr(
"Y"));
4042 d_ptr->m_intPropertyManager->setValue(yProp, 0);
4043 d_ptr->m_propertyToY[property] = yProp;
4044 d_ptr->m_yToProperty[yProp] = property;
4047 QtProperty *wProp = d_ptr->m_intPropertyManager->addProperty();
4048 wProp->setPropertyName(tr(
"Width"));
4049 d_ptr->m_intPropertyManager->setValue(wProp, 0);
4050 d_ptr->m_intPropertyManager->setMinimum(wProp, 0);
4051 d_ptr->m_propertyToW[property] = wProp;
4052 d_ptr->m_wToProperty[wProp] = property;
4055 QtProperty *hProp = d_ptr->m_intPropertyManager->addProperty();
4056 hProp->setPropertyName(tr(
"Height"));
4057 d_ptr->m_intPropertyManager->setValue(hProp, 0);
4058 d_ptr->m_intPropertyManager->setMinimum(hProp, 0);
4059 d_ptr->m_propertyToH[property] = hProp;
4060 d_ptr->m_hToProperty[hProp] = property;
4065
4066
4069 QtProperty *xProp = d_ptr->m_propertyToX[property];
4071 d_ptr->m_xToProperty.remove(xProp);
4074 d_ptr->m_propertyToX.remove(property);
4076 QtProperty *yProp = d_ptr->m_propertyToY[property];
4078 d_ptr->m_yToProperty.remove(yProp);
4081 d_ptr->m_propertyToY.remove(property);
4083 QtProperty *wProp = d_ptr->m_propertyToW[property];
4085 d_ptr->m_wToProperty.remove(wProp);
4088 d_ptr->m_propertyToW.remove(property);
4090 QtProperty *hProp = d_ptr->m_propertyToH[property];
4092 d_ptr->m_hToProperty.remove(hProp);
4095 d_ptr->m_propertyToH.remove(property);
4097 d_ptr->m_values.remove(property);
4105 Q_DECLARE_PUBLIC(QtRectFPropertyManager)
4136 if (
QtProperty *prop = m_xToProperty.value(property,
nullptr)) {
4137 QRectF r = m_values[prop].val;
4139 q_ptr->setValue(prop, r);
4140 }
else if (
QtProperty *prop = m_yToProperty.value(property,
nullptr)) {
4141 QRectF r = m_values[prop].val;
4143 q_ptr->setValue(prop, r);
4144 }
else if (
QtProperty *prop = m_wToProperty.value(property,
nullptr)) {
4145 Data data = m_values[prop];
4146 QRectF r = data.val;
4148 if (!data.constraint.isNull() && data.constraint.x() + data.constraint.width() < r.x() + r.width()) {
4149 r.moveLeft(data.constraint.left() + data.constraint.width() - r.width());
4151 q_ptr->setValue(prop, r);
4152 }
else if (
QtProperty *prop = m_hToProperty.value(property,
nullptr)) {
4153 Data data = m_values[prop];
4154 QRectF r = data.val;
4156 if (!data.constraint.isNull() && data.constraint.y() + data.constraint.height() < r.y() + r.height()) {
4157 r.moveTop(data.constraint.top() + data.constraint.height() - r.height());
4159 q_ptr->setValue(prop, r);
4165 if (
QtProperty *pointProp = m_xToProperty.value(property,
nullptr)) {
4166 m_propertyToX[pointProp] =
nullptr;
4167 m_xToProperty.remove(property);
4168 }
else if (
QtProperty *pointProp = m_yToProperty.value(property,
nullptr)) {
4169 m_propertyToY[pointProp] =
nullptr;
4170 m_yToProperty.remove(property);
4171 }
else if (
QtProperty *pointProp = m_wToProperty.value(property,
nullptr)) {
4172 m_propertyToW[pointProp] =
nullptr;
4173 m_wToProperty.remove(property);
4174 }
else if (
QtProperty *pointProp = m_hToProperty.value(property,
nullptr)) {
4175 m_propertyToH[pointProp] =
nullptr;
4176 m_hToProperty.remove(property);
4181 const QRectF &constraint,
const QRectF &val)
4183 const bool isNull = constraint.isNull();
4184 const float left = isNull ?
std::numeric_limits<
float>::lowest() : constraint.left();
4185 const float right = isNull
4186 ?
std::numeric_limits<
float>::max() : constraint.left() + constraint.width();
4187 const float top = isNull ?
std::numeric_limits<
float>::lowest() : constraint.top();
4188 const float bottom = isNull
4189 ?
std::numeric_limits<
float>::max() : constraint.top() + constraint.height();
4190 const float width = isNull ?
std::numeric_limits<
float>::max() : constraint.width();
4191 const float height = isNull ?
std::numeric_limits<
float>::max() : constraint.height();
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4235
4236
4237
4238
4239
4240
4241
4242
4245
4246
4247
4248
4249
4250
4251
4252
4255
4256
4257
4258
4259
4260
4261
4262
4265
4266
4270 d_ptr->q_ptr =
this;
4272 d_ptr->m_doublePropertyManager =
new QtDoublePropertyManager(
this);
4273 connect(d_ptr->m_doublePropertyManager, &QtDoublePropertyManager::valueChanged,
this,
4274 [
this](
QtProperty *property,
double value) { d_ptr->slotDoubleChanged(property, value); });
4276 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
4280
4281
4288
4289
4290
4291
4292
4293
4294
4295
4296
4299 return d_ptr->m_doublePropertyManager;
4303
4304
4305
4306
4307
4308
4309
4312 return getValue<QRectF>(d_ptr->m_values, property);
4316
4317
4318
4319
4326
4327
4328
4329
4332 return getData<QRectF>(d_ptr->m_values, &QtRectFPropertyManagerPrivate::Data::constraint, property, QRect());
4336
4337
4340 const auto it = d_ptr->m_values.constFind(property);
4341 if (it == d_ptr->m_values.constEnd())
4343 const QRectF v = it.value().val;
4344 const int dec = it.value().decimals;
4345 return QString(tr(
"[(%1, %2), %3 x %4]").arg(QString::number(v.x(),
'f', dec),
4346 QString::number(v.y(),
'f', dec),
4347 QString::number(v.width(),
'f', dec),
4348 QString::number(v.height(),
'f', dec)));
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4365 const auto it = d_ptr->m_values.find(property);
4366 if (it == d_ptr->m_values.end())
4371 QRectF newRect = val.normalized();
4372 if (!data.constraint.isNull() && !data.constraint.contains(newRect)) {
4373 const QRectF r1 = data.constraint;
4374 const QRectF r2 = newRect;
4375 newRect.setLeft(qMax(r1.left(), r2.left()));
4376 newRect.setRight(qMin(r1.right(), r2.right()));
4377 newRect.setTop(qMax(r1.top(), r2.top()));
4378 newRect.setBottom(qMin(r1.bottom(), r2.bottom()));
4379 if (newRect.width() < 0 || newRect.height() < 0)
4383 if (data.val == newRect)
4389 d_ptr->m_doublePropertyManager->setValue(d_ptr->m_propertyToX[property], newRect.x());
4390 d_ptr->m_doublePropertyManager->setValue(d_ptr->m_propertyToY[property], newRect.y());
4391 d_ptr->m_doublePropertyManager->setValue(d_ptr->m_propertyToW[property], newRect.width());
4392 d_ptr->m_doublePropertyManager->setValue(d_ptr->m_propertyToH[property], newRect.height());
4394 emit propertyChanged(property);
4395 emit valueChanged(property, data.val);
4399
4400
4401
4402
4403
4404
4405
4406
4407
4410 const auto it = d_ptr->m_values.find(property);
4411 if (it == d_ptr->m_values.end())
4416 QRectF newConstraint = constraint.normalized();
4417 if (data.constraint == newConstraint)
4420 const QRectF oldVal = data.val;
4422 data.constraint = newConstraint;
4424 if (!data.constraint.isNull() && !data.constraint.contains(oldVal)) {
4425 QRectF r1 = data.constraint;
4426 QRectF r2 = data.val;
4428 if (r2.width() > r1.width())
4429 r2.setWidth(r1.width());
4430 if (r2.height() > r1.height())
4431 r2.setHeight(r1.height());
4432 if (r2.left() < r1.left())
4433 r2.moveLeft(r1.left());
4434 else if (r2.right() > r1.right())
4435 r2.moveRight(r1.right());
4436 if (r2.top() < r1.top())
4437 r2.moveTop(r1.top());
4438 else if (r2.bottom() > r1.bottom())
4439 r2.moveBottom(r1.bottom());
4446 emit constraintChanged(property, data.constraint);
4448 d_ptr->setConstraint(property, data.constraint, data.val);
4450 if (data.val == oldVal)
4453 emit propertyChanged(property);
4454 emit valueChanged(property, data.val);
4458
4459
4460
4461
4462
4463
4464
4465
4468 const auto it = d_ptr->m_values.find(property);
4469 if (it == d_ptr->m_values.end())
4483 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToX[property], prec);
4484 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToY[property], prec);
4485 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToW[property], prec);
4486 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToH[property], prec);
4490 emit decimalsChanged(property, data
.decimals);
4494
4495
4498 d_ptr->m_values[property] = QtRectFPropertyManagerPrivate::Data();
4500 QtProperty *xProp = d_ptr->m_doublePropertyManager->addProperty();
4501 xProp->setPropertyName(tr(
"X"));
4502 d_ptr->m_doublePropertyManager->setDecimals(xProp, decimals(property));
4503 d_ptr->m_doublePropertyManager->setValue(xProp, 0);
4504 d_ptr->m_propertyToX[property] = xProp;
4505 d_ptr->m_xToProperty[xProp] = property;
4508 QtProperty *yProp = d_ptr->m_doublePropertyManager->addProperty();
4509 yProp->setPropertyName(tr(
"Y"));
4510 d_ptr->m_doublePropertyManager->setDecimals(yProp, decimals(property));
4511 d_ptr->m_doublePropertyManager->setValue(yProp, 0);
4512 d_ptr->m_propertyToY[property] = yProp;
4513 d_ptr->m_yToProperty[yProp] = property;
4516 QtProperty *wProp = d_ptr->m_doublePropertyManager->addProperty();
4517 wProp->setPropertyName(tr(
"Width"));
4518 d_ptr->m_doublePropertyManager->setDecimals(wProp, decimals(property));
4519 d_ptr->m_doublePropertyManager->setValue(wProp, 0);
4520 d_ptr->m_doublePropertyManager->setMinimum(wProp, 0);
4521 d_ptr->m_propertyToW[property] = wProp;
4522 d_ptr->m_wToProperty[wProp] = property;
4525 QtProperty *hProp = d_ptr->m_doublePropertyManager->addProperty();
4526 hProp->setPropertyName(tr(
"Height"));
4527 d_ptr->m_doublePropertyManager->setDecimals(hProp, decimals(property));
4528 d_ptr->m_doublePropertyManager->setValue(hProp, 0);
4529 d_ptr->m_doublePropertyManager->setMinimum(hProp, 0);
4530 d_ptr->m_propertyToH[property] = hProp;
4531 d_ptr->m_hToProperty[hProp] = property;
4536
4537
4540 QtProperty *xProp = d_ptr->m_propertyToX[property];
4542 d_ptr->m_xToProperty.remove(xProp);
4545 d_ptr->m_propertyToX.remove(property);
4547 QtProperty *yProp = d_ptr->m_propertyToY[property];
4549 d_ptr->m_yToProperty.remove(yProp);
4552 d_ptr->m_propertyToY.remove(property);
4554 QtProperty *wProp = d_ptr->m_propertyToW[property];
4556 d_ptr->m_wToProperty.remove(wProp);
4559 d_ptr->m_propertyToW.remove(property);
4561 QtProperty *hProp = d_ptr->m_propertyToH[property];
4563 d_ptr->m_hToProperty.remove(hProp);
4566 d_ptr->m_propertyToH.remove(property);
4568 d_ptr->m_values.remove(property);
4576 Q_DECLARE_PUBLIC(QtEnumPropertyManager)
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4616
4617
4618
4619
4620
4621
4622
4623
4626
4627
4628
4629
4630
4631
4632
4633
4636
4637
4638
4639
4640
4641
4642
4643
4646
4647
4651 d_ptr->q_ptr =
this;
4655
4656
4663
4664
4665
4666
4667
4668
4669
4670
4673 return getValue<
int>(d_ptr->m_values, property, -1);
4677
4678
4679
4680
4683 return getData<QStringList>(d_ptr->m_values, &QtEnumPropertyManagerPrivate::Data::enumNames, property, QStringList());
4687
4688
4689
4690
4693 return getData<QMap<
int, QIcon> >(d_ptr->m_values, &QtEnumPropertyManagerPrivate::Data::enumIcons, property, QMap<
int, QIcon>());
4697
4698
4701 const auto it = d_ptr->m_values.constFind(property);
4702 if (it == d_ptr->m_values.constEnd())
4705 const QtEnumPropertyManagerPrivate::Data &data = it.value();
4707 const int v = data.val;
4708 if (v >= 0 && v < data.enumNames.size())
4709 return data.enumNames.at(v);
4714
4715
4718 const auto it = d_ptr->m_values.constFind(property);
4719 if (it == d_ptr->m_values.constEnd())
4722 const QtEnumPropertyManagerPrivate::Data &data = it.value();
4724 const int v = data.val;
4725 return data.enumIcons.value(v);
4729
4730
4731
4732
4733
4734
4735
4736
4737
4740 const auto it = d_ptr->m_values.find(property);
4741 if (it == d_ptr->m_values.end())
4744 QtEnumPropertyManagerPrivate::Data data = it.value();
4746 if (val >= data.enumNames.size())
4749 if (val < 0 && !data.enumNames.empty())
4755 if (data.val == val)
4762 emit propertyChanged(property);
4763 emit valueChanged(property, data.val);
4767
4768
4769
4770
4771
4772
4773
4774
4775
4778 const auto it = d_ptr->m_values.find(property);
4779 if (it == d_ptr->m_values.end())
4782 QtEnumPropertyManagerPrivate::Data data = it.value();
4784 if (data.enumNames == enumNames)
4787 data.enumNames = enumNames;
4791 if (!enumNames.empty())
4796 emit enumNamesChanged(property, data.enumNames);
4798 emit propertyChanged(property);
4799 emit valueChanged(property, data.val);
4803
4804
4805
4806
4807
4808
4809
4812 const auto it = d_ptr->m_values.find(property);
4813 if (it == d_ptr->m_values.end())
4816 it.value().enumIcons = enumIcons;
4818 emit enumIconsChanged(property, it.value().enumIcons);
4820 emit propertyChanged(property);
4824
4825
4828 d_ptr->m_values[property] = QtEnumPropertyManagerPrivate::Data();
4832
4833
4836 d_ptr->m_values.remove(property);
4844 Q_DECLARE_PUBLIC(QtFlagPropertyManager)
4867 QtProperty *prop = m_flagToProperty.value(property,
nullptr);
4868 if (prop ==
nullptr)
4871 const auto pfit = m_propertyToFlags.constFind(prop);
4872 if (pfit == m_propertyToFlags.constEnd())
4875 for (QtProperty *p : pfit.value()) {
4876 if (p == property) {
4877 int v = m_values[prop].val;
4883 q_ptr->setValue(prop, v);
4892 QtProperty *flagProperty = m_flagToProperty.value(property,
nullptr);
4893 if (flagProperty ==
nullptr)
4896 m_propertyToFlags[flagProperty].replace(m_propertyToFlags[flagProperty].indexOf(property),
nullptr);
4897 m_flagToProperty.remove(property);
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4935
4936
4937
4938
4939
4940
4941
4942
4945
4946
4947
4948
4949
4950
4951
4952
4955
4956
4960 d_ptr->q_ptr =
this;
4962 d_ptr->m_boolPropertyManager =
new QtBoolPropertyManager(
this);
4963 connect(d_ptr->m_boolPropertyManager, &QtBoolPropertyManager::valueChanged,
this,
4964 [
this](
QtProperty *property,
bool value) { d_ptr->slotBoolChanged(property, value); });
4966 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
4970
4971
4978
4979
4980
4981
4982
4983
4984
4985
4986
4989 return d_ptr->m_boolPropertyManager;
4993
4994
4995
4996
4997
4998
4999
5002 return getValue<
int>(d_ptr->m_values, property, 0);
5006
5007
5008
5009
5012 return getData<QStringList>(d_ptr->m_values, &QtFlagPropertyManagerPrivate::Data::flagNames, property, QStringList());
5016
5017
5020 const auto it = d_ptr->m_values.constFind(property);
5021 if (it == d_ptr->m_values.constEnd())
5028 const QChar bar = QLatin1Char(
'|');
5029 for (
const auto &name : data.flagNames) {
5030 if (data.val & (1 << level)) {
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5056 const auto it = d_ptr->m_values.find(property);
5057 if (it == d_ptr->m_values.end())
5062 if (data
.val == val)
5065 if (val > (1 << data.flagNames.size()) - 1)
5075 const auto pfit = d_ptr->m_propertyToFlags.constFind(property);
5077 if (pfit != d_ptr->m_propertyToFlags.constEnd()) {
5078 for (QtProperty *prop : pfit.value()) {
5080 d_ptr->m_boolPropertyManager->setValue(prop, val & (1 << level));
5085 emit propertyChanged(property);
5086 emit valueChanged(property, data
.val);
5090
5091
5092
5093
5094
5095
5098 const auto it = d_ptr->m_values.find(property);
5099 if (it == d_ptr->m_values.end())
5104 if (data.flagNames == flagNames)
5107 data.flagNames = flagNames;
5112 const auto pfit = d_ptr->m_propertyToFlags.find(property);
5113 if (pfit != d_ptr->m_propertyToFlags.end()) {
5114 for (QtProperty *prop : std::as_const(pfit.value())) {
5117 d_ptr->m_flagToProperty.remove(prop);
5120 pfit.value().clear();
5123 for (
const QString &flagName : flagNames) {
5124 QtProperty *prop = d_ptr->m_boolPropertyManager->addProperty();
5125 prop->setPropertyName(flagName);
5126 property->addSubProperty(prop);
5127 d_ptr->m_propertyToFlags[property].append(prop);
5128 d_ptr->m_flagToProperty[prop] = property;
5131 emit flagNamesChanged(property, data.flagNames);
5133 emit propertyChanged(property);
5134 emit valueChanged(property, data
.val);
5138
5139
5142 d_ptr->m_values[property] = QtFlagPropertyManagerPrivate::Data();
5144 d_ptr->m_propertyToFlags[property] = QList<QtProperty *>();
5148
5149
5152 const auto it = d_ptr->m_propertyToFlags.find(property);
5153 if (it != d_ptr->m_propertyToFlags.end()) {
5154 for (QtProperty *prop : std::as_const(it.value())) {
5156 d_ptr->m_flagToProperty.remove(prop);
5161 d_ptr->m_propertyToFlags.erase(it);
5163 d_ptr->m_values.remove(property);
5171 Q_DECLARE_PUBLIC(QtSizePolicyPropertyManager)
5196 if (
QtProperty *prop = m_hStretchToProperty.value(property,
nullptr)) {
5197 QSizePolicy sp = m_values[prop];
5198 sp.setHorizontalStretch(value);
5199 q_ptr->setValue(prop, sp);
5200 }
else if (
QtProperty *prop = m_vStretchToProperty.value(property,
nullptr)) {
5201 QSizePolicy sp = m_values[prop];
5202 sp.setVerticalStretch(value);
5203 q_ptr->setValue(prop, sp);
5209 if (
QtProperty *prop = m_hPolicyToProperty.value(property,
nullptr)) {
5210 QSizePolicy sp = m_values[prop];
5211 sp.setHorizontalPolicy(metaEnumProvider()->indexToSizePolicy(value));
5212 q_ptr->setValue(prop, sp);
5213 }
else if (
QtProperty *prop = m_vPolicyToProperty.value(property,
nullptr)) {
5214 QSizePolicy sp = m_values[prop];
5215 sp.setVerticalPolicy(metaEnumProvider()->indexToSizePolicy(value));
5216 q_ptr->setValue(prop, sp);
5222 if (
QtProperty *pointProp = m_hStretchToProperty.value(property,
nullptr)) {
5223 m_propertyToHStretch[pointProp] =
nullptr;
5224 m_hStretchToProperty.remove(property);
5225 }
else if (
QtProperty *pointProp = m_vStretchToProperty.value(property,
nullptr)) {
5226 m_propertyToVStretch[pointProp] =
nullptr;
5227 m_vStretchToProperty.remove(property);
5228 }
else if (
QtProperty *pointProp = m_hPolicyToProperty.value(property,
nullptr)) {
5229 m_propertyToHPolicy[pointProp] =
nullptr;
5230 m_hPolicyToProperty.remove(property);
5231 }
else if (
QtProperty *pointProp = m_vPolicyToProperty.value(property,
nullptr)) {
5232 m_propertyToVPolicy[pointProp] =
nullptr;
5233 m_vPolicyToProperty.remove(property);
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5264
5265
5266
5267
5268
5269
5270
5271
5274
5275
5279 d_ptr->q_ptr =
this;
5281 d_ptr->m_intPropertyManager =
new QtIntPropertyManager(
this);
5282 connect(d_ptr->m_intPropertyManager, &QtIntPropertyManager::valueChanged,
this,
5283 [
this](
QtProperty *property,
int value) { d_ptr->slotIntChanged(property, value); });
5285 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
5287 d_ptr->m_enumPropertyManager =
new QtEnumPropertyManager(
this);
5288 connect(d_ptr->m_enumPropertyManager, &QtEnumPropertyManager::valueChanged,
this,
5289 [
this](
QtProperty *property,
int value) { d_ptr->slotEnumChanged(property, value); });
5291 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
5295
5296
5303
5304
5305
5306
5307
5308
5309
5310
5311
5314 return d_ptr->m_intPropertyManager;
5318
5319
5320
5321
5322
5323
5324
5325
5326
5329 return d_ptr->m_enumPropertyManager;
5333
5334
5335
5336
5337
5338
5339
5342 return d_ptr->m_values.value(property, QSizePolicy());
5346
5347
5350 const auto it = d_ptr->m_values.constFind(property);
5351 if (it == d_ptr->m_values.constEnd())
5354 const QSizePolicy sp = it.value();
5356 const int hIndex = mep->sizePolicyToIndex(sp.horizontalPolicy());
5357 const int vIndex = mep->sizePolicyToIndex(sp.verticalPolicy());
5359 const QString hPolicy = hIndex != -1 ? mep->policyEnumNames().at(hIndex) : tr(
"<Invalid>");
5360 const QString vPolicy = vIndex != -1 ? mep->policyEnumNames().at(vIndex) : tr(
"<Invalid>");
5361 const QString str = tr(
"[%1, %2, %3, %4]").arg(hPolicy, vPolicy).arg(sp.horizontalStretch()).arg(sp.verticalStretch());
5366
5367
5368
5369
5370
5371
5372
5375 const auto it = d_ptr->m_values.find(property);
5376 if (it == d_ptr->m_values.end())
5379 if (it.value() == val)
5384 d_ptr->m_enumPropertyManager->setValue(d_ptr->m_propertyToHPolicy[property],
5385 metaEnumProvider()->sizePolicyToIndex(val.horizontalPolicy()));
5386 d_ptr->m_enumPropertyManager->setValue(d_ptr->m_propertyToVPolicy[property],
5387 metaEnumProvider()->sizePolicyToIndex(val.verticalPolicy()));
5388 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToHStretch[property],
5389 val.horizontalStretch());
5390 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToVStretch[property],
5391 val.verticalStretch());
5393 emit propertyChanged(property);
5394 emit valueChanged(property, val);
5398
5399
5403 d_ptr->m_values[property] = val;
5405 QtProperty *hPolicyProp = d_ptr->m_enumPropertyManager->addProperty();
5406 hPolicyProp->setPropertyName(tr(
"Horizontal Policy"));
5407 d_ptr->m_enumPropertyManager->setEnumNames(hPolicyProp, metaEnumProvider()->policyEnumNames());
5408 d_ptr->m_enumPropertyManager->setValue(hPolicyProp,
5409 metaEnumProvider()->sizePolicyToIndex(val.horizontalPolicy()));
5410 d_ptr->m_propertyToHPolicy[property] = hPolicyProp;
5411 d_ptr->m_hPolicyToProperty[hPolicyProp] = property;
5414 QtProperty *vPolicyProp = d_ptr->m_enumPropertyManager->addProperty();
5415 vPolicyProp->setPropertyName(tr(
"Vertical Policy"));
5416 d_ptr->m_enumPropertyManager->setEnumNames(vPolicyProp, metaEnumProvider()->policyEnumNames());
5417 d_ptr->m_enumPropertyManager->setValue(vPolicyProp,
5418 metaEnumProvider()->sizePolicyToIndex(val.verticalPolicy()));
5419 d_ptr->m_propertyToVPolicy[property] = vPolicyProp;
5420 d_ptr->m_vPolicyToProperty[vPolicyProp] = property;
5423 QtProperty *hStretchProp = d_ptr->m_intPropertyManager->addProperty();
5424 hStretchProp->setPropertyName(tr(
"Horizontal Stretch"));
5425 d_ptr->m_intPropertyManager->setValue(hStretchProp, val.horizontalStretch());
5426 d_ptr->m_intPropertyManager->setRange(hStretchProp, 0, 0xff);
5427 d_ptr->m_propertyToHStretch[property] = hStretchProp;
5428 d_ptr->m_hStretchToProperty[hStretchProp] = property;
5431 QtProperty *vStretchProp = d_ptr->m_intPropertyManager->addProperty();
5432 vStretchProp->setPropertyName(tr(
"Vertical Stretch"));
5433 d_ptr->m_intPropertyManager->setValue(vStretchProp, val.verticalStretch());
5434 d_ptr->m_intPropertyManager->setRange(vStretchProp, 0, 0xff);
5435 d_ptr->m_propertyToVStretch[property] = vStretchProp;
5436 d_ptr->m_vStretchToProperty[vStretchProp] = property;
5442
5443
5446 QtProperty *hPolicyProp = d_ptr->m_propertyToHPolicy[property];
5448 d_ptr->m_hPolicyToProperty.remove(hPolicyProp);
5451 d_ptr->m_propertyToHPolicy.remove(property);
5453 QtProperty *vPolicyProp = d_ptr->m_propertyToVPolicy[property];
5455 d_ptr->m_vPolicyToProperty.remove(vPolicyProp);
5458 d_ptr->m_propertyToVPolicy.remove(property);
5460 QtProperty *hStretchProp = d_ptr->m_propertyToHStretch[property];
5462 d_ptr->m_hStretchToProperty.remove(hStretchProp);
5463 delete hStretchProp;
5465 d_ptr->m_propertyToHStretch.remove(property);
5467 QtProperty *vStretchProp = d_ptr->m_propertyToVStretch[property];
5469 d_ptr->m_vStretchToProperty.remove(vStretchProp);
5470 delete vStretchProp;
5472 d_ptr->m_propertyToVStretch.remove(property);
5474 d_ptr->m_values.remove(property);
5488 Q_DECLARE_PUBLIC(QtFontPropertyManager)
5532 if (
QtProperty *prop = m_pointSizeToProperty.value(property,
nullptr)) {
5533 QFont f = m_values[prop];
5534 f.setPointSize(value);
5535 q_ptr->setValue(prop, f);
5543 if (
QtProperty *prop = m_familyToProperty.value(property,
nullptr)) {
5544 QFont f = m_values[prop];
5545 f.setFamily(m_familyNames.at(value));
5546 q_ptr->setValue(prop, f);
5547 }
else if (
auto *prop = m_weightToProperty.value(property,
nullptr)) {
5548 QFont f = m_values[prop];
5549 f.setWeight(weightFromIndex(value));
5550 q_ptr->setValue(prop, f);
5558 if (
QtProperty *prop = m_boldToProperty.value(property,
nullptr)) {
5559 QFont f = m_values[prop];
5561 q_ptr->setValue(prop, f);
5562 }
else if (
QtProperty *prop = m_italicToProperty.value(property,
nullptr)) {
5563 QFont f = m_values[prop];
5565 q_ptr->setValue(prop, f);
5566 }
else if (
QtProperty *prop = m_underlineToProperty.value(property,
nullptr)) {
5567 QFont f = m_values[prop];
5568 f.setUnderline(value);
5569 q_ptr->setValue(prop, f);
5570 }
else if (
QtProperty *prop = m_strikeOutToProperty.value(property,
nullptr)) {
5571 QFont f = m_values[prop];
5572 f.setStrikeOut(value);
5573 q_ptr->setValue(prop, f);
5574 }
else if (
QtProperty *prop = m_kerningToProperty.value(property,
nullptr)) {
5575 QFont f = m_values[prop];
5576 f.setKerning(value);
5577 q_ptr->setValue(prop, f);
5583 if (
QtProperty *pointProp = m_pointSizeToProperty.value(property,
nullptr)) {
5584 m_propertyToPointSize[pointProp] =
nullptr;
5585 m_pointSizeToProperty.remove(property);
5586 }
else if (
QtProperty *pointProp = m_familyToProperty.value(property,
nullptr)) {
5587 m_propertyToFamily[pointProp] =
nullptr;
5588 m_familyToProperty.remove(property);
5589 }
else if (
QtProperty *pointProp = m_boldToProperty.value(property,
nullptr)) {
5590 m_propertyToBold[pointProp] =
nullptr;
5591 m_boldToProperty.remove(property);
5592 }
else if (
QtProperty *pointProp = m_italicToProperty.value(property,
nullptr)) {
5593 m_propertyToItalic[pointProp] =
nullptr;
5594 m_italicToProperty.remove(property);
5595 }
else if (
QtProperty *pointProp = m_underlineToProperty.value(property,
nullptr)) {
5596 m_propertyToUnderline[pointProp] =
nullptr;
5597 m_underlineToProperty.remove(property);
5598 }
else if (
QtProperty *pointProp = m_strikeOutToProperty.value(property,
nullptr)) {
5599 m_propertyToStrikeOut[pointProp] =
nullptr;
5600 m_strikeOutToProperty.remove(property);
5601 }
else if (
QtProperty *pointProp = m_kerningToProperty.value(property,
nullptr)) {
5602 m_propertyToKerning[pointProp] =
nullptr;
5603 m_kerningToProperty.remove(property);
5604 }
else if (
QtProperty *weightProp = m_weightToProperty.value(property,
nullptr)) {
5605 m_propertyToWeight[weightProp] =
nullptr;
5606 m_weightToProperty.remove(property);
5612 if (!m_fontDatabaseChangeTimer) {
5613 m_fontDatabaseChangeTimer =
new QTimer(q_ptr);
5614 m_fontDatabaseChangeTimer->setInterval(0);
5615 m_fontDatabaseChangeTimer->setSingleShot(
true);
5616 QObject::connect(m_fontDatabaseChangeTimer, &QTimer::timeout, q_ptr,
5617 [
this] { slotFontDatabaseDelayedChange(); });
5619 if (!m_fontDatabaseChangeTimer->isActive())
5620 m_fontDatabaseChangeTimer->start();
5626 const QStringList oldFamilies = m_familyNames;
5627 m_familyNames = QFontDatabase::families();
5630 if (!m_propertyToFamily.isEmpty()) {
5631 for (QtProperty *familyProp : std::as_const(m_propertyToFamily)) {
5632 const int oldIdx = m_enumPropertyManager->value(familyProp);
5633 qsizetype newIdx = m_familyNames.indexOf(oldFamilies.at(oldIdx));
5636 m_enumPropertyManager->setEnumNames(familyProp, m_familyNames);
5637 m_enumPropertyManager->setValue(familyProp, newIdx);
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5670
5671
5672
5673
5674
5675
5676
5677
5680
5681
5685 d_ptr->q_ptr =
this;
5686 QObject::connect(qApp, &QGuiApplication::fontDatabaseChanged,
this,
5687 [
this] { d_ptr->slotFontDatabaseChanged(); });
5689 d_ptr->m_intPropertyManager =
new QtIntPropertyManager(
this);
5690 connect(d_ptr->m_intPropertyManager, &QtIntPropertyManager::valueChanged,
this,
5691 [
this](
QtProperty *property,
int value) { d_ptr->slotIntChanged(property, value); });
5693 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
5695 d_ptr->m_enumPropertyManager =
new QtEnumPropertyManager(
this);
5696 connect(d_ptr->m_enumPropertyManager, &QtEnumPropertyManager::valueChanged,
this,
5697 [
this](
QtProperty *property,
int value) { d_ptr->slotEnumChanged(property, value); });
5699 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
5701 d_ptr->m_boolPropertyManager =
new QtBoolPropertyManager(
this);
5702 connect(d_ptr->m_boolPropertyManager, &QtBoolPropertyManager::valueChanged,
this,
5703 [
this](
QtProperty *property,
bool value) { d_ptr->slotBoolChanged(property, value); });
5705 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
5709
5710
5717
5718
5719
5720
5721
5722
5723
5724
5727 return d_ptr->m_intPropertyManager;
5731
5732
5733
5734
5735
5736
5737
5738
5741 return d_ptr->m_enumPropertyManager;
5745
5746
5747
5748
5749
5750
5751
5752
5753
5756 return d_ptr->m_boolPropertyManager;
5760
5761
5762
5763
5764
5765
5766
5767
5770 return d_ptr->m_values.value(property, QFont());
5774
5775
5778 const auto it = d_ptr->m_values.constFind(property);
5779 if (it == d_ptr->m_values.constEnd())
5782 return QtPropertyBrowserUtils::fontValueText(it.value());
5786
5787
5790 const auto it = d_ptr->m_values.constFind(property);
5791 if (it == d_ptr->m_values.constEnd())
5794 return QtPropertyBrowserUtils::fontValueIcon(it.value());
5798
5799
5800
5801
5802
5803
5804
5807 const auto it = d_ptr->m_values.find(property);
5808 if (it == d_ptr->m_values.end())
5811 const QFont &oldVal = it.value();
5812 if (oldVal == val && oldVal.resolveMask() == val.resolveMask())
5817 qsizetype idx = d_ptr->m_familyNames.indexOf(val.family());
5820 bool settingValue = d_ptr->m_settingValue;
5821 d_ptr->m_settingValue =
true;
5822 d_ptr->m_enumPropertyManager->setValue(d_ptr->m_propertyToFamily[property], idx);
5823 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToPointSize[property], val.pointSize());
5824 d_ptr->m_boolPropertyManager->setValue(d_ptr->m_propertyToBold[property], val.bold());
5825 d_ptr->m_boolPropertyManager->setValue(d_ptr->m_propertyToItalic[property], val.italic());
5826 d_ptr->m_boolPropertyManager->setValue(d_ptr->m_propertyToUnderline[property], val.underline());
5827 d_ptr->m_boolPropertyManager->setValue(d_ptr->m_propertyToStrikeOut[property], val.strikeOut());
5828 d_ptr->m_boolPropertyManager->setValue(d_ptr->m_propertyToKerning[property], val.kerning());
5829 d_ptr->m_enumPropertyManager->setValue(d_ptr->m_propertyToWeight[property],
5830 indexOfFontWeight(val.weight()));
5831 d_ptr->m_settingValue = settingValue;
5833 emit propertyChanged(property);
5834 emit valueChanged(property, val);
5839 static const DisambiguatedTranslation weightsC[] = {
5840 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"Thin",
"QFont::Weight combo"),
5841 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"ExtraLight",
"QFont::Weight combo"),
5842 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"Light",
"QFont::Weight combo"),
5843 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"Normal",
"QFont::Weight combo"),
5844 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"Medium",
"QFont::Weight combo"),
5845 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"DemiBold",
"QFont::Weight combo"),
5846 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"Bold",
"QFont::Weight combo"),
5847 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"ExtraBold",
"QFont::Weight combo"),
5848 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"Black",
"QFont::Weight combo")
5852 for (
const auto &w : weightsC)
5853 result.append(QCoreApplication::translate(
"FontPropertyManager", w.first, w.second));
5858
5859
5863 d_ptr->m_values[property] = val;
5865 QtProperty *familyProp = d_ptr->m_enumPropertyManager->addProperty();
5866 familyProp->setPropertyName(tr(
"Family"));
5867 if (d_ptr->m_familyNames.isEmpty())
5868 d_ptr->m_familyNames = QFontDatabase::families();
5869 d_ptr->m_enumPropertyManager->setEnumNames(familyProp, d_ptr->m_familyNames);
5870 qsizetype idx = d_ptr->m_familyNames.indexOf(val.family());
5873 d_ptr->m_enumPropertyManager->setValue(familyProp, idx);
5874 d_ptr->m_propertyToFamily[property] = familyProp;
5875 d_ptr->m_familyToProperty[familyProp] = property;
5878 QtProperty *pointSizeProp = d_ptr->m_intPropertyManager->addProperty();
5879 pointSizeProp->setPropertyName(tr(
"Point Size"));
5880 d_ptr->m_intPropertyManager->setValue(pointSizeProp, val.pointSize());
5881 d_ptr->m_intPropertyManager->setMinimum(pointSizeProp, 1);
5882 d_ptr->m_propertyToPointSize[property] = pointSizeProp;
5883 d_ptr->m_pointSizeToProperty[pointSizeProp] = property;
5886 QtProperty *boldProp = d_ptr->m_boolPropertyManager->addProperty();
5887 boldProp->setPropertyName(tr(
"Bold",
"Bold toggle"));
5888 d_ptr->m_boolPropertyManager->setValue(boldProp, val.bold());
5889 d_ptr->m_propertyToBold[property] = boldProp;
5890 d_ptr->m_boldToProperty[boldProp] = property;
5893 QtProperty *italicProp = d_ptr->m_boolPropertyManager->addProperty();
5894 italicProp->setPropertyName(tr(
"Italic"));
5895 d_ptr->m_boolPropertyManager->setValue(italicProp, val.italic());
5896 d_ptr->m_propertyToItalic[property] = italicProp;
5897 d_ptr->m_italicToProperty[italicProp] = property;
5900 QtProperty *underlineProp = d_ptr->m_boolPropertyManager->addProperty();
5901 underlineProp->setPropertyName(tr(
"Underline"));
5902 d_ptr->m_boolPropertyManager->setValue(underlineProp, val.underline());
5903 d_ptr->m_propertyToUnderline[property] = underlineProp;
5904 d_ptr->m_underlineToProperty[underlineProp] = property;
5907 QtProperty *strikeOutProp = d_ptr->m_boolPropertyManager->addProperty();
5908 strikeOutProp->setPropertyName(tr(
"Strikeout"));
5909 d_ptr->m_boolPropertyManager->setValue(strikeOutProp, val.strikeOut());
5910 d_ptr->m_propertyToStrikeOut[property] = strikeOutProp;
5911 d_ptr->m_strikeOutToProperty[strikeOutProp] = property;
5914 QtProperty *kerningProp = d_ptr->m_boolPropertyManager->addProperty();
5915 kerningProp->setPropertyName(tr(
"Kerning"));
5916 d_ptr->m_boolPropertyManager->setValue(kerningProp, val.kerning());
5917 d_ptr->m_propertyToKerning[property] = kerningProp;
5918 d_ptr->m_kerningToProperty[kerningProp] = property;
5921 auto *weightProp = d_ptr->m_enumPropertyManager->addProperty();
5922 weightProp->setPropertyName(tr(
"Weight"));
5923 static const QStringList weightNames = fontWeightNames();
5924 d_ptr->m_enumPropertyManager->setEnumNames(weightProp, weightNames);
5925 d_ptr->m_enumPropertyManager->setValue(weightProp, indexOfFontWeight(val.weight()));
5926 d_ptr->m_propertyToWeight[property] = weightProp;
5927 d_ptr->m_weightToProperty[weightProp] = property;
5932
5933
5936 QtProperty *familyProp = d_ptr->m_propertyToFamily[property];
5938 d_ptr->m_familyToProperty.remove(familyProp);
5941 d_ptr->m_propertyToFamily.remove(property);
5943 QtProperty *pointSizeProp = d_ptr->m_propertyToPointSize[property];
5944 if (pointSizeProp) {
5945 d_ptr->m_pointSizeToProperty.remove(pointSizeProp);
5946 delete pointSizeProp;
5948 d_ptr->m_propertyToPointSize.remove(property);
5950 QtProperty *boldProp = d_ptr->m_propertyToBold[property];
5952 d_ptr->m_boldToProperty.remove(boldProp);
5955 d_ptr->m_propertyToBold.remove(property);
5957 QtProperty *italicProp = d_ptr->m_propertyToItalic[property];
5959 d_ptr->m_italicToProperty.remove(italicProp);
5962 d_ptr->m_propertyToItalic.remove(property);
5964 QtProperty *underlineProp = d_ptr->m_propertyToUnderline[property];
5965 if (underlineProp) {
5966 d_ptr->m_underlineToProperty.remove(underlineProp);
5967 delete underlineProp;
5969 d_ptr->m_propertyToUnderline.remove(property);
5971 QtProperty *strikeOutProp = d_ptr->m_propertyToStrikeOut[property];
5972 if (strikeOutProp) {
5973 d_ptr->m_strikeOutToProperty.remove(strikeOutProp);
5974 delete strikeOutProp;
5976 d_ptr->m_propertyToStrikeOut.remove(property);
5978 QtProperty *kerningProp = d_ptr->m_propertyToKerning[property];
5980 d_ptr->m_kerningToProperty.remove(kerningProp);
5983 d_ptr->m_propertyToKerning.remove(property);
5985 if (
auto weightProp = d_ptr->m_propertyToWeight[property]) {
5986 d_ptr->m_weightToProperty.remove(weightProp);
5990 d_ptr->m_values.remove(property);
5998 Q_DECLARE_PUBLIC(QtColorPropertyManager)
6021 if (
QtProperty *prop = m_rToProperty.value(property,
nullptr)) {
6022 QColor c = m_values[prop];
6024 q_ptr->setValue(prop, c);
6025 }
else if (
QtProperty *prop = m_gToProperty.value(property,
nullptr)) {
6026 QColor c = m_values[prop];
6028 q_ptr->setValue(prop, c);
6029 }
else if (
QtProperty *prop = m_bToProperty.value(property,
nullptr)) {
6030 QColor c = m_values[prop];
6032 q_ptr->setValue(prop, c);
6033 }
else if (
QtProperty *prop = m_aToProperty.value(property,
nullptr)) {
6034 QColor c = m_values[prop];
6036 q_ptr->setValue(prop, c);
6042 if (
QtProperty *pointProp = m_rToProperty.value(property,
nullptr)) {
6043 m_propertyToR[pointProp] =
nullptr;
6044 m_rToProperty.remove(property);
6045 }
else if (
QtProperty *pointProp = m_gToProperty.value(property,
nullptr)) {
6046 m_propertyToG[pointProp] =
nullptr;
6047 m_gToProperty.remove(property);
6048 }
else if (
QtProperty *pointProp = m_bToProperty.value(property,
nullptr)) {
6049 m_propertyToB[pointProp] =
nullptr;
6050 m_bToProperty.remove(property);
6051 }
else if (
QtProperty *pointProp = m_aToProperty.value(property,
nullptr)) {
6052 m_propertyToA[pointProp] =
nullptr;
6053 m_aToProperty.remove(property);
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6083
6084
6085
6086
6087
6088
6089
6090
6093
6094
6098 d_ptr->q_ptr =
this;
6100 d_ptr->m_intPropertyManager =
new QtIntPropertyManager(
this);
6101 connect(d_ptr->m_intPropertyManager, &QtIntPropertyManager::valueChanged,
this,
6102 [
this](
QtProperty *property,
int value) { d_ptr->slotIntChanged(property, value); });
6104 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
6108
6109
6116
6117
6118
6119
6120
6121
6122
6123
6124
6127 return d_ptr->m_intPropertyManager;
6131
6132
6133
6134
6135
6136
6137
6140 return d_ptr->m_values.value(property, QColor());
6144
6145
6149 const auto it = d_ptr->m_values.constFind(property);
6150 if (it == d_ptr->m_values.constEnd())
6153 return QtPropertyBrowserUtils::colorValueText(it.value());
6157
6158
6162 const auto it = d_ptr->m_values.constFind(property);
6163 if (it == d_ptr->m_values.constEnd())
6165 return QtPropertyBrowserUtils::brushValueIcon(QBrush(it.value()));
6169
6170
6171
6172
6173
6174
6175
6178 const auto it = d_ptr->m_values.find(property);
6179 if (it == d_ptr->m_values.end())
6182 if (it.value() == val)
6187 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToR[property], val.red());
6188 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToG[property], val.green());
6189 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToB[property], val.blue());
6190 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToA[property], val.alpha());
6192 emit propertyChanged(property);
6193 emit valueChanged(property, val);
6197
6198
6202 d_ptr->m_values[property] = val;
6204 QtProperty *rProp = d_ptr->m_intPropertyManager->addProperty();
6205 rProp->setPropertyName(tr(
"Red"));
6206 d_ptr->m_intPropertyManager->setValue(rProp, val.red());
6207 d_ptr->m_intPropertyManager->setRange(rProp, 0, 0xFF);
6208 d_ptr->m_propertyToR[property] = rProp;
6209 d_ptr->m_rToProperty[rProp] = property;
6212 QtProperty *gProp = d_ptr->m_intPropertyManager->addProperty();
6213 gProp->setPropertyName(tr(
"Green"));
6214 d_ptr->m_intPropertyManager->setValue(gProp, val.green());
6215 d_ptr->m_intPropertyManager->setRange(gProp, 0, 0xFF);
6216 d_ptr->m_propertyToG[property] = gProp;
6217 d_ptr->m_gToProperty[gProp] = property;
6220 QtProperty *bProp = d_ptr->m_intPropertyManager->addProperty();
6221 bProp->setPropertyName(tr(
"Blue"));
6222 d_ptr->m_intPropertyManager->setValue(bProp, val.blue());
6223 d_ptr->m_intPropertyManager->setRange(bProp, 0, 0xFF);
6224 d_ptr->m_propertyToB[property] = bProp;
6225 d_ptr->m_bToProperty[bProp] = property;
6228 QtProperty *aProp = d_ptr->m_intPropertyManager->addProperty();
6229 aProp->setPropertyName(tr(
"Alpha"));
6230 d_ptr->m_intPropertyManager->setValue(aProp, val.alpha());
6231 d_ptr->m_intPropertyManager->setRange(aProp, 0, 0xFF);
6232 d_ptr->m_propertyToA[property] = aProp;
6233 d_ptr->m_aToProperty[aProp] = property;
6238
6239
6242 QtProperty *rProp = d_ptr->m_propertyToR[property];
6244 d_ptr->m_rToProperty.remove(rProp);
6247 d_ptr->m_propertyToR.remove(property);
6249 QtProperty *gProp = d_ptr->m_propertyToG[property];
6251 d_ptr->m_gToProperty.remove(gProp);
6254 d_ptr->m_propertyToG.remove(property);
6256 QtProperty *bProp = d_ptr->m_propertyToB[property];
6258 d_ptr->m_bToProperty.remove(bProp);
6261 d_ptr->m_propertyToB.remove(property);
6263 QtProperty *aProp = d_ptr->m_propertyToA[property];
6265 d_ptr->m_aToProperty.remove(aProp);
6268 d_ptr->m_propertyToA.remove(property);
6270 d_ptr->m_values.remove(property);
6278 Q_DECLARE_PUBLIC(QtCursorPropertyManager)
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6301
6302
6303
6304
6305
6306
6307
6308
6311
6312
6316 d_ptr->q_ptr =
this;
6320
6321
6328
6329
6330
6331
6332
6333
6334
6338 return d_ptr->m_values.value(property, QCursor());
6343
6344
6347 const auto it = d_ptr->m_values.constFind(property);
6348 if (it == d_ptr->m_values.constEnd())
6355
6356
6359 const auto it = d_ptr->m_values.constFind(property);
6360 if (it == d_ptr->m_values.constEnd())
6367
6368
6369
6370
6371
6372
6376 const auto it = d_ptr->m_values.find(property);
6377 if (it == d_ptr->m_values.end())
6380 if (it.value().shape() == value.shape() && value.shape() != Qt::BitmapCursor)
6385 emit propertyChanged(property);
6386 emit valueChanged(property, value);
6391
6392
6396 d_ptr->m_values[property] = QCursor();
6401
6402
6405 d_ptr->m_values.remove(property);
6410#include "moc_qtpropertymanager_p.cpp"
6411#include "qtpropertymanager.moc"
The QtAbstractPropertyManager provides an interface for property managers.
void propertyDestroyed(QtProperty *property)
This signal is emitted when the specified property is about to be destroyed.
void propertyChanged(QtProperty *property)
This signal is emitted whenever a property's data changes, passing a pointer to the property as param...
void clear() const
Destroys all the properties that this manager has created.
QHash< const QtProperty *, bool > m_values
const QIcon m_uncheckedIcon
const QIcon m_checkedIcon
The QtBoolPropertyManager class provides and manages boolean properties.
QIcon valueIcon(const QtProperty *property) const override
\reimp
~QtBoolPropertyManager() override
Destroys this manager, and all the properties it has created.
bool value(const QtProperty *property) const
Returns the given property's value.
QString valueText(const QtProperty *property) const override
\reimp
void initializeProperty(QtProperty *property) override
\reimp
void uninitializeProperty(QtProperty *property) override
\reimp
The QtCharPropertyManager provides and manages QChar properties.
void uninitializeProperty(QtProperty *property) override
\reimp
~QtCharPropertyManager() override
Destroys this manager, and all the properties it has created.
void initializeProperty(QtProperty *property) override
\reimp
QChar value(const QtProperty *property) const
Returns the given property's value.
QString valueText(const QtProperty *property) const override
\reimp
QtIntPropertyManager * m_intPropertyManager
QHash< const QtProperty *, QtProperty * > m_propertyToA
QHash< const QtProperty *, QtProperty * > m_propertyToB
QHash< const QtProperty *, QtProperty * > m_gToProperty
QHash< const QtProperty *, QtProperty * > m_propertyToR
QHash< const QtProperty *, QtProperty * > m_bToProperty
void slotPropertyDestroyed(QtProperty *property)
QHash< const QtProperty *, QtProperty * > m_propertyToG
QHash< const QtProperty *, QColor > m_values
QHash< const QtProperty *, QtProperty * > m_aToProperty
QHash< const QtProperty *, QtProperty * > m_rToProperty
The QtColorPropertyManager provides and manages QColor properties.
void initializeProperty(QtProperty *property) override
\reimp
~QtColorPropertyManager() override
Destroys this manager, and all the properties it has created.
QIcon valueIcon(const QtProperty *property) const override
\reimp
void uninitializeProperty(QtProperty *property) override
\reimp
QtIntPropertyManager * subIntPropertyManager() const
Returns the manager that produces the nested red, green and blue subproperties.
QColor value(const QtProperty *property) const
Returns the given property's value.
QString valueText(const QtProperty *property) const override
\reimp
static QtCursorDatabase * instance()
The QtCursorPropertyManager provides and manages QCursor properties.
QString valueText(const QtProperty *property) const override
\reimp
~QtCursorPropertyManager() override
Destroys this manager, and all the properties it has created.
QIcon valueIcon(const QtProperty *property) const override
\reimp
void uninitializeProperty(QtProperty *property) override
\reimp
QCursor value(const QtProperty *property) const
Returns the given property's value.
void initializeProperty(QtProperty *property) override
\reimp
QHash< const QtProperty *, Data > m_values
The QtDatePropertyManager provides and manages QDate properties.
void rangeChanged(QtProperty *property, QDate minVal, QDate maxVal)
This signal is emitted whenever a property created by this manager changes its range of valid dates,...
void setMaximum(QtProperty *property, QDate maxVal)
Sets the maximum value for the given property to maxVal.
void uninitializeProperty(QtProperty *property) override
\reimp
void initializeProperty(QtProperty *property) override
\reimp
QString valueText(const QtProperty *property) const override
\reimp
void setMinimum(QtProperty *property, QDate minVal)
Sets the minimum value for the given property to minVal.
void setRange(QtProperty *property, QDate minVal, QDate maxVal)
Sets the range of valid dates.
QDate minimum(const QtProperty *property) const
Returns the given property's minimum date.
~QtDatePropertyManager() override
Destroys this manager, and all the properties it has created.
QDate maximum(const QtProperty *property) const
Returns the given property's maximum date.
QDate value(const QtProperty *property) const
Returns the given property's value.
QHash< const QtProperty *, QDateTime > m_values
The QtDateTimePropertyManager provides and manages QDateTime properties.
void uninitializeProperty(QtProperty *property) override
\reimp
void initializeProperty(QtProperty *property) override
\reimp
QDateTime value(const QtProperty *property) const
Returns the given property's value.
QString valueText(const QtProperty *property) const override
\reimp
~QtDateTimePropertyManager() override
Destroys this manager, and all the properties it has created.
QHash< const QtProperty *, Data > m_values
The QtDoublePropertyManager provides and manages double properties.
QString valueText(const QtProperty *property) const override
\reimp
double singleStep(const QtProperty *property) const
Returns the given property's step value.
int decimals(const QtProperty *property) const
Returns the given property's precision, in decimals.
void setMaximum(QtProperty *property, double maxVal)
Sets the maximum value for the given property to maxVal.
void uninitializeProperty(QtProperty *property) override
\reimp
~QtDoublePropertyManager() override
Destroys this manager, and all the properties it has created.
void setDecimals(QtProperty *property, int prec)
Sets the precision of the given property to prec.
double minimum(const QtProperty *property) const
Returns the given property's minimum value.
double value(const QtProperty *property) const
Returns the given property's value.
void setSingleStep(QtProperty *property, double step)
Sets the step value for the given property to step.
void initializeProperty(QtProperty *property) override
\reimp
void setMinimum(QtProperty *property, double minVal)
Sets the minimum value for the given property to minVal.
void rangeChanged(QtProperty *property, double minVal, double maxVal)
This signal is emitted whenever a property created by this manager changes its range of valid values,...
double maximum(const QtProperty *property) const
Returns the given property's maximum value.
void setRange(QtProperty *property, double minVal, double maxVal)
Sets the range of valid values.
QHash< const QtProperty *, Data > m_values
The QtEnumPropertyManager provides and manages enum properties.
void setEnumIcons(QtProperty *property, const QMap< int, QIcon > &icons)
Sets the given property's map of enum values to their icons to enumIcons.
~QtEnumPropertyManager() override
Destroys this manager, and all the properties it has created.
QMap< int, QIcon > enumIcons(const QtProperty *property) const
Returns the given property's map of enum values to their icons.
QStringList enumNames(const QtProperty *property) const
Returns the given property's list of enum names.
QString valueText(const QtProperty *property) const override
\reimp
QIcon valueIcon(const QtProperty *property) const override
\reimp
void setEnumNames(QtProperty *property, const QStringList &names)
Sets the given property's list of enum names to enumNames.
void initializeProperty(QtProperty *property) override
\reimp
void uninitializeProperty(QtProperty *property) override
\reimp
int value(const QtProperty *property) const
Returns the given property's value which is an index in the list returned by enumNames().
void slotPropertyDestroyed(QtProperty *property)
QHash< const QtProperty *, Data > m_values
QtBoolPropertyManager * m_boolPropertyManager
QHash< const QtProperty *, QList< QtProperty * > > m_propertyToFlags
QHash< const QtProperty *, QtProperty * > m_flagToProperty
The QtFlagPropertyManager provides and manages flag properties.
void uninitializeProperty(QtProperty *property) override
\reimp
QString valueText(const QtProperty *property) const override
\reimp
~QtFlagPropertyManager() override
Destroys this manager, and all the properties it has created.
QtBoolPropertyManager * subBoolPropertyManager() const
Returns the manager that produces the nested boolean subproperties representing each flag.
void setFlagNames(QtProperty *property, const QStringList &names)
Sets the given property's list of flag names to flagNames.
void initializeProperty(QtProperty *property) override
\reimp
QStringList flagNames(const QtProperty *property) const
Returns the given property's list of flag names.
int value(const QtProperty *property) const
Returns the given property's value.
QHash< const QtProperty *, QtProperty * > m_propertyToItalic
QStringList m_familyNames
QtIntPropertyManager * m_intPropertyManager
void slotFontDatabaseDelayedChange()
QHash< const QtProperty *, QtProperty * > m_strikeOutToProperty
QHash< const QtProperty *, QtProperty * > m_pointSizeToProperty
void slotEnumChanged(QtProperty *property, int value)
QHash< const QtProperty *, QtProperty * > m_kerningToProperty
QHash< const QtProperty *, QtProperty * > m_familyToProperty
QHash< const QtProperty *, QtProperty * > m_propertyToStrikeOut
QHash< const QtProperty *, QtProperty * > m_propertyToBold
QtEnumPropertyManager * m_enumPropertyManager
QHash< const QtProperty *, QFont > m_values
QtBoolPropertyManager * m_boolPropertyManager
QHash< const QtProperty *, QtProperty * > m_weightToProperty
QHash< const QtProperty *, QtProperty * > m_propertyToWeight
void slotFontDatabaseChanged()
QHash< const QtProperty *, QtProperty * > m_propertyToFamily
QHash< const QtProperty *, QtProperty * > m_propertyToKerning
QHash< const QtProperty *, QtProperty * > m_propertyToPointSize
void slotBoolChanged(QtProperty *property, bool value)
QHash< const QtProperty *, QtProperty * > m_italicToProperty
QHash< const QtProperty *, QtProperty * > m_underlineToProperty
QHash< const QtProperty *, QtProperty * > m_propertyToUnderline
QTimer * m_fontDatabaseChangeTimer
void slotPropertyDestroyed(QtProperty *property)
QHash< const QtProperty *, QtProperty * > m_boldToProperty
The QtFontPropertyManager provides and manages QFont properties.
void uninitializeProperty(QtProperty *property) override
\reimp
QFont value(const QtProperty *property) const
Returns the given property's value.
~QtFontPropertyManager() override
Destroys this manager, and all the properties it has created.
void initializeProperty(QtProperty *property) override
\reimp
QtBoolPropertyManager * subBoolPropertyManager() const
Returns the manager that creates the bold, italic, underline, strikeOut and kerning subproperties.
QIcon valueIcon(const QtProperty *property) const override
\reimp
QtEnumPropertyManager * subEnumPropertyManager() const
Returns the manager that create the family subproperty.
QString valueText(const QtProperty *property) const override
\reimp
QtIntPropertyManager * subIntPropertyManager() const
Returns the manager that creates the pointSize subproperty.
The QtGroupPropertyManager provides and manages group properties.
bool hasValue(const QtProperty *property) const override
\reimp
void initializeProperty(QtProperty *property) override
\reimp
void uninitializeProperty(QtProperty *property) override
\reimp
QHash< const QtProperty *, Data > m_values
The QtIntPropertyManager provides and manages int properties.
void uninitializeProperty(QtProperty *property) override
\reimp
void rangeChanged(QtProperty *property, int minVal, int maxVal)
This signal is emitted whenever a property created by this manager changes its range of valid values,...
void setRange(QtProperty *property, int minVal, int maxVal)
Sets the range of valid values.
int singleStep(const QtProperty *property) const
Returns the given property's step value.
int minimum(const QtProperty *property) const
Returns the given property's minimum value.
QString valueText(const QtProperty *property) const override
\reimp
~QtIntPropertyManager() override
Destroys this manager, and all the properties it has created.
int value(const QtProperty *property) const
Returns the given property's value.
void setMaximum(QtProperty *property, int maxVal)
Sets the maximum value for the given property to maxVal.
void setMinimum(QtProperty *property, int minVal)
Sets the minimum value for the given property to minVal.
int maximum(const QtProperty *property) const
Returns the given property's maximum value.
void setSingleStep(QtProperty *property, int step)
Sets the step value for the given property to step.
void initializeProperty(QtProperty *property) override
\reimp
QHash< const QtProperty *, QKeySequence > m_values
The QtKeySequencePropertyManager provides and manages QKeySequence properties.
void uninitializeProperty(QtProperty *property) override
\reimp
~QtKeySequencePropertyManager() override
Destroys this manager, and all the properties it has created.
void initializeProperty(QtProperty *property) override
\reimp
QKeySequence value(const QtProperty *property) const
Returns the given property's value.
QString valueText(const QtProperty *property) const override
\reimp
QtEnumPropertyManager * m_enumPropertyManager
QHash< const QtProperty *, QtProperty * > m_territoryToProperty
QHash< const QtProperty *, QtProperty * > m_languageToProperty
QHash< const QtProperty *, QtProperty * > m_propertyToTerritory
QHash< const QtProperty *, QtProperty * > m_propertyToLanguage
void slotPropertyDestroyed(QtProperty *property)
QHash< const QtProperty *, QLocale > m_values
The QtLocalePropertyManager provides and manages QLocale properties.
void uninitializeProperty(QtProperty *property) override
\reimp
QString valueText(const QtProperty *property) const override
\reimp
QtEnumPropertyManager * subEnumPropertyManager() const
Returns the manager that creates the nested language and territory subproperties.
void initializeProperty(QtProperty *property) override
\reimp
QLocale value(const QtProperty *property) const
Returns the given property's value.
~QtLocalePropertyManager() override
Destroys this manager, and all the properties it has created.
QHash< const QtProperty *, QtProperty * > m_yToProperty
void slotPropertyDestroyed(QtProperty *property)
QHash< const QtProperty *, QtProperty * > m_xToProperty
void slotDoubleChanged(QtProperty *property, double value)
QHash< const QtProperty *, Data > m_values
QHash< const QtProperty *, QtProperty * > m_propertyToY
QtDoublePropertyManager * m_doublePropertyManager
QHash< const QtProperty *, QtProperty * > m_propertyToX
The QtPointFPropertyManager provides and manages QPointF properties.
void initializeProperty(QtProperty *property) override
\reimp
void setDecimals(QtProperty *property, int prec)
Sets the precision of the given property to prec.
void uninitializeProperty(QtProperty *property) override
\reimp
QString valueText(const QtProperty *property) const override
\reimp
QPointF value(const QtProperty *property) const
Returns the given property's value.
~QtPointFPropertyManager() override
Destroys this manager, and all the properties it has created.
QtDoublePropertyManager * subDoublePropertyManager() const
Returns the manager that creates the nested x and y subproperties.
int decimals(const QtProperty *property) const
Returns the given property's precision, in decimals.
QHash< const QtProperty *, QtProperty * > m_yToProperty
QtIntPropertyManager * m_intPropertyManager
QHash< const QtProperty *, QtProperty * > m_xToProperty
QHash< const QtProperty *, QPoint > m_values
void slotPropertyDestroyed(QtProperty *property)
QHash< const QtProperty *, QtProperty * > m_propertyToY
QHash< const QtProperty *, QtProperty * > m_propertyToX
The QtPointPropertyManager provides and manages QPoint properties.
QtIntPropertyManager * subIntPropertyManager() const
Returns the manager that creates the nested x and y subproperties.
void initializeProperty(QtProperty *property) override
\reimp
void uninitializeProperty(QtProperty *property) override
\reimp
QString valueText(const QtProperty *property) const override
\reimp
~QtPointPropertyManager() override
Destroys this manager, and all the properties it has created.
QPoint value(const QtProperty *property) const
Returns the given property's value.
The QtProperty class encapsulates an instance of a property.
void addSubProperty(QtProperty *property)
Appends the given property to this property's subproperties.
QHash< const QtProperty *, QtProperty * > m_propertyToX
QHash< const QtProperty *, QtProperty * > m_xToProperty
QHash< const QtProperty *, QtProperty * > m_yToProperty
QHash< const QtProperty *, QtProperty * > m_hToProperty
QHash< const QtProperty *, Data > m_values
QHash< const QtProperty *, QtProperty * > m_wToProperty
QtDoublePropertyManager * m_doublePropertyManager
void setConstraint(QtProperty *property, const QRectF &constraint, const QRectF &val)
void slotPropertyDestroyed(QtProperty *property)
QHash< const QtProperty *, QtProperty * > m_propertyToW
QHash< const QtProperty *, QtProperty * > m_propertyToH
QHash< const QtProperty *, QtProperty * > m_propertyToY
The QtRectFPropertyManager provides and manages QRectF properties.
QRectF constraint(const QtProperty *property) const
Returns the given property's constraining rectangle.
QRectF value(const QtProperty *property) const
Returns the given property's value.
QtDoublePropertyManager * subDoublePropertyManager() const
Returns the manager that creates the nested x, y, width and height subproperties.
void uninitializeProperty(QtProperty *property) override
\reimp
int decimals(const QtProperty *property) const
Returns the given property's precision, in decimals.
void initializeProperty(QtProperty *property) override
\reimp
QString valueText(const QtProperty *property) const override
\reimp
void setDecimals(QtProperty *property, int prec)
Sets the precision of the given property to prec.
void setConstraint(QtProperty *property, const QRectF &constraint)
Sets the given property's constraining rectangle to constraint.
~QtRectFPropertyManager() override
Destroys this manager, and all the properties it has created.
QHash< const QtProperty *, Data > m_values
void setConstraint(QtProperty *property, QRect constraint, QRect val)
QHash< const QtProperty *, QtProperty * > m_propertyToX
QHash< const QtProperty *, QtProperty * > m_xToProperty
QHash< const QtProperty *, QtProperty * > m_wToProperty
QtIntPropertyManager * m_intPropertyManager
QHash< const QtProperty *, QtProperty * > m_propertyToW
void slotPropertyDestroyed(QtProperty *property)
QHash< const QtProperty *, QtProperty * > m_propertyToY
QHash< const QtProperty *, QtProperty * > m_propertyToH
QHash< const QtProperty *, QtProperty * > m_yToProperty
QHash< const QtProperty *, QtProperty * > m_hToProperty
The QtRectPropertyManager provides and manages QRect properties.
QRect value(const QtProperty *property) const
Returns the given property's value.
void initializeProperty(QtProperty *property) override
\reimp
QtIntPropertyManager * subIntPropertyManager() const
Returns the manager that creates the nested x, y, width and height subproperties.
QString valueText(const QtProperty *property) const override
\reimp
QRect constraint(const QtProperty *property) const
Returns the given property's constraining rectangle.
void setConstraint(QtProperty *property, QRect constraint)
Sets the given property's constraining rectangle to constraint.
void uninitializeProperty(QtProperty *property) override
\reimp
~QtRectPropertyManager() override
Destroys this manager, and all the properties it has created.
void setRange(QtProperty *property, QSizeF minVal, QSizeF maxVal, QSizeF val)
QHash< const QtProperty *, QtProperty * > m_hToProperty
QHash< const QtProperty *, QtProperty * > m_propertyToH
QHash< const QtProperty *, Data > m_values
QHash< const QtProperty *, QtProperty * > m_wToProperty
void setValue(QtProperty *property, QSizeF val)
void slotPropertyDestroyed(QtProperty *property)
QHash< const QtProperty *, QtProperty * > m_propertyToW
QtDoublePropertyManager * m_doublePropertyManager
The QtSizeFPropertyManager provides and manages QSizeF properties.
QSizeF value(const QtProperty *property) const
Returns the given property's value.
~QtSizeFPropertyManager() override
Destroys this manager, and all the properties it has created.
void setDecimals(QtProperty *property, int prec)
Sets the precision of the given property to prec.
QSizeF maximum(const QtProperty *property) const
Returns the given property's maximum size value.
int decimals(const QtProperty *property) const
Returns the given property's precision, in decimals.
void initializeProperty(QtProperty *property) override
\reimp
QString valueText(const QtProperty *property) const override
\reimp
QSizeF minimum(const QtProperty *property) const
Returns the given property's minimum size value.
void setMinimum(QtProperty *property, QSizeF minVal)
Sets the minimum size value for the given property to minVal.
QtDoublePropertyManager * subDoublePropertyManager() const
Returns the manager that creates the nested width and height subproperties.
void uninitializeProperty(QtProperty *property) override
\reimp
void setRange(QtProperty *property, QSizeF minVal, QSizeF maxVal)
Sets the range of valid values.
void setMaximum(QtProperty *property, QSizeF maxVal)
Sets the maximum size value for the given property to maxVal.
QtEnumPropertyManager * m_enumPropertyManager
QHash< const QtProperty *, QtProperty * > m_propertyToHPolicy
void slotPropertyDestroyed(QtProperty *property)
QtIntPropertyManager * m_intPropertyManager
QHash< const QtProperty *, QtProperty * > m_vPolicyToProperty
QHash< const QtProperty *, QSizePolicy > m_values
QHash< const QtProperty *, QtProperty * > m_propertyToHStretch
QHash< const QtProperty *, QtProperty * > m_propertyToVPolicy
QHash< const QtProperty *, QtProperty * > m_hStretchToProperty
void slotEnumChanged(QtProperty *property, int value)
QHash< const QtProperty *, QtProperty * > m_propertyToVStretch
QHash< const QtProperty *, QtProperty * > m_hPolicyToProperty
QHash< const QtProperty *, QtProperty * > m_vStretchToProperty
The QtSizePolicyPropertyManager provides and manages QSizePolicy properties.
QtIntPropertyManager * subIntPropertyManager() const
Returns the manager that creates the nested horizontalStretch and verticalStretch subproperties.
~QtSizePolicyPropertyManager() override
Destroys this manager, and all the properties it has created.
QtEnumPropertyManager * subEnumPropertyManager() const
Returns the manager that creates the nested horizontalPolicy and verticalPolicy subproperties.
void uninitializeProperty(QtProperty *property) override
\reimp
void initializeProperty(QtProperty *property) override
\reimp
QSizePolicy value(const QtProperty *property) const
Returns the given property's value.
QString valueText(const QtProperty *property) const override
\reimp
void slotPropertyDestroyed(QtProperty *property)
void setRange(QtProperty *property, QSize minVal, QSize maxVal, QSize val)
QHash< const QtProperty *, QtProperty * > m_propertyToW
QHash< const QtProperty *, QtProperty * > m_hToProperty
QHash< const QtProperty *, QtProperty * > m_wToProperty
void setValue(QtProperty *property, QSize val)
QHash< const QtProperty *, QtProperty * > m_propertyToH
QHash< const QtProperty *, Data > m_values
QtIntPropertyManager * m_intPropertyManager
The QtSizePropertyManager provides and manages QSize properties.
QSize value(const QtProperty *property) const
Returns the given property's value.
~QtSizePropertyManager() override
Destroys this manager, and all the properties it has created.
void uninitializeProperty(QtProperty *property) override
\reimp
void setMaximum(QtProperty *property, QSize maxVal)
Sets the maximum size value for the given property to maxVal.
void setRange(QtProperty *property, QSize minVal, QSize maxVal)
Sets the range of valid values.
void initializeProperty(QtProperty *property) override
\reimp
QSize maximum(const QtProperty *property) const
Returns the given property's maximum size value.
void setMinimum(QtProperty *property, QSize minVal)
Sets the minimum size value for the given property to minVal.
QString valueText(const QtProperty *property) const override
\reimp
QSize minimum(const QtProperty *property) const
Returns the given property's minimum size value.
QtIntPropertyManager * subIntPropertyManager() const
Returns the manager that creates the nested width and height subproperties.
QHash< const QtProperty *, Data > m_values
The QtStringPropertyManager provides and manages QString properties.
QString value(const QtProperty *property) const
Returns the given property's value.
QRegularExpression regExp(const QtProperty *property) const
Returns the given property's currently set regular expression.
~QtStringPropertyManager() override
Destroys this manager, and all the properties it has created.
void setRegExp(QtProperty *property, const QRegularExpression ®Exp)
Sets the regular expression of the given property to regExp.
void initializeProperty(QtProperty *property) override
\reimp
QString valueText(const QtProperty *property) const override
\reimp
void uninitializeProperty(QtProperty *property) override
\reimp
QHash< const QtProperty *, QTime > m_values
The QtTimePropertyManager provides and manages QTime properties.
void initializeProperty(QtProperty *property) override
\reimp
QTime value(const QtProperty *property) const
Returns the given property's value.
void uninitializeProperty(QtProperty *property) override
\reimp
~QtTimePropertyManager() override
Destroys this manager, and all the properties it has created.
QString valueText(const QtProperty *property) const override
\reimp
static void setValueInRange(PropertyManager *manager, PropertyManagerPrivate *managerPrivate, void(PropertyManager::*propertyChangedSignal)(QtProperty *), void(PropertyManager::*valueChangedSignal)(QtProperty *, ValueChangeParameter), QtProperty *property, const Value &val, void(PropertyManagerPrivate::*setSubPropertyValue)(QtProperty *, ValueChangeParameter))
static Value getValue(const QHash< const QtProperty *, PrivateData > &propertyMap, const QtProperty *property, const Value &defaultValue=Value())
static QStringList fontWeightNames()
static const QFont::Weight weightValues[]
static SizeValue qBoundSize(const SizeValue &minVal, const SizeValue &val, const SizeValue &maxVal)
QSize qBound(QSize minVal, QSize val, QSize maxVal)
static Value getData(const QHash< const QtProperty *, PrivateData > &propertyMap, Value PrivateData::*data, const QtProperty *property, const Value &defaultValue=Value())
static int indexOfFontWeight(QFont::Weight w)
static Value getMinimum(const QHash< const QtProperty *, PrivateData > &propertyMap, const QtProperty *property, const Value &defaultValue=Value())
static void setSimpleMaximumData(PrivateData *data, const Value &maxVal)
static void setMinimumValue(PropertyManager *manager, PropertyManagerPrivate *managerPrivate, void(PropertyManager::*propertyChangedSignal)(QtProperty *), void(PropertyManager::*valueChangedSignal)(QtProperty *, ValueChangeParameter), void(PropertyManager::*rangeChangedSignal)(QtProperty *, ValueChangeParameter, ValueChangeParameter), QtProperty *property, const Value &minVal)
static void setBorderValue(PropertyManager *manager, PropertyManagerPrivate *managerPrivate, void(PropertyManager::*propertyChangedSignal)(QtProperty *), void(PropertyManager::*valueChangedSignal)(QtProperty *, ValueChangeParameter), void(PropertyManager::*rangeChangedSignal)(QtProperty *, ValueChangeParameter, ValueChangeParameter), QtProperty *property, Value(PrivateData::*getRangeVal)() const, void(PrivateData::*setRangeVal)(ValueChangeParameter), const Value &borderVal, void(PropertyManagerPrivate::*setSubPropertyRange)(QtProperty *, ValueChangeParameter, ValueChangeParameter, ValueChangeParameter))
static void setSimpleValue(QHash< const QtProperty *, Value > &propertyMap, PropertyManager *manager, void(PropertyManager::*propertyChangedSignal)(QtProperty *), void(PropertyManager::*valueChangedSignal)(QtProperty *, ValueChangeParameter), QtProperty *property, const Value &val)
static void setBorderValues(PropertyManager *manager, PropertyManagerPrivate *managerPrivate, void(PropertyManager::*propertyChangedSignal)(QtProperty *), void(PropertyManager::*valueChangedSignal)(QtProperty *, ValueChangeParameter), void(PropertyManager::*rangeChangedSignal)(QtProperty *, ValueChangeParameter, ValueChangeParameter), QtProperty *property, ValueChangeParameter minVal, ValueChangeParameter maxVal, void(PropertyManagerPrivate::*setSubPropertyRange)(QtProperty *, ValueChangeParameter, ValueChangeParameter, ValueChangeParameter))
static void setSizeMinimumData(PrivateData *data, const Value &newMinVal)
static QList< QLocale::Territory > sortedTerritories(const QList< QLocale > &locales)
static void setSimpleMinimumData(PrivateData *data, const Value &minVal)
static Value getMaximum(const QHash< const QtProperty *, PrivateData > &propertyMap, const QtProperty *property, const Value &defaultValue=Value())
static void setSizeMaximumData(PrivateData *data, const Value &newMaxVal)
static QFont::Weight weightFromIndex(int i)
static void setMaximumValue(PropertyManager *manager, PropertyManagerPrivate *managerPrivate, void(PropertyManager::*propertyChangedSignal)(QtProperty *), void(PropertyManager::*valueChangedSignal)(QtProperty *, ValueChangeParameter), void(PropertyManager::*rangeChangedSignal)(QtProperty *, ValueChangeParameter, ValueChangeParameter), QtProperty *property, const Value &maxVal)
void setMaximumValue(QDate newMaxVal)
QDate minimumValue() const
void setMinimumValue(QDate newMinVal)
QDate maximumValue() const
void setMinimumValue(QSizeF newMinVal)
QSizeF minimumValue() const
QSizeF maximumValue() const
void setMaximumValue(QSizeF newMaxVal)
QSize maximumValue() const
void setMaximumValue(QSize newMaxVal)
void setMinimumValue(QSize newMinVal)
QSize minimumValue() const