7#include <QtWidgets/qapplication.h>
8#include <QtWidgets/qlabel.h>
9#include <QtWidgets/qstyle.h>
10#include <QtWidgets/qstyleoption.h>
12#include <QtGui/qfontdatabase.h>
13#include <QtGui/qicon.h>
14#include <QtGui/qpainter.h>
16#include <QtCore/qdatetime.h>
17#include <QtCore/qhash.h>
18#include <QtCore/qlocale.h>
19#include <QtCore/qmap.h>
20#include <QtCore/qmetaobject.h>
21#include <QtCore/qregularexpression.h>
22#include <QtCore/qtimer.h>
31using DisambiguatedTranslation = std::pair<
const char *,
const char *>;
34 QFont::Thin, QFont::ExtraLight, QFont::Light, QFont::Normal, QFont::Medium, QFont::DemiBold,
35 QFont::Bold, QFont::ExtraBold, QFont::Black
40 auto it =
std::find(
std::begin(weightValues),
std::end(weightValues), w);
41 return int(it -
std::begin(weightValues));
46 return weightValues[i];
49template <
class PrivateData,
class Value>
52 data->minVal = minVal;
53 if (data->maxVal < data->minVal)
54 data->maxVal = data->minVal;
56 if (data->val < data->minVal)
57 data->val = data->minVal;
60template <
class PrivateData,
class Value>
63 data->maxVal = maxVal;
64 if (data->minVal > data->maxVal)
65 data->minVal = data->maxVal;
67 if (data->val > data->maxVal)
68 data->val = data->maxVal;
71template <
class PrivateData,
class Value>
74 data->minVal = newMinVal;
75 if (data->maxVal.width() < data->minVal.width())
76 data->maxVal.setWidth(data->minVal.width());
77 if (data->maxVal.height() < data->minVal.height())
78 data->maxVal.setHeight(data->minVal.height());
80 if (data->val.width() < data->minVal.width())
81 data->val.setWidth(data->minVal.width());
82 if (data->val.height() < data->minVal.height())
83 data->val.setHeight(data->minVal.height());
86template <
class PrivateData,
class Value>
89 data->maxVal = newMaxVal;
90 if (data->minVal.width() > data->maxVal.width())
91 data->minVal.setWidth(data->maxVal.width());
92 if (data->minVal.height() > data->maxVal.height())
93 data->minVal.setHeight(data->maxVal.height());
95 if (data->val.width() > data->maxVal.width())
96 data->val.setWidth(data->maxVal.width());
97 if (data->val.height() > data->maxVal.height())
98 data->val.setHeight(data->maxVal.height());
101template <
class SizeValue>
102static SizeValue
qBoundSize(
const SizeValue &minVal,
const SizeValue &val,
const SizeValue &maxVal)
104 SizeValue croppedVal = val;
105 if (minVal.width() > val.width())
106 croppedVal.setWidth(minVal.width());
107 else if (maxVal.width() < val.width())
108 croppedVal.setWidth(maxVal.width());
110 if (minVal.height() > val.height())
111 croppedVal.setHeight(minVal.height());
112 else if (maxVal.height() < val.height())
113 croppedVal.setHeight(maxVal.height());
121 return qBoundSize(minVal, val, maxVal);
126 return qBoundSize(minVal, val, maxVal);
132template <
class Value>
133void orderBorders(Value &minVal, Value &maxVal)
136 qSwap(minVal, maxVal);
139template <
class Value>
140static void orderSizeBorders(Value &minVal, Value &maxVal)
142 Value fromSize = minVal;
143 Value toSize = maxVal;
144 if (fromSize.width() > toSize.width()) {
145 fromSize.setWidth(maxVal.width());
146 toSize.setWidth(minVal.width());
148 if (fromSize.height() > toSize.height()) {
149 fromSize.setHeight(maxVal.height());
150 toSize.setHeight(minVal.height());
156void orderBorders(QSize &minVal, QSize &maxVal)
158 orderSizeBorders(minVal, maxVal);
161void orderBorders(QSizeF &minVal, QSizeF &maxVal)
163 orderSizeBorders(minVal, maxVal);
170template <
class Value,
class PrivateData>
171static Value
getData(
const QHash<
const QtProperty *, PrivateData> &propertyMap,
172 Value PrivateData::*data,
173 const QtProperty *property,
const Value &defaultValue = Value())
175 const auto it = propertyMap.constFind(property);
176 if (it == propertyMap.constEnd())
178 return it.value().*data;
181template <
class Value,
class PrivateData>
182static Value
getValue(
const QHash<
const QtProperty *, PrivateData> &propertyMap,
183 const QtProperty *property,
const Value &defaultValue = Value())
185 return getData<Value>(propertyMap, &PrivateData::val, property, defaultValue);
188template <
class Value,
class PrivateData>
189static Value
getMinimum(
const QHash<
const QtProperty *, PrivateData> &propertyMap,
190 const QtProperty *property,
const Value &defaultValue = Value())
192 return getData<Value>(propertyMap, &PrivateData::minVal, property, defaultValue);
195template <
class Value,
class PrivateData>
196static Value
getMaximum(
const QHash<
const QtProperty *, PrivateData> &propertyMap,
197 const QtProperty *property,
const Value &defaultValue = Value())
199 return getData<Value>(propertyMap, &PrivateData::maxVal, property, defaultValue);
202template <
class ValueChangeParameter,
class Value,
class PropertyManager>
204 PropertyManager *manager,
205 void (PropertyManager::*propertyChangedSignal)(
QtProperty *),
206 void (PropertyManager::*valueChangedSignal)(
QtProperty *, ValueChangeParameter),
209 const auto it = propertyMap.find(property);
210 if (it == propertyMap.end())
213 if (it.value() == val)
218 emit (manager->*propertyChangedSignal)(property);
219 emit (manager->*valueChangedSignal)(property, val);
222template <
class ValueChangeParameter,
class PropertyManagerPrivate,
class PropertyManager,
class Value>
223static void setValueInRange(PropertyManager *manager, PropertyManagerPrivate *managerPrivate,
224 void (PropertyManager::*propertyChangedSignal)(
QtProperty *),
225 void (PropertyManager::*valueChangedSignal)(
QtProperty *, ValueChangeParameter),
227 void (PropertyManagerPrivate::*setSubPropertyValue)(
QtProperty *, ValueChangeParameter))
229 const auto it = managerPrivate->m_values.find(property);
230 if (it == managerPrivate->m_values.end())
233 auto &data = it.value();
238 const Value oldVal = data.val;
240 data.val = qBound(data.minVal, val, data.maxVal);
242 if (data.val == oldVal)
245 if (setSubPropertyValue)
246 (managerPrivate->*setSubPropertyValue)(property, data.val);
248 emit (manager->*propertyChangedSignal)(property);
249 emit (manager->*valueChangedSignal)(property, data.val);
252template <
class ValueChangeParameter,
class PropertyManagerPrivate,
class PropertyManager,
class Value>
253static void setBorderValues(PropertyManager *manager, PropertyManagerPrivate *managerPrivate,
254 void (PropertyManager::*propertyChangedSignal)(
QtProperty *),
255 void (PropertyManager::*valueChangedSignal)(
QtProperty *, ValueChangeParameter),
256 void (PropertyManager::*rangeChangedSignal)(
QtProperty *, ValueChangeParameter, ValueChangeParameter),
257 QtProperty *property, ValueChangeParameter minVal, ValueChangeParameter maxVal,
258 void (PropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *,
259 ValueChangeParameter, ValueChangeParameter, ValueChangeParameter))
261 const auto it = managerPrivate->m_values.find(property);
262 if (it == managerPrivate->m_values.end())
265 Value fromVal = minVal;
266 Value toVal = maxVal;
267 orderBorders(fromVal, toVal);
269 auto &data = it.value();
271 if (data.minVal == fromVal && data.maxVal == toVal)
274 const Value oldVal = data.val;
276 data.setMinimumValue(fromVal);
277 data.setMaximumValue(toVal);
279 emit (manager->*rangeChangedSignal)(property, data.minVal, data.maxVal);
281 if (setSubPropertyRange)
282 (managerPrivate->*setSubPropertyRange)(property, data.minVal, data.maxVal, data.val);
284 if (data.val == oldVal)
287 emit (manager->*propertyChangedSignal)(property);
288 emit (manager->*valueChangedSignal)(property, data.val);
291template <
class ValueChangeParameter,
class PropertyManagerPrivate,
class PropertyManager,
class Value,
class PrivateData>
292static void setBorderValue(PropertyManager *manager, PropertyManagerPrivate *managerPrivate,
293 void (PropertyManager::*propertyChangedSignal)(
QtProperty *),
294 void (PropertyManager::*valueChangedSignal)(
QtProperty *, ValueChangeParameter),
295 void (PropertyManager::*rangeChangedSignal)(
QtProperty *, ValueChangeParameter, ValueChangeParameter),
297 Value (PrivateData::*getRangeVal)()
const,
298 void (PrivateData::*setRangeVal)(ValueChangeParameter),
const Value &borderVal,
299 void (PropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *,
300 ValueChangeParameter, ValueChangeParameter, ValueChangeParameter))
302 const auto it = managerPrivate->m_values.find(property);
303 if (it == managerPrivate->m_values.end())
306 PrivateData &data = it.value();
308 if ((data.*getRangeVal)() == borderVal)
311 const Value oldVal = data.val;
313 (data.*setRangeVal)(borderVal);
315 emit (manager->*rangeChangedSignal)(property, data.minVal, data.maxVal);
317 if (setSubPropertyRange)
318 (managerPrivate->*setSubPropertyRange)(property, data.minVal, data.maxVal, data.val);
320 if (data.val == oldVal)
323 emit (manager->*propertyChangedSignal)(property);
324 emit (manager->*valueChangedSignal)(property, data.val);
327template <
class ValueChangeParameter,
class PropertyManagerPrivate,
class PropertyManager,
class Value,
class PrivateData>
328static void setMinimumValue(PropertyManager *manager, PropertyManagerPrivate *managerPrivate,
329 void (PropertyManager::*propertyChangedSignal)(
QtProperty *),
330 void (PropertyManager::*valueChangedSignal)(
QtProperty *, ValueChangeParameter),
331 void (PropertyManager::*rangeChangedSignal)(
QtProperty *, ValueChangeParameter, ValueChangeParameter),
334 void (PropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *,
335 ValueChangeParameter, ValueChangeParameter, ValueChangeParameter) =
nullptr;
336 setBorderValue<ValueChangeParameter, PropertyManagerPrivate, PropertyManager, Value, PrivateData>(manager, managerPrivate,
337 propertyChangedSignal, valueChangedSignal, rangeChangedSignal,
338 property, &PropertyManagerPrivate::Data::minimumValue, &PropertyManagerPrivate::Data::setMinimumValue, minVal, setSubPropertyRange);
341template <
class ValueChangeParameter,
class PropertyManagerPrivate,
class PropertyManager,
class Value,
class PrivateData>
342static void setMaximumValue(PropertyManager *manager, PropertyManagerPrivate *managerPrivate,
343 void (PropertyManager::*propertyChangedSignal)(
QtProperty *),
344 void (PropertyManager::*valueChangedSignal)(
QtProperty *, ValueChangeParameter),
345 void (PropertyManager::*rangeChangedSignal)(
QtProperty *, ValueChangeParameter, ValueChangeParameter),
348 void (PropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *,
349 ValueChangeParameter, ValueChangeParameter, ValueChangeParameter) =
nullptr;
350 setBorderValue<ValueChangeParameter, PropertyManagerPrivate, PropertyManager, Value, PrivateData>(manager, managerPrivate,
351 propertyChangedSignal, valueChangedSignal, rangeChangedSignal,
352 property, &PropertyManagerPrivate::Data::maximumValue, &PropertyManagerPrivate::Data::setMaximumValue, maxVal, setSubPropertyRange);
358 Q_PROPERTY(QSizePolicy::Policy policy READ policy)
377 void indexToLocale(
int languageIndex,
int territoryIndex, QLocale::Language *language, QLocale::Territory *territory)
const;
378 void localeToIndex(QLocale::Language language, QLocale::Territory territory,
int *languageIndex,
int *territoryIndex)
const;
383 QStringList m_policyEnumNames;
384 QStringList m_languageEnumNames;
385 QMap<QLocale::Language, QStringList> m_territoryEnumNames;
386 QMap<
int, QLocale::Language> m_indexToLanguage;
387 QMap<QLocale::Language,
int> m_languageToIndex;
388 QMap<
int, QMap<
int, QLocale::Territory> > m_indexToTerritory;
390 QMetaEnum m_policyEnum;
395 QMultiMap<QString, QLocale::Territory> nameToTerritory;
396 for (
const QLocale &locale : locales) {
397 const auto territory = locale.territory();
398 nameToTerritory.insert(QLocale::territoryToString(territory), territory);
400 return nameToTerritory.values();
405 QMultiMap<QString, QLocale::Language> nameToLanguage;
406 for (
int l = QLocale::C, last = QLocale::LastLanguage; l <= last; ++l) {
407 const QLocale::Language language =
static_cast<QLocale::Language>(l);
408 QLocale locale(language);
409 if (locale.language() == language)
410 nameToLanguage.insert(QLocale::languageToString(language), language);
413 const QLocale system = QLocale::system();
414 if (!nameToLanguage.contains(QLocale::languageToString(system.language())))
415 nameToLanguage.insert(QLocale::languageToString(system.language()), system.language());
417 const auto languages = nameToLanguage.values();
418 for (QLocale::Language language : languages) {
419 auto locales = QLocale::matchingLocales(language, QLocale::AnyScript,
420 QLocale::AnyTerritory);
422 if (!locales.isEmpty() && !m_languageToIndex.contains(language)) {
423 const auto territories = sortedTerritories(locales);
424 qsizetype langIdx = m_languageEnumNames.size();
425 m_indexToLanguage[langIdx] = language;
426 m_languageToIndex[language] = langIdx;
427 QStringList territoryNames;
428 int territoryIdx = 0;
429 for (QLocale::Territory territory : territories) {
430 territoryNames << QLocale::territoryToString(territory);
431 m_indexToTerritory[langIdx][territoryIdx] = territory;
432 m_territoryToIndex[language][territory] = territoryIdx;
435 m_languageEnumNames << QLocale::languageToString(language);
436 m_territoryEnumNames[language] = territoryNames;
445 p = QtMetaEnumWrapper::staticMetaObject.property(
446 QtMetaEnumWrapper::staticMetaObject.propertyOffset() + 0);
447 m_policyEnum = p.enumerator();
448 const int keyCount = m_policyEnum.keyCount();
449 for (
int i = 0; i < keyCount; i++)
450 m_policyEnumNames << QLatin1StringView(m_policyEnum.key(i));
457 return static_cast<QSizePolicy::Policy>(m_policyEnum.value(index));
462 const int keyCount = m_policyEnum.keyCount();
463 for (
int i = 0; i < keyCount; i++)
464 if (indexToSizePolicy(i) == policy)
471 QLocale::Language l = QLocale::C;
472 QLocale::Territory c = QLocale::AnyTerritory;
473 const auto lit = m_indexToLanguage.constFind(languageIndex);
474 if (lit != m_indexToLanguage.cend()) {
476 const auto tit = m_indexToTerritory.constFind(languageIndex);
477 if (tit != m_indexToTerritory.end()) {
478 const auto tit2 = tit.value().constFind(territoryIndex);
479 if (tit2 != tit.value().cend())
493 const auto lit = m_languageToIndex.constFind(language);
494 if (lit != m_languageToIndex.cend()) {
496 const auto tit = m_territoryToIndex.constFind(language);
497 if (tit != m_territoryToIndex.cend()) {
498 const auto tit2 = tit.value().constFind(territory);
499 if (tit2 != tit.value().cend())
515
516
517
518
519
520
521
522
523
524
525
528
529
537
538
539QtGroupPropertyManager::~QtGroupPropertyManager() =
default;
542
543
551
552
559
560
571 Q_DECLARE_PUBLIC(QtIntPropertyManager)
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
615
616
617
618
619
620
621
622
625
626
627
628
629
630
631
632
635
636
637
638
639
640
641
642
645
646
654
655
662
663
664
665
666
667
668
671 return getValue<
int>(d_ptr->m_values, property, 0);
675
676
677
678
681 return getMinimum<
int>(d_ptr->m_values, property, 0);
685
686
687
688
691 return getMaximum<
int>(d_ptr->m_values, property, 0);
695
696
697
698
699
700
703 return getData<
int>(d_ptr->m_values, &QtIntPropertyManagerPrivate::Data::singleStep, property, 0);
707
708
711 const auto it = d_ptr->m_values.constFind(property);
712 if (it == d_ptr->m_values.constEnd())
714 return QString::number(it.value().val);
718
719
720
721
722
723
724
725
726
727
730 void (QtIntPropertyManagerPrivate::*setSubPropertyValue)(
QtProperty *,
int) =
nullptr;
733 &QtIntPropertyManager::valueChanged,
734 property, val, setSubPropertyValue);
738
739
740
741
742
743
744
745
748 setMinimumValue<
int, QtIntPropertyManagerPrivate, QtIntPropertyManager,
int, QtIntPropertyManagerPrivate::Data>(
this, d_ptr.data(),
749 &QtIntPropertyManager::propertyChanged,
750 &QtIntPropertyManager::valueChanged,
751 &QtIntPropertyManager::rangeChanged,
756
757
758
759
760
761
762
763
766 setMaximumValue<
int, QtIntPropertyManagerPrivate, QtIntPropertyManager,
int, QtIntPropertyManagerPrivate::Data>(
this, d_ptr.data(),
767 &QtIntPropertyManager::propertyChanged,
768 &QtIntPropertyManager::valueChanged,
769 &QtIntPropertyManager::rangeChanged,
774
775
776
777
778
779
780
781
782
783
784
785
786
789 void (QtIntPropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *,
int,
int,
int) =
nullptr;
792 &QtIntPropertyManager::valueChanged,
794 property, minVal, maxVal, setSubPropertyRange);
798
799
800
801
802
803
806 const auto it = d_ptr->m_values.find(property);
807 if (it == d_ptr->m_values.end())
810 QtIntPropertyManagerPrivate::Data data = it.value();
815 if (data.singleStep == step)
818 data.singleStep = step;
822 emit singleStepChanged(property, data.singleStep);
826
827
830 d_ptr->m_values[property] = QtIntPropertyManagerPrivate::Data();
834
835
838 d_ptr->m_values.remove(property);
846 Q_DECLARE_PUBLIC(QtDoublePropertyManager)
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
892
893
894
895
896
897
898
899
902
903
904
905
906
907
908
909
912
913
914
915
916
917
918
919
922
923
924
925
926
927
928
929
932
933
941
942
949
950
951
952
953
954
955
958 return getValue<
double>(d_ptr->m_values, property, 0.0);
962
963
964
965
968 return getMinimum<
double>(d_ptr->m_values, property, 0.0);
972
973
974
975
978 return getMaximum<
double>(d_ptr->m_values, property, 0.0);
982
983
984
985
986
987
990 return getData<
double>(d_ptr->m_values, &QtDoublePropertyManagerPrivate::Data::singleStep, property, 0);
994
995
996
997
1000 return getData<
int>(d_ptr->m_values, &QtDoublePropertyManagerPrivate::Data::decimals, property, 0);
1004
1005
1008 const auto it = d_ptr->m_values.constFind(property);
1009 if (it == d_ptr->m_values.constEnd())
1011 return QString::number(it.value().val,
'f', it.value().decimals);
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1027 void (QtDoublePropertyManagerPrivate::*setSubPropertyValue)(
QtProperty *,
double) =
nullptr;
1030 &QtDoublePropertyManager::valueChanged,
1031 property, val, setSubPropertyValue);
1035
1036
1037
1038
1039
1040
1043 const auto it = d_ptr->m_values.find(property);
1044 if (it == d_ptr->m_values.end())
1047 QtDoublePropertyManagerPrivate::Data data = it.value();
1052 if (data.singleStep == step)
1055 data.singleStep = step;
1059 emit singleStepChanged(property, data.singleStep);
1063
1064
1065
1066
1067
1068
1069
1070
1073 const auto it = d_ptr->m_values.find(property);
1074 if (it == d_ptr->m_values.end())
1077 QtDoublePropertyManagerPrivate::Data data = it.value();
1084 if (data.decimals == prec)
1087 data.decimals = prec;
1091 emit decimalsChanged(property, data.decimals);
1095
1096
1097
1098
1099
1100
1101
1102
1105 setMinimumValue<
double, QtDoublePropertyManagerPrivate, QtDoublePropertyManager,
double, QtDoublePropertyManagerPrivate::Data>(
this, d_ptr.data(),
1106 &QtDoublePropertyManager::propertyChanged,
1107 &QtDoublePropertyManager::valueChanged,
1108 &QtDoublePropertyManager::rangeChanged,
1113
1114
1115
1116
1117
1118
1119
1120
1123 setMaximumValue<
double, QtDoublePropertyManagerPrivate, QtDoublePropertyManager,
double, QtDoublePropertyManagerPrivate::Data>(
this, d_ptr.data(),
1124 &QtDoublePropertyManager::propertyChanged,
1125 &QtDoublePropertyManager::valueChanged,
1126 &QtDoublePropertyManager::rangeChanged,
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1146 void (QtDoublePropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *,
double,
double,
double) =
nullptr;
1149 &QtDoublePropertyManager::valueChanged,
1151 property, minVal, maxVal, setSubPropertyRange);
1155
1156
1159 d_ptr->m_values[property] = QtDoublePropertyManagerPrivate::Data();
1163
1164
1167 d_ptr->m_values.remove(property);
1175 Q_DECLARE_PUBLIC(QtStringPropertyManager)
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1211
1212
1213
1214
1215
1216
1217
1218
1221
1222
1223
1224
1225
1226
1227
1228
1231
1232
1236 d_ptr->q_ptr =
this;
1240
1241
1248
1249
1250
1251
1252
1253
1254
1257 return getValue<QString>(d_ptr->m_values, property);
1261
1262
1263
1264
1265
1266
1267
1270 return getData<QRegularExpression>(d_ptr->m_values, &QtStringPropertyManagerPrivate::Data::regExp, property, QRegularExpression());
1274
1275
1278 const auto it = d_ptr->m_values.constFind(property);
1279 if (it == d_ptr->m_values.constEnd())
1281 return it.value().val;
1285
1286
1287
1288
1289
1290
1291
1292
1293
1296 const auto it = d_ptr->m_values.find(property);
1297 if (it == d_ptr->m_values.end())
1300 QtStringPropertyManagerPrivate::Data data = it.value();
1302 if (data.val == val)
1305 if (data.regExp.isValid() && !data.regExp.pattern().isEmpty()
1306 && !data.regExp.match(val).hasMatch()) {
1314 emit propertyChanged(property);
1315 emit valueChanged(property, data.val);
1319
1320
1321
1322
1325 const auto it = d_ptr->m_values.find(property);
1326 if (it == d_ptr->m_values.end())
1329 QtStringPropertyManagerPrivate::Data data = it.value() ;
1331 if (data.regExp == regExp)
1334 data.regExp = regExp;
1338 emit regExpChanged(property, data.regExp);
1342
1343
1346 d_ptr->m_values[property] = QtStringPropertyManagerPrivate::Data();
1350
1351
1354 d_ptr->m_values.remove(property);
1402 Q_DECLARE_PUBLIC(QtBoolPropertyManager)
1412 m_checkedIcon(
new QCheckBoxIconEngine(
true)),
1413 m_uncheckedIcon(
new QCheckBoxIconEngine(
false))
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1436
1437
1438
1439
1440
1441
1444
1445
1449 d_ptr->q_ptr =
this;
1453
1454
1461
1462
1463
1464
1465
1466
1467
1470 return d_ptr->m_values.value(property,
false);
1474
1475
1478 const auto it = d_ptr->m_values.constFind(property);
1479 if (it == d_ptr->m_values.constEnd())
1482 static const QString trueText = tr(
"True");
1483 static const QString falseText = tr(
"False");
1484 return it.value() ? trueText : falseText;
1488
1489
1492 const auto it = d_ptr->m_values.constFind(property);
1493 if (it == d_ptr->m_values.constEnd())
1496 return it.value() ? d_ptr->m_checkedIcon : d_ptr->m_uncheckedIcon;
1500
1501
1502
1503
1504
1505
1510 &QtBoolPropertyManager::valueChanged,
1515
1516
1519 d_ptr->m_values[property] =
false;
1523
1524
1527 d_ptr->m_values.remove(property);
1535 Q_DECLARE_PUBLIC(QtDatePropertyManager)
1557 m_format(QtPropertyBrowserUtils::dateFormat())
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1587
1588
1589
1590
1591
1592
1593
1594
1597
1598
1599
1600
1601
1602
1603
1604
1607
1608
1615
1616
1623
1624
1625
1626
1627
1628
1629
1632 return getValue<QDate>(d_ptr->m_values, property);
1636
1637
1638
1639
1642 return getMinimum<QDate>(d_ptr->m_values, property);
1646
1647
1648
1649
1652 return getMaximum<QDate>(d_ptr->m_values, property);
1656
1657
1660 const auto it = d_ptr->m_values.constFind(property);
1661 if (it == d_ptr->m_values.constEnd())
1663 return it.value().val.toString(d_ptr->m_format);
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1679 void (QtDatePropertyManagerPrivate::*setSubPropertyValue)(
QtProperty *, QDate) =
nullptr;
1682 &QtDatePropertyManager::valueChanged,
1683 property, val, setSubPropertyValue);
1687
1688
1689
1690
1691
1692
1693
1694
1699 &QtDatePropertyManager::valueChanged,
1705
1706
1707
1708
1709
1710
1711
1712
1717 &QtDatePropertyManager::valueChanged,
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1738 void (QtDatePropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *, QDate, QDate, QDate) =
nullptr;
1741 &QtDatePropertyManager::valueChanged,
1743 property, minVal, maxVal, setSubPropertyRange);
1747
1748
1751 d_ptr->m_values[property] = QtDatePropertyManagerPrivate::Data();
1755
1756
1759 d_ptr->m_values.remove(property);
1767 Q_DECLARE_PUBLIC(QtTimePropertyManager)
1778 m_format(QtPropertyBrowserUtils::timeFormat())
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1801
1802
1803
1804
1805
1806
1807
1808
1811
1812
1819
1820
1827
1828
1829
1830
1831
1832
1833
1836 return d_ptr->m_values.value(property, QTime());
1840
1841
1844 const auto it = d_ptr->m_values.constFind(property);
1845 if (it == d_ptr->m_values.constEnd())
1847 return it.value().toString(d_ptr->m_format);
1851
1852
1853
1854
1855
1856
1861 &QtTimePropertyManager::valueChanged,
1866
1867
1870 d_ptr->m_values[property] = QTime::currentTime();
1874
1875
1878 d_ptr->m_values.remove(property);
1886 Q_DECLARE_PUBLIC(QtDateTimePropertyManager)
1897 m_format(QtPropertyBrowserUtils::dateTimeFormat())
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1918
1919
1920
1921
1922
1923
1926
1927
1934
1935
1942
1943
1944
1945
1946
1947
1948
1951 return d_ptr->m_values.value(property, QDateTime());
1955
1956
1959 const auto it = d_ptr->m_values.constFind(property);
1960 if (it == d_ptr->m_values.constEnd())
1962 return it.value().toString(d_ptr->m_format);
1966
1967
1968
1969
1970
1971
1976 &QtDateTimePropertyManager::valueChanged,
1981
1982
1985 d_ptr->m_values[property] = QDateTime::currentDateTime();
1989
1990
1993 d_ptr->m_values.remove(property);
2001 Q_DECLARE_PUBLIC(QtKeySequencePropertyManager)
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2027
2028
2029
2030
2031
2032
2035
2036
2040 d_ptr->q_ptr =
this;
2044
2045
2052
2053
2054
2055
2056
2057
2058
2061 return d_ptr->m_values.value(property, QKeySequence());
2065
2066
2069 const auto it = d_ptr->m_values.constFind(property);
2070 if (it == d_ptr->m_values.constEnd())
2072 return it.value().toString(QKeySequence::NativeText);
2076
2077
2078
2079
2080
2081
2084 setSimpleValue<
const QKeySequence &, QKeySequence, QtKeySequencePropertyManager>(d_ptr->m_values,
this,
2085 &QtKeySequencePropertyManager::propertyChanged,
2086 &QtKeySequencePropertyManager::valueChanged,
2091
2092
2095 d_ptr->m_values[property] = QKeySequence();
2099
2100
2103 d_ptr->m_values.remove(property);
2111 Q_DECLARE_PUBLIC(QtCharPropertyManager)
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2135
2136
2137
2138
2139
2140
2143
2144
2148 d_ptr->q_ptr =
this;
2152
2153
2160
2161
2162
2163
2164
2165
2166
2169 return d_ptr->m_values.value(property, QChar());
2173
2174
2177 const auto it = d_ptr->m_values.constFind(property);
2178 if (it == d_ptr->m_values.constEnd())
2180 const QChar c = it.value();
2181 return c.isNull() ? QString() : QString(c);
2185
2186
2187
2188
2189
2190
2193 setSimpleValue<
const QChar &, QChar, QtCharPropertyManager>(d_ptr->m_values,
this,
2194 &QtCharPropertyManager::propertyChanged,
2195 &QtCharPropertyManager::valueChanged,
2200
2201
2204 d_ptr->m_values[property] = QChar();
2208
2209
2212 d_ptr->m_values.remove(property);
2220 Q_DECLARE_PUBLIC(QtLocalePropertyManager)
2239 if (
QtProperty *prop = m_languageToProperty.value(property,
nullptr)) {
2240 const QLocale loc = m_values[prop];
2241 QLocale::Language newLanguage = loc.language();
2242 QLocale::Territory newTerritory = loc.territory();
2243 metaEnumProvider()->indexToLocale(value, 0, &newLanguage,
nullptr);
2244 QLocale newLoc(newLanguage, newTerritory);
2245 q_ptr->setValue(prop, newLoc);
2246 }
else if (
QtProperty *prop = m_territoryToProperty.value(property,
nullptr)) {
2247 const QLocale loc = m_values[prop];
2248 QLocale::Language newLanguage = loc.language();
2249 QLocale::Territory newTerritory = loc.territory();
2251 QLocale newLoc(newLanguage, newTerritory);
2252 q_ptr->setValue(prop, newLoc);
2258 if (
QtProperty *subProp = m_languageToProperty.value(property,
nullptr)) {
2259 m_propertyToLanguage[subProp] =
nullptr;
2260 m_languageToProperty.remove(property);
2261 }
else if (
QtProperty *subProp = m_territoryToProperty.value(property,
nullptr)) {
2262 m_propertyToTerritory[subProp] =
nullptr;
2263 m_territoryToProperty.remove(property);
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2292
2293
2294
2295
2296
2297
2298
2299
2302
2303
2307 d_ptr->q_ptr =
this;
2309 d_ptr->m_enumPropertyManager =
new QtEnumPropertyManager(
this);
2310 connect(d_ptr->m_enumPropertyManager, &QtEnumPropertyManager::valueChanged,
this,
2311 [
this](
QtProperty *property,
int value) { d_ptr->slotEnumChanged(property, value); });
2313 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
2317
2318
2325
2326
2327
2328
2329
2330
2331
2332
2333
2336 return d_ptr->m_enumPropertyManager;
2340
2341
2342
2343
2344
2345
2346
2349 return d_ptr->m_values.value(property, QLocale());
2353
2354
2357 const auto it = d_ptr->m_values.constFind(property);
2358 if (it == d_ptr->m_values.constEnd())
2361 const QLocale &loc = it.value();
2364 int territoryIdx = 0;
2366 me->localeToIndex(loc.language(), loc.territory(), &langIdx, &territoryIdx);
2368 qWarning(
"QtLocalePropertyManager::valueText: Unknown language %d", loc.language());
2369 return tr(
"<Invalid>");
2371 QString languageName = me->languageEnumNames().at(langIdx);
2372 if (territoryIdx < 0) {
2373 qWarning(
"QtLocalePropertyManager::valueText: Unknown territory %d for %s", loc.territory(), qPrintable(languageName));
2374 return languageName;
2376 const QString territoryName = me->territoryEnumNames(loc.language()).at(territoryIdx);
2377 return tr(
"%1, %2").arg(languageName, territoryName);
2381
2382
2383
2384
2385
2386
2387
2390 const auto it = d_ptr->m_values.find(property);
2391 if (it == d_ptr->m_values.end())
2394 const QLocale &loc = it.value();
2401 int territoryIdx = 0;
2402 metaEnumProvider()->localeToIndex(val.language(), val.territory(), &langIdx, &territoryIdx);
2403 if (loc.language() != val.language()) {
2404 d_ptr->m_enumPropertyManager->setValue(d_ptr->m_propertyToLanguage.value(property), langIdx);
2405 d_ptr->m_enumPropertyManager->setEnumNames(d_ptr->m_propertyToTerritory.value(property),
2406 metaEnumProvider()->territoryEnumNames(val.language()));
2408 d_ptr->m_enumPropertyManager->setValue(d_ptr->m_propertyToTerritory.value(property), territoryIdx);
2410 emit propertyChanged(property);
2411 emit valueChanged(property, val);
2415
2416
2420 d_ptr->m_values[property] = val;
2423 int territoryIdx = 0;
2424 metaEnumProvider()->localeToIndex(val.language(), val.territory(), &langIdx, &territoryIdx);
2426 QtProperty *languageProp = d_ptr->m_enumPropertyManager->addProperty();
2427 languageProp->setPropertyName(tr(
"Language"));
2428 d_ptr->m_enumPropertyManager->setEnumNames(languageProp, metaEnumProvider()->languageEnumNames());
2429 d_ptr->m_enumPropertyManager->setValue(languageProp, langIdx);
2430 d_ptr->m_propertyToLanguage[property] = languageProp;
2431 d_ptr->m_languageToProperty[languageProp] = property;
2434 QtProperty *territoryProp = d_ptr->m_enumPropertyManager->addProperty();
2435 territoryProp->setPropertyName(tr(
"Territory"));
2436 d_ptr->m_enumPropertyManager->setEnumNames(territoryProp, metaEnumProvider()->territoryEnumNames(val.language()));
2437 d_ptr->m_enumPropertyManager->setValue(territoryProp, territoryIdx);
2438 d_ptr->m_propertyToTerritory[property] = territoryProp;
2439 d_ptr->m_territoryToProperty[territoryProp] = property;
2444
2445
2448 QtProperty *languageProp = d_ptr->m_propertyToLanguage[property];
2450 d_ptr->m_languageToProperty.remove(languageProp);
2451 delete languageProp;
2453 d_ptr->m_propertyToLanguage.remove(property);
2455 QtProperty *territoryProp = d_ptr->m_propertyToTerritory[property];
2456 if (territoryProp) {
2457 d_ptr->m_territoryToProperty.remove(territoryProp);
2458 delete territoryProp;
2460 d_ptr->m_propertyToTerritory.remove(property);
2462 d_ptr->m_values.remove(property);
2470 Q_DECLARE_PUBLIC(QtPointPropertyManager)
2489 if (
QtProperty *xprop = m_xToProperty.value(property,
nullptr)) {
2490 QPoint p = m_values[xprop];
2492 q_ptr->setValue(xprop, p);
2493 }
else if (
QtProperty *yprop = m_yToProperty.value(property,
nullptr)) {
2494 QPoint p = m_values[yprop];
2496 q_ptr->setValue(yprop, p);
2502 if (
QtProperty *pointProp = m_xToProperty.value(property,
nullptr)) {
2503 m_propertyToX[pointProp] =
nullptr;
2504 m_xToProperty.remove(property);
2505 }
else if (
QtProperty *pointProp = m_yToProperty.value(property,
nullptr)) {
2506 m_propertyToY[pointProp] =
nullptr;
2507 m_yToProperty.remove(property);
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2535
2536
2537
2538
2539
2540
2541
2542
2545
2546
2550 d_ptr->q_ptr =
this;
2552 d_ptr->m_intPropertyManager =
new QtIntPropertyManager(
this);
2553 connect(d_ptr->m_intPropertyManager, &QtIntPropertyManager::valueChanged,
this,
2554 [
this](
QtProperty *property,
int value) { d_ptr->slotIntChanged(property, value); });
2556 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
2560
2561
2568
2569
2570
2571
2572
2573
2574
2575
2576
2579 return d_ptr->m_intPropertyManager;
2583
2584
2585
2586
2587
2588
2589
2592 return d_ptr->m_values.value(property, QPoint());
2596
2597
2600 const auto it = d_ptr->m_values.constFind(property);
2601 if (it == d_ptr->m_values.constEnd())
2603 const QPoint v = it.value();
2604 return tr(
"(%1, %2)").arg(v.x()).arg(v.y());
2608
2609
2610
2611
2612
2613
2614
2617 const auto it = d_ptr->m_values.find(property);
2618 if (it == d_ptr->m_values.end())
2621 if (it.value() == val)
2625 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToX[property], val.x());
2626 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToY[property], val.y());
2628 emit propertyChanged(property);
2629 emit valueChanged(property, val);
2633
2634
2637 d_ptr->m_values[property] = QPoint(0, 0);
2639 QtProperty *xProp = d_ptr->m_intPropertyManager->addProperty();
2640 xProp->setPropertyName(tr(
"X"));
2641 d_ptr->m_intPropertyManager->setValue(xProp, 0);
2642 d_ptr->m_propertyToX[property] = xProp;
2643 d_ptr->m_xToProperty[xProp] = property;
2646 QtProperty *yProp = d_ptr->m_intPropertyManager->addProperty();
2647 yProp->setPropertyName(tr(
"Y"));
2648 d_ptr->m_intPropertyManager->setValue(yProp, 0);
2649 d_ptr->m_propertyToY[property] = yProp;
2650 d_ptr->m_yToProperty[yProp] = property;
2655
2656
2659 QtProperty *xProp = d_ptr->m_propertyToX[property];
2661 d_ptr->m_xToProperty.remove(xProp);
2664 d_ptr->m_propertyToX.remove(property);
2666 QtProperty *yProp = d_ptr->m_propertyToY[property];
2668 d_ptr->m_yToProperty.remove(yProp);
2671 d_ptr->m_propertyToY.remove(property);
2673 d_ptr->m_values.remove(property);
2681 Q_DECLARE_PUBLIC(QtPointFPropertyManager)
2706 if (
QtProperty *prop = m_xToProperty.value(property,
nullptr)) {
2707 QPointF p = m_values[prop].val;
2709 q_ptr->setValue(prop, p);
2710 }
else if (
QtProperty *prop = m_yToProperty.value(property,
nullptr)) {
2711 QPointF p = m_values[prop].val;
2713 q_ptr->setValue(prop, p);
2719 if (
QtProperty *pointProp = m_xToProperty.value(property,
nullptr)) {
2720 m_propertyToX[pointProp] =
nullptr;
2721 m_xToProperty.remove(property);
2722 }
else if (
QtProperty *pointProp = m_yToProperty.value(property,
nullptr)) {
2723 m_propertyToY[pointProp] =
nullptr;
2724 m_yToProperty.remove(property);
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2752
2753
2754
2755
2756
2757
2758
2759
2762
2763
2764
2765
2766
2767
2768
2769
2772
2773
2777 d_ptr->q_ptr =
this;
2779 d_ptr->m_doublePropertyManager =
new QtDoublePropertyManager(
this);
2780 connect(d_ptr->m_doublePropertyManager, &QtDoublePropertyManager::valueChanged,
this,
2781 [
this](
QtProperty *property,
double value) { d_ptr->slotDoubleChanged(property, value); });
2783 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
2787
2788
2795
2796
2797
2798
2799
2800
2801
2802
2803
2806 return d_ptr->m_doublePropertyManager;
2810
2811
2812
2813
2814
2815
2816
2819 return getValue<QPointF>(d_ptr->m_values, property);
2823
2824
2825
2826
2829 return getData<
int>(d_ptr->m_values, &QtPointFPropertyManagerPrivate::Data::decimals, property, 0);
2833
2834
2837 const auto it = d_ptr->m_values.constFind(property);
2838 if (it == d_ptr->m_values.constEnd())
2840 const QPointF v = it.value().val;
2841 const int dec = it.value().decimals;
2842 return tr(
"(%1, %2)").arg(QString::number(v.x(),
'f', dec),
2843 QString::number(v.y(),
'f', dec));
2847
2848
2849
2850
2851
2852
2853
2856 const auto it = d_ptr->m_values.find(property);
2857 if (it == d_ptr->m_values.end())
2860 if (it.value().val == val)
2863 it.value().val = val;
2864 d_ptr->m_doublePropertyManager->setValue(d_ptr->m_propertyToX[property], val.x());
2865 d_ptr->m_doublePropertyManager->setValue(d_ptr->m_propertyToY[property], val.y());
2867 emit propertyChanged(property);
2868 emit valueChanged(property, val);
2872
2873
2874
2875
2876
2877
2878
2879
2882 const auto it = d_ptr->m_values.find(property);
2883 if (it == d_ptr->m_values.end())
2886 QtPointFPropertyManagerPrivate::Data data = it.value();
2893 if (data.decimals == prec)
2896 data.decimals = prec;
2897 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToX[property], prec);
2898 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToY[property], prec);
2902 emit decimalsChanged(property, data.decimals);
2906
2907
2910 d_ptr->m_values[property] = QtPointFPropertyManagerPrivate::Data();
2912 QtProperty *xProp = d_ptr->m_doublePropertyManager->addProperty();
2913 xProp->setPropertyName(tr(
"X"));
2914 d_ptr->m_doublePropertyManager->setDecimals(xProp, decimals(property));
2915 d_ptr->m_doublePropertyManager->setValue(xProp, 0);
2916 d_ptr->m_propertyToX[property] = xProp;
2917 d_ptr->m_xToProperty[xProp] = property;
2920 QtProperty *yProp = d_ptr->m_doublePropertyManager->addProperty();
2921 yProp->setPropertyName(tr(
"Y"));
2922 d_ptr->m_doublePropertyManager->setDecimals(yProp, decimals(property));
2923 d_ptr->m_doublePropertyManager->setValue(yProp, 0);
2924 d_ptr->m_propertyToY[property] = yProp;
2925 d_ptr->m_yToProperty[yProp] = property;
2930
2931
2934 QtProperty *xProp = d_ptr->m_propertyToX[property];
2936 d_ptr->m_xToProperty.remove(xProp);
2939 d_ptr->m_propertyToX.remove(property);
2941 QtProperty *yProp = d_ptr->m_propertyToY[property];
2943 d_ptr->m_yToProperty.remove(yProp);
2946 d_ptr->m_propertyToY.remove(property);
2948 d_ptr->m_values.remove(property);
2956 Q_DECLARE_PUBLIC(QtSizePropertyManager)
2963 QSize minVal, QSize maxVal, QSize val);
2989 if (
QtProperty *prop = m_wToProperty.value(property,
nullptr)) {
2990 QSize s = m_values[prop].val;
2992 q_ptr->setValue(prop, s);
2993 }
else if (
QtProperty *prop = m_hToProperty.value(property,
nullptr)) {
2994 QSize s = m_values[prop].val;
2996 q_ptr->setValue(prop, s);
3002 if (
QtProperty *pointProp = m_wToProperty.value(property,
nullptr)) {
3003 m_propertyToW[pointProp] =
nullptr;
3004 m_wToProperty.remove(property);
3005 }
else if (
QtProperty *pointProp = m_hToProperty.value(property,
nullptr)) {
3006 m_propertyToH[pointProp] =
nullptr;
3007 m_hToProperty.remove(property);
3018 QSize minVal, QSize maxVal, QSize val)
3020 QtProperty *wProperty = m_propertyToW.value(property);
3021 QtProperty *hProperty = m_propertyToH.value(property);
3029
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
3061
3062
3063
3064
3065
3066
3067
3068
3071
3072
3073
3074
3075
3076
3077
3078
3081
3082
3086 d_ptr->q_ptr =
this;
3088 d_ptr->m_intPropertyManager =
new QtIntPropertyManager(
this);
3089 connect(d_ptr->m_intPropertyManager, &QtIntPropertyManager::valueChanged,
this,
3090 [
this](
QtProperty *property,
int value) { d_ptr->slotIntChanged(property, value); });
3092 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
3096
3097
3104
3105
3106
3107
3108
3109
3110
3111
3112
3115 return d_ptr->m_intPropertyManager;
3119
3120
3121
3122
3123
3124
3125
3128 return getValue<QSize>(d_ptr->m_values, property);
3132
3133
3134
3135
3138 return getMinimum<QSize>(d_ptr->m_values, property);
3142
3143
3144
3145
3148 return getMaximum<QSize>(d_ptr->m_values, property);
3152
3153
3156 const auto it = d_ptr->m_values.constFind(property);
3157 if (it == d_ptr->m_values.constEnd())
3159 const QSize v = it.value().val;
3160 return tr(
"%1 x %2").arg(v.width()).arg(v.height());
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3176 setValueInRange<QSize, QtSizePropertyManagerPrivate, QtSizePropertyManager,
const QSize>(
this, d_ptr.data(),
3177 &QtSizePropertyManager::propertyChanged,
3178 &QtSizePropertyManager::valueChanged,
3179 property, val, &QtSizePropertyManagerPrivate::setValue);
3183
3184
3185
3186
3187
3188
3189
3190
3193 setBorderValue<QSize, QtSizePropertyManagerPrivate, QtSizePropertyManager, QSize, QtSizePropertyManagerPrivate::Data>(
this, d_ptr.data(),
3194 &QtSizePropertyManager::propertyChanged,
3195 &QtSizePropertyManager::valueChanged,
3196 &QtSizePropertyManager::rangeChanged,
3198 &QtSizePropertyManagerPrivate::Data::minimumValue,
3199 &QtSizePropertyManagerPrivate::Data::setMinimumValue,
3200 minVal, &QtSizePropertyManagerPrivate::setRange);
3204
3205
3206
3207
3208
3209
3210
3211
3214 setBorderValue<QSize, QtSizePropertyManagerPrivate, QtSizePropertyManager, QSize, QtSizePropertyManagerPrivate::Data>(
this, d_ptr.data(),
3215 &QtSizePropertyManager::propertyChanged,
3216 &QtSizePropertyManager::valueChanged,
3217 &QtSizePropertyManager::rangeChanged,
3219 &QtSizePropertyManagerPrivate::Data::maximumValue,
3220 &QtSizePropertyManagerPrivate::Data::setMaximumValue,
3221 maxVal, &QtSizePropertyManagerPrivate::setRange);
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3240 setBorderValues<QSize, QtSizePropertyManagerPrivate, QtSizePropertyManager, QSize>(
this, d_ptr.data(),
3241 &QtSizePropertyManager::propertyChanged,
3242 &QtSizePropertyManager::valueChanged,
3243 &QtSizePropertyManager::rangeChanged,
3244 property, minVal, maxVal, &QtSizePropertyManagerPrivate::setRange);
3248
3249
3252 d_ptr->m_values[property] = QtSizePropertyManagerPrivate::Data();
3254 QtProperty *wProp = d_ptr->m_intPropertyManager->addProperty();
3255 wProp->setPropertyName(tr(
"Width"));
3256 d_ptr->m_intPropertyManager->setValue(wProp, 0);
3257 d_ptr->m_intPropertyManager->setMinimum(wProp, 0);
3258 d_ptr->m_propertyToW[property] = wProp;
3259 d_ptr->m_wToProperty[wProp] = property;
3262 QtProperty *hProp = d_ptr->m_intPropertyManager->addProperty();
3263 hProp->setPropertyName(tr(
"Height"));
3264 d_ptr->m_intPropertyManager->setValue(hProp, 0);
3265 d_ptr->m_intPropertyManager->setMinimum(hProp, 0);
3266 d_ptr->m_propertyToH[property] = hProp;
3267 d_ptr->m_hToProperty[hProp] = property;
3272
3273
3276 QtProperty *wProp = d_ptr->m_propertyToW[property];
3278 d_ptr->m_wToProperty.remove(wProp);
3281 d_ptr->m_propertyToW.remove(property);
3283 QtProperty *hProp = d_ptr->m_propertyToH[property];
3285 d_ptr->m_hToProperty.remove(hProp);
3288 d_ptr->m_propertyToH.remove(property);
3290 d_ptr->m_values.remove(property);
3298 Q_DECLARE_PUBLIC(QtSizeFPropertyManager)
3305 QSizeF minVal, QSizeF maxVal, QSizeF val);
3332 if (
QtProperty *prop = m_wToProperty.value(property,
nullptr)) {
3333 QSizeF s = m_values[prop].val;
3335 q_ptr->setValue(prop, s);
3336 }
else if (
QtProperty *prop = m_hToProperty.value(property,
nullptr)) {
3337 QSizeF s = m_values[prop].val;
3339 q_ptr->setValue(prop, s);
3345 if (
QtProperty *pointProp = m_wToProperty.value(property,
nullptr)) {
3346 m_propertyToW[pointProp] =
nullptr;
3347 m_wToProperty.remove(property);
3348 }
else if (
QtProperty *pointProp = m_hToProperty.value(property,
nullptr)) {
3349 m_propertyToH[pointProp] =
nullptr;
3350 m_hToProperty.remove(property);
3361 QSizeF minVal, QSizeF maxVal, QSizeF val)
3370
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
3402
3403
3404
3405
3406
3407
3408
3409
3412
3413
3414
3415
3416
3417
3418
3419
3422
3423
3424
3425
3426
3427
3428
3429
3432
3433
3437 d_ptr->q_ptr =
this;
3439 d_ptr->m_doublePropertyManager =
new QtDoublePropertyManager(
this);
3440 connect(d_ptr->m_doublePropertyManager, &QtDoublePropertyManager::valueChanged,
this,
3441 [
this](
QtProperty *property,
double value) { d_ptr->slotDoubleChanged(property, value); });
3443 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
3447
3448
3455
3456
3457
3458
3459
3460
3461
3462
3463
3466 return d_ptr->m_doublePropertyManager;
3470
3471
3472
3473
3474
3475
3476
3479 return getValue<QSizeF>(d_ptr->m_values, property);
3483
3484
3485
3486
3493
3494
3495
3496
3499 return getMinimum<QSizeF>(d_ptr->m_values, property);
3503
3504
3505
3506
3509 return getMaximum<QSizeF>(d_ptr->m_values, property);
3513
3514
3517 const auto it = d_ptr->m_values.constFind(property);
3518 if (it == d_ptr->m_values.constEnd())
3520 const QSizeF v = it.value().val;
3521 const int dec = it.value().decimals;
3522 return tr(
"%1 x %2").arg(QString::number(v.width(),
'f', dec),
3523 QString::number(v.height(),
'f', dec));
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3539 setValueInRange<QSizeF, QtSizeFPropertyManagerPrivate, QtSizeFPropertyManager, QSizeF>(
this, d_ptr.data(),
3540 &QtSizeFPropertyManager::propertyChanged,
3541 &QtSizeFPropertyManager::valueChanged,
3542 property, val, &QtSizeFPropertyManagerPrivate::setValue);
3546
3547
3548
3549
3550
3551
3552
3553
3556 const auto it = d_ptr->m_values.find(property);
3557 if (it == d_ptr->m_values.end())
3571 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToW[property], prec);
3572 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToH[property], prec);
3576 emit decimalsChanged(property, data
.decimals);
3580
3581
3582
3583
3584
3585
3586
3587
3590 setBorderValue<QSizeF, QtSizeFPropertyManagerPrivate, QtSizeFPropertyManager, QSizeF, QtSizeFPropertyManagerPrivate::Data>(
this, d_ptr.data(),
3591 &QtSizeFPropertyManager::propertyChanged,
3592 &QtSizeFPropertyManager::valueChanged,
3593 &QtSizeFPropertyManager::rangeChanged,
3595 &QtSizeFPropertyManagerPrivate::Data::minimumValue,
3596 &QtSizeFPropertyManagerPrivate::Data::setMinimumValue,
3597 minVal, &QtSizeFPropertyManagerPrivate::setRange);
3601
3602
3603
3604
3605
3606
3607
3608
3611 setBorderValue<QSizeF, QtSizeFPropertyManagerPrivate, QtSizeFPropertyManager, QSizeF, QtSizeFPropertyManagerPrivate::Data>(
this, d_ptr.data(),
3612 &QtSizeFPropertyManager::propertyChanged,
3613 &QtSizeFPropertyManager::valueChanged,
3614 &QtSizeFPropertyManager::rangeChanged,
3616 &QtSizeFPropertyManagerPrivate::Data::maximumValue,
3617 &QtSizeFPropertyManagerPrivate::Data::setMaximumValue,
3618 maxVal, &QtSizeFPropertyManagerPrivate::setRange);
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3637 setBorderValues<QSizeF, QtSizeFPropertyManagerPrivate, QtSizeFPropertyManager, QSizeF>(
this, d_ptr.data(),
3638 &QtSizeFPropertyManager::propertyChanged,
3639 &QtSizeFPropertyManager::valueChanged,
3640 &QtSizeFPropertyManager::rangeChanged,
3641 property, minVal, maxVal, &QtSizeFPropertyManagerPrivate::setRange);
3645
3646
3649 d_ptr->m_values[property] = QtSizeFPropertyManagerPrivate::Data();
3651 QtProperty *wProp = d_ptr->m_doublePropertyManager->addProperty();
3652 wProp->setPropertyName(tr(
"Width"));
3653 d_ptr->m_doublePropertyManager->setDecimals(wProp, decimals(property));
3654 d_ptr->m_doublePropertyManager->setValue(wProp, 0);
3655 d_ptr->m_doublePropertyManager->setMinimum(wProp, 0);
3656 d_ptr->m_propertyToW[property] = wProp;
3657 d_ptr->m_wToProperty[wProp] = property;
3660 QtProperty *hProp = d_ptr->m_doublePropertyManager->addProperty();
3661 hProp->setPropertyName(tr(
"Height"));
3662 d_ptr->m_doublePropertyManager->setDecimals(hProp, decimals(property));
3663 d_ptr->m_doublePropertyManager->setValue(hProp, 0);
3664 d_ptr->m_doublePropertyManager->setMinimum(hProp, 0);
3665 d_ptr->m_propertyToH[property] = hProp;
3666 d_ptr->m_hToProperty[hProp] = property;
3671
3672
3675 QtProperty *wProp = d_ptr->m_propertyToW[property];
3677 d_ptr->m_wToProperty.remove(wProp);
3680 d_ptr->m_propertyToW.remove(property);
3682 QtProperty *hProp = d_ptr->m_propertyToH[property];
3684 d_ptr->m_hToProperty.remove(hProp);
3687 d_ptr->m_propertyToH.remove(property);
3689 d_ptr->m_values.remove(property);
3697 Q_DECLARE_PUBLIC(QtRectPropertyManager)
3727 if (
QtProperty *prop = m_xToProperty.value(property,
nullptr)) {
3728 QRect r = m_values[prop].val;
3730 q_ptr->setValue(prop, r);
3731 }
else if (
QtProperty *prop = m_yToProperty.value(property)) {
3732 QRect r = m_values[prop].val;
3734 q_ptr->setValue(prop, r);
3735 }
else if (
QtProperty *prop = m_wToProperty.value(property,
nullptr)) {
3736 Data data = m_values[prop];
3739 if (!data.constraint.isNull() && data.constraint.x() + data.constraint.width() < r.x() + r.width()) {
3740 r.moveLeft(data.constraint.left() + data.constraint.width() - r.width());
3742 q_ptr->setValue(prop, r);
3743 }
else if (
QtProperty *prop = m_hToProperty.value(property,
nullptr)) {
3744 Data data = m_values[prop];
3747 if (!data.constraint.isNull() && data.constraint.y() + data.constraint.height() < r.y() + r.height()) {
3748 r.moveTop(data.constraint.top() + data.constraint.height() - r.height());
3750 q_ptr->setValue(prop, r);
3756 if (
QtProperty *pointProp = m_xToProperty.value(property,
nullptr)) {
3757 m_propertyToX[pointProp] =
nullptr;
3758 m_xToProperty.remove(property);
3759 }
else if (
QtProperty *pointProp = m_yToProperty.value(property,
nullptr)) {
3760 m_propertyToY[pointProp] =
nullptr;
3761 m_yToProperty.remove(property);
3762 }
else if (
QtProperty *pointProp = m_wToProperty.value(property,
nullptr)) {
3763 m_propertyToW[pointProp] =
nullptr;
3764 m_wToProperty.remove(property);
3765 }
else if (
QtProperty *pointProp = m_hToProperty.value(property,
nullptr)) {
3766 m_propertyToH[pointProp] =
nullptr;
3767 m_hToProperty.remove(property);
3772 QRect constraint, QRect val)
3774 const bool isNull = constraint.isNull();
3775 const int left = isNull ?
std::numeric_limits<
int>::min() : constraint.left();
3776 const int right = isNull
3777 ?
std::numeric_limits<
int>::max() : constraint.left() + constraint.width();
3778 const int top = isNull ?
std::numeric_limits<
int>::min() : constraint.top();
3779 const int bottom = isNull
3780 ?
std::numeric_limits<
int>::max() : constraint.top() + constraint.height();
3781 const int width = isNull ?
std::numeric_limits<
int>::max() : constraint.width();
3782 const int height = isNull ?
std::numeric_limits<
int>::max() : constraint.height();
3796
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
3826
3827
3828
3829
3830
3831
3832
3833
3836
3837
3838
3839
3840
3841
3842
3843
3846
3847
3851 d_ptr->q_ptr =
this;
3853 d_ptr->m_intPropertyManager =
new QtIntPropertyManager(
this);
3854 connect(d_ptr->m_intPropertyManager, &QtIntPropertyManager::valueChanged,
this,
3855 [
this](
QtProperty *property,
int value) { d_ptr->slotIntChanged(property, value); });
3857 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
3861
3862
3869
3870
3871
3872
3873
3874
3875
3876
3877
3880 return d_ptr->m_intPropertyManager;
3884
3885
3886
3887
3888
3889
3890
3893 return getValue<QRect>(d_ptr->m_values, property);
3897
3898
3899
3900
3903 return getData<QRect>(d_ptr->m_values, &QtRectPropertyManagerPrivate::Data::constraint, property, QRect());
3907
3908
3911 const auto it = d_ptr->m_values.constFind(property);
3912 if (it == d_ptr->m_values.constEnd())
3914 const QRect v = it.value().val;
3915 return tr(
"[(%1, %2), %3 x %4]").arg(v.x()) .arg(v.y())
3916 .arg(v.width()).arg(v.height());
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3933 const auto it = d_ptr->m_values.find(property);
3934 if (it == d_ptr->m_values.end())
3939 QRect newRect = val.normalized();
3940 if (!data.constraint.isNull() && !data.constraint.contains(newRect)) {
3941 const QRect r1 = data.constraint;
3942 const QRect r2 = newRect;
3943 newRect.setLeft(qMax(r1.left(), r2.left()));
3944 newRect.setRight(qMin(r1.right(), r2.right()));
3945 newRect.setTop(qMax(r1.top(), r2.top()));
3946 newRect.setBottom(qMin(r1.bottom(), r2.bottom()));
3947 if (newRect.width() < 0 || newRect.height() < 0)
3951 if (data.val == newRect)
3957 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToX[property], newRect.x());
3958 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToY[property], newRect.y());
3959 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToW[property], newRect.width());
3960 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToH[property], newRect.height());
3962 emit propertyChanged(property);
3963 emit valueChanged(property, data.val);
3967
3968
3969
3970
3971
3972
3973
3974
3975
3978 const auto it = d_ptr->m_values.find(property);
3979 if (it == d_ptr->m_values.end())
3984 QRect newConstraint = constraint.normalized();
3985 if (data.constraint == newConstraint)
3988 const QRect oldVal = data.val;
3990 data.constraint = newConstraint;
3992 if (!data.constraint.isNull() && !data.constraint.contains(oldVal)) {
3993 QRect r1 = data.constraint;
3994 QRect r2 = data.val;
3996 if (r2.width() > r1.width())
3997 r2.setWidth(r1.width());
3998 if (r2.height() > r1.height())
3999 r2.setHeight(r1.height());
4000 if (r2.left() < r1.left())
4001 r2.moveLeft(r1.left());
4002 else if (r2.right() > r1.right())
4003 r2.moveRight(r1.right());
4004 if (r2.top() < r1.top())
4005 r2.moveTop(r1.top());
4006 else if (r2.bottom() > r1.bottom())
4007 r2.moveBottom(r1.bottom());
4014 emit constraintChanged(property, data.constraint);
4016 d_ptr->setConstraint(property, data.constraint, data.val);
4018 if (data.val == oldVal)
4021 emit propertyChanged(property);
4022 emit valueChanged(property, data.val);
4026
4027
4030 d_ptr->m_values[property] = QtRectPropertyManagerPrivate::Data();
4032 QtProperty *xProp = d_ptr->m_intPropertyManager->addProperty();
4033 xProp->setPropertyName(tr(
"X"));
4034 d_ptr->m_intPropertyManager->setValue(xProp, 0);
4035 d_ptr->m_propertyToX[property] = xProp;
4036 d_ptr->m_xToProperty[xProp] = property;
4039 QtProperty *yProp = d_ptr->m_intPropertyManager->addProperty();
4040 yProp->setPropertyName(tr(
"Y"));
4041 d_ptr->m_intPropertyManager->setValue(yProp, 0);
4042 d_ptr->m_propertyToY[property] = yProp;
4043 d_ptr->m_yToProperty[yProp] = property;
4046 QtProperty *wProp = d_ptr->m_intPropertyManager->addProperty();
4047 wProp->setPropertyName(tr(
"Width"));
4048 d_ptr->m_intPropertyManager->setValue(wProp, 0);
4049 d_ptr->m_intPropertyManager->setMinimum(wProp, 0);
4050 d_ptr->m_propertyToW[property] = wProp;
4051 d_ptr->m_wToProperty[wProp] = property;
4054 QtProperty *hProp = d_ptr->m_intPropertyManager->addProperty();
4055 hProp->setPropertyName(tr(
"Height"));
4056 d_ptr->m_intPropertyManager->setValue(hProp, 0);
4057 d_ptr->m_intPropertyManager->setMinimum(hProp, 0);
4058 d_ptr->m_propertyToH[property] = hProp;
4059 d_ptr->m_hToProperty[hProp] = property;
4064
4065
4068 QtProperty *xProp = d_ptr->m_propertyToX[property];
4070 d_ptr->m_xToProperty.remove(xProp);
4073 d_ptr->m_propertyToX.remove(property);
4075 QtProperty *yProp = d_ptr->m_propertyToY[property];
4077 d_ptr->m_yToProperty.remove(yProp);
4080 d_ptr->m_propertyToY.remove(property);
4082 QtProperty *wProp = d_ptr->m_propertyToW[property];
4084 d_ptr->m_wToProperty.remove(wProp);
4087 d_ptr->m_propertyToW.remove(property);
4089 QtProperty *hProp = d_ptr->m_propertyToH[property];
4091 d_ptr->m_hToProperty.remove(hProp);
4094 d_ptr->m_propertyToH.remove(property);
4096 d_ptr->m_values.remove(property);
4104 Q_DECLARE_PUBLIC(QtRectFPropertyManager)
4135 if (
QtProperty *prop = m_xToProperty.value(property,
nullptr)) {
4136 QRectF r = m_values[prop].val;
4138 q_ptr->setValue(prop, r);
4139 }
else if (
QtProperty *prop = m_yToProperty.value(property,
nullptr)) {
4140 QRectF r = m_values[prop].val;
4142 q_ptr->setValue(prop, r);
4143 }
else if (
QtProperty *prop = m_wToProperty.value(property,
nullptr)) {
4144 Data data = m_values[prop];
4145 QRectF r = data.val;
4147 if (!data.constraint.isNull() && data.constraint.x() + data.constraint.width() < r.x() + r.width()) {
4148 r.moveLeft(data.constraint.left() + data.constraint.width() - r.width());
4150 q_ptr->setValue(prop, r);
4151 }
else if (
QtProperty *prop = m_hToProperty.value(property,
nullptr)) {
4152 Data data = m_values[prop];
4153 QRectF r = data.val;
4155 if (!data.constraint.isNull() && data.constraint.y() + data.constraint.height() < r.y() + r.height()) {
4156 r.moveTop(data.constraint.top() + data.constraint.height() - r.height());
4158 q_ptr->setValue(prop, r);
4164 if (
QtProperty *pointProp = m_xToProperty.value(property,
nullptr)) {
4165 m_propertyToX[pointProp] =
nullptr;
4166 m_xToProperty.remove(property);
4167 }
else if (
QtProperty *pointProp = m_yToProperty.value(property,
nullptr)) {
4168 m_propertyToY[pointProp] =
nullptr;
4169 m_yToProperty.remove(property);
4170 }
else if (
QtProperty *pointProp = m_wToProperty.value(property,
nullptr)) {
4171 m_propertyToW[pointProp] =
nullptr;
4172 m_wToProperty.remove(property);
4173 }
else if (
QtProperty *pointProp = m_hToProperty.value(property,
nullptr)) {
4174 m_propertyToH[pointProp] =
nullptr;
4175 m_hToProperty.remove(property);
4180 const QRectF &constraint,
const QRectF &val)
4182 const bool isNull = constraint.isNull();
4183 const float left = isNull ?
std::numeric_limits<
float>::min() : constraint.left();
4184 const float right = isNull
4185 ?
std::numeric_limits<
float>::max() : constraint.left() + constraint.width();
4186 const float top = isNull ?
std::numeric_limits<
float>::min() : constraint.top();
4187 const float bottom = isNull
4188 ?
std::numeric_limits<
float>::max() : constraint.top() + constraint.height();
4189 const float width = isNull ?
std::numeric_limits<
float>::max() : constraint.width();
4190 const float height = isNull ?
std::numeric_limits<
float>::max() : constraint.height();
4204
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
4234
4235
4236
4237
4238
4239
4240
4241
4244
4245
4246
4247
4248
4249
4250
4251
4254
4255
4256
4257
4258
4259
4260
4261
4264
4265
4269 d_ptr->q_ptr =
this;
4271 d_ptr->m_doublePropertyManager =
new QtDoublePropertyManager(
this);
4272 connect(d_ptr->m_doublePropertyManager, &QtDoublePropertyManager::valueChanged,
this,
4273 [
this](
QtProperty *property,
double value) { d_ptr->slotDoubleChanged(property, value); });
4275 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
4279
4280
4287
4288
4289
4290
4291
4292
4293
4294
4295
4298 return d_ptr->m_doublePropertyManager;
4302
4303
4304
4305
4306
4307
4308
4311 return getValue<QRectF>(d_ptr->m_values, property);
4315
4316
4317
4318
4325
4326
4327
4328
4331 return getData<QRectF>(d_ptr->m_values, &QtRectFPropertyManagerPrivate::Data::constraint, property, QRect());
4335
4336
4339 const auto it = d_ptr->m_values.constFind(property);
4340 if (it == d_ptr->m_values.constEnd())
4342 const QRectF v = it.value().val;
4343 const int dec = it.value().decimals;
4344 return QString(tr(
"[(%1, %2), %3 x %4]").arg(QString::number(v.x(),
'f', dec),
4345 QString::number(v.y(),
'f', dec),
4346 QString::number(v.width(),
'f', dec),
4347 QString::number(v.height(),
'f', dec)));
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4364 const auto it = d_ptr->m_values.find(property);
4365 if (it == d_ptr->m_values.end())
4370 QRectF newRect = val.normalized();
4371 if (!data.constraint.isNull() && !data.constraint.contains(newRect)) {
4372 const QRectF r1 = data.constraint;
4373 const QRectF r2 = newRect;
4374 newRect.setLeft(qMax(r1.left(), r2.left()));
4375 newRect.setRight(qMin(r1.right(), r2.right()));
4376 newRect.setTop(qMax(r1.top(), r2.top()));
4377 newRect.setBottom(qMin(r1.bottom(), r2.bottom()));
4378 if (newRect.width() < 0 || newRect.height() < 0)
4382 if (data.val == newRect)
4388 d_ptr->m_doublePropertyManager->setValue(d_ptr->m_propertyToX[property], newRect.x());
4389 d_ptr->m_doublePropertyManager->setValue(d_ptr->m_propertyToY[property], newRect.y());
4390 d_ptr->m_doublePropertyManager->setValue(d_ptr->m_propertyToW[property], newRect.width());
4391 d_ptr->m_doublePropertyManager->setValue(d_ptr->m_propertyToH[property], newRect.height());
4393 emit propertyChanged(property);
4394 emit valueChanged(property, data.val);
4398
4399
4400
4401
4402
4403
4404
4405
4406
4409 const auto it = d_ptr->m_values.find(property);
4410 if (it == d_ptr->m_values.end())
4415 QRectF newConstraint = constraint.normalized();
4416 if (data.constraint == newConstraint)
4419 const QRectF oldVal = data.val;
4421 data.constraint = newConstraint;
4423 if (!data.constraint.isNull() && !data.constraint.contains(oldVal)) {
4424 QRectF r1 = data.constraint;
4425 QRectF r2 = data.val;
4427 if (r2.width() > r1.width())
4428 r2.setWidth(r1.width());
4429 if (r2.height() > r1.height())
4430 r2.setHeight(r1.height());
4431 if (r2.left() < r1.left())
4432 r2.moveLeft(r1.left());
4433 else if (r2.right() > r1.right())
4434 r2.moveRight(r1.right());
4435 if (r2.top() < r1.top())
4436 r2.moveTop(r1.top());
4437 else if (r2.bottom() > r1.bottom())
4438 r2.moveBottom(r1.bottom());
4445 emit constraintChanged(property, data.constraint);
4447 d_ptr->setConstraint(property, data.constraint, data.val);
4449 if (data.val == oldVal)
4452 emit propertyChanged(property);
4453 emit valueChanged(property, data.val);
4457
4458
4459
4460
4461
4462
4463
4464
4467 const auto it = d_ptr->m_values.find(property);
4468 if (it == d_ptr->m_values.end())
4482 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToX[property], prec);
4483 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToY[property], prec);
4484 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToW[property], prec);
4485 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToH[property], prec);
4489 emit decimalsChanged(property, data
.decimals);
4493
4494
4497 d_ptr->m_values[property] = QtRectFPropertyManagerPrivate::Data();
4499 QtProperty *xProp = d_ptr->m_doublePropertyManager->addProperty();
4500 xProp->setPropertyName(tr(
"X"));
4501 d_ptr->m_doublePropertyManager->setDecimals(xProp, decimals(property));
4502 d_ptr->m_doublePropertyManager->setValue(xProp, 0);
4503 d_ptr->m_propertyToX[property] = xProp;
4504 d_ptr->m_xToProperty[xProp] = property;
4507 QtProperty *yProp = d_ptr->m_doublePropertyManager->addProperty();
4508 yProp->setPropertyName(tr(
"Y"));
4509 d_ptr->m_doublePropertyManager->setDecimals(yProp, decimals(property));
4510 d_ptr->m_doublePropertyManager->setValue(yProp, 0);
4511 d_ptr->m_propertyToY[property] = yProp;
4512 d_ptr->m_yToProperty[yProp] = property;
4515 QtProperty *wProp = d_ptr->m_doublePropertyManager->addProperty();
4516 wProp->setPropertyName(tr(
"Width"));
4517 d_ptr->m_doublePropertyManager->setDecimals(wProp, decimals(property));
4518 d_ptr->m_doublePropertyManager->setValue(wProp, 0);
4519 d_ptr->m_doublePropertyManager->setMinimum(wProp, 0);
4520 d_ptr->m_propertyToW[property] = wProp;
4521 d_ptr->m_wToProperty[wProp] = property;
4524 QtProperty *hProp = d_ptr->m_doublePropertyManager->addProperty();
4525 hProp->setPropertyName(tr(
"Height"));
4526 d_ptr->m_doublePropertyManager->setDecimals(hProp, decimals(property));
4527 d_ptr->m_doublePropertyManager->setValue(hProp, 0);
4528 d_ptr->m_doublePropertyManager->setMinimum(hProp, 0);
4529 d_ptr->m_propertyToH[property] = hProp;
4530 d_ptr->m_hToProperty[hProp] = property;
4535
4536
4539 QtProperty *xProp = d_ptr->m_propertyToX[property];
4541 d_ptr->m_xToProperty.remove(xProp);
4544 d_ptr->m_propertyToX.remove(property);
4546 QtProperty *yProp = d_ptr->m_propertyToY[property];
4548 d_ptr->m_yToProperty.remove(yProp);
4551 d_ptr->m_propertyToY.remove(property);
4553 QtProperty *wProp = d_ptr->m_propertyToW[property];
4555 d_ptr->m_wToProperty.remove(wProp);
4558 d_ptr->m_propertyToW.remove(property);
4560 QtProperty *hProp = d_ptr->m_propertyToH[property];
4562 d_ptr->m_hToProperty.remove(hProp);
4565 d_ptr->m_propertyToH.remove(property);
4567 d_ptr->m_values.remove(property);
4575 Q_DECLARE_PUBLIC(QtEnumPropertyManager)
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4615
4616
4617
4618
4619
4620
4621
4622
4625
4626
4627
4628
4629
4630
4631
4632
4635
4636
4637
4638
4639
4640
4641
4642
4645
4646
4650 d_ptr->q_ptr =
this;
4654
4655
4662
4663
4664
4665
4666
4667
4668
4669
4672 return getValue<
int>(d_ptr->m_values, property, -1);
4676
4677
4678
4679
4682 return getData<QStringList>(d_ptr->m_values, &QtEnumPropertyManagerPrivate::Data::enumNames, property, QStringList());
4686
4687
4688
4689
4692 return getData<QMap<
int, QIcon> >(d_ptr->m_values, &QtEnumPropertyManagerPrivate::Data::enumIcons, property, QMap<
int, QIcon>());
4696
4697
4700 const auto it = d_ptr->m_values.constFind(property);
4701 if (it == d_ptr->m_values.constEnd())
4704 const QtEnumPropertyManagerPrivate::Data &data = it.value();
4706 const int v = data.val;
4707 if (v >= 0 && v < data.enumNames.size())
4708 return data.enumNames.at(v);
4713
4714
4717 const auto it = d_ptr->m_values.constFind(property);
4718 if (it == d_ptr->m_values.constEnd())
4721 const QtEnumPropertyManagerPrivate::Data &data = it.value();
4723 const int v = data.val;
4724 return data.enumIcons.value(v);
4728
4729
4730
4731
4732
4733
4734
4735
4736
4739 const auto it = d_ptr->m_values.find(property);
4740 if (it == d_ptr->m_values.end())
4743 QtEnumPropertyManagerPrivate::Data data = it.value();
4745 if (val >= data.enumNames.size())
4748 if (val < 0 && !data.enumNames.empty())
4754 if (data.val == val)
4761 emit propertyChanged(property);
4762 emit valueChanged(property, data.val);
4766
4767
4768
4769
4770
4771
4772
4773
4774
4777 const auto it = d_ptr->m_values.find(property);
4778 if (it == d_ptr->m_values.end())
4781 QtEnumPropertyManagerPrivate::Data data = it.value();
4783 if (data.enumNames == enumNames)
4786 data.enumNames = enumNames;
4790 if (!enumNames.empty())
4795 emit enumNamesChanged(property, data.enumNames);
4797 emit propertyChanged(property);
4798 emit valueChanged(property, data.val);
4802
4803
4804
4805
4806
4807
4808
4811 const auto it = d_ptr->m_values.find(property);
4812 if (it == d_ptr->m_values.end())
4815 it.value().enumIcons = enumIcons;
4817 emit enumIconsChanged(property, it.value().enumIcons);
4819 emit propertyChanged(property);
4823
4824
4827 d_ptr->m_values[property] = QtEnumPropertyManagerPrivate::Data();
4831
4832
4835 d_ptr->m_values.remove(property);
4843 Q_DECLARE_PUBLIC(QtFlagPropertyManager)
4866 QtProperty *prop = m_flagToProperty.value(property,
nullptr);
4867 if (prop ==
nullptr)
4870 const auto pfit = m_propertyToFlags.constFind(prop);
4871 if (pfit == m_propertyToFlags.constEnd())
4874 for (QtProperty *p : pfit.value()) {
4875 if (p == property) {
4876 int v = m_values[prop].val;
4882 q_ptr->setValue(prop, v);
4891 QtProperty *flagProperty = m_flagToProperty.value(property,
nullptr);
4892 if (flagProperty ==
nullptr)
4895 m_propertyToFlags[flagProperty].replace(m_propertyToFlags[flagProperty].indexOf(property),
nullptr);
4896 m_flagToProperty.remove(property);
4900
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
4934
4935
4936
4937
4938
4939
4940
4941
4944
4945
4946
4947
4948
4949
4950
4951
4954
4955
4959 d_ptr->q_ptr =
this;
4961 d_ptr->m_boolPropertyManager =
new QtBoolPropertyManager(
this);
4962 connect(d_ptr->m_boolPropertyManager, &QtBoolPropertyManager::valueChanged,
this,
4963 [
this](
QtProperty *property,
bool value) { d_ptr->slotBoolChanged(property, value); });
4965 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
4969
4970
4977
4978
4979
4980
4981
4982
4983
4984
4985
4988 return d_ptr->m_boolPropertyManager;
4992
4993
4994
4995
4996
4997
4998
5001 return getValue<
int>(d_ptr->m_values, property, 0);
5005
5006
5007
5008
5011 return getData<QStringList>(d_ptr->m_values, &QtFlagPropertyManagerPrivate::Data::flagNames, property, QStringList());
5015
5016
5019 const auto it = d_ptr->m_values.constFind(property);
5020 if (it == d_ptr->m_values.constEnd())
5027 const QChar bar = QLatin1Char(
'|');
5028 for (
const auto &name : data.flagNames) {
5029 if (data.val & (1 << level)) {
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5055 const auto it = d_ptr->m_values.find(property);
5056 if (it == d_ptr->m_values.end())
5061 if (data
.val == val)
5064 if (val > (1 << data.flagNames.size()) - 1)
5074 const auto pfit = d_ptr->m_propertyToFlags.constFind(property);
5076 if (pfit != d_ptr->m_propertyToFlags.constEnd()) {
5077 for (QtProperty *prop : pfit.value()) {
5079 d_ptr->m_boolPropertyManager->setValue(prop, val & (1 << level));
5084 emit propertyChanged(property);
5085 emit valueChanged(property, data
.val);
5089
5090
5091
5092
5093
5094
5097 const auto it = d_ptr->m_values.find(property);
5098 if (it == d_ptr->m_values.end())
5103 if (data.flagNames == flagNames)
5106 data.flagNames = flagNames;
5111 const auto pfit = d_ptr->m_propertyToFlags.find(property);
5112 if (pfit != d_ptr->m_propertyToFlags.end()) {
5113 for (QtProperty *prop : std::as_const(pfit.value())) {
5116 d_ptr->m_flagToProperty.remove(prop);
5119 pfit.value().clear();
5122 for (
const QString &flagName : flagNames) {
5123 QtProperty *prop = d_ptr->m_boolPropertyManager->addProperty();
5124 prop->setPropertyName(flagName);
5125 property->addSubProperty(prop);
5126 d_ptr->m_propertyToFlags[property].append(prop);
5127 d_ptr->m_flagToProperty[prop] = property;
5130 emit flagNamesChanged(property, data.flagNames);
5132 emit propertyChanged(property);
5133 emit valueChanged(property, data
.val);
5137
5138
5141 d_ptr->m_values[property] = QtFlagPropertyManagerPrivate::Data();
5143 d_ptr->m_propertyToFlags[property] = QList<QtProperty *>();
5147
5148
5151 const auto it = d_ptr->m_propertyToFlags.find(property);
5152 if (it != d_ptr->m_propertyToFlags.end()) {
5153 for (QtProperty *prop : std::as_const(it.value())) {
5155 d_ptr->m_flagToProperty.remove(prop);
5160 d_ptr->m_propertyToFlags.erase(it);
5162 d_ptr->m_values.remove(property);
5170 Q_DECLARE_PUBLIC(QtSizePolicyPropertyManager)
5195 if (
QtProperty *prop = m_hStretchToProperty.value(property,
nullptr)) {
5196 QSizePolicy sp = m_values[prop];
5197 sp.setHorizontalStretch(value);
5198 q_ptr->setValue(prop, sp);
5199 }
else if (
QtProperty *prop = m_vStretchToProperty.value(property,
nullptr)) {
5200 QSizePolicy sp = m_values[prop];
5201 sp.setVerticalStretch(value);
5202 q_ptr->setValue(prop, sp);
5208 if (
QtProperty *prop = m_hPolicyToProperty.value(property,
nullptr)) {
5209 QSizePolicy sp = m_values[prop];
5210 sp.setHorizontalPolicy(metaEnumProvider()->indexToSizePolicy(value));
5211 q_ptr->setValue(prop, sp);
5212 }
else if (
QtProperty *prop = m_vPolicyToProperty.value(property,
nullptr)) {
5213 QSizePolicy sp = m_values[prop];
5214 sp.setVerticalPolicy(metaEnumProvider()->indexToSizePolicy(value));
5215 q_ptr->setValue(prop, sp);
5221 if (
QtProperty *pointProp = m_hStretchToProperty.value(property,
nullptr)) {
5222 m_propertyToHStretch[pointProp] =
nullptr;
5223 m_hStretchToProperty.remove(property);
5224 }
else if (
QtProperty *pointProp = m_vStretchToProperty.value(property,
nullptr)) {
5225 m_propertyToVStretch[pointProp] =
nullptr;
5226 m_vStretchToProperty.remove(property);
5227 }
else if (
QtProperty *pointProp = m_hPolicyToProperty.value(property,
nullptr)) {
5228 m_propertyToHPolicy[pointProp] =
nullptr;
5229 m_hPolicyToProperty.remove(property);
5230 }
else if (
QtProperty *pointProp = m_vPolicyToProperty.value(property,
nullptr)) {
5231 m_propertyToVPolicy[pointProp] =
nullptr;
5232 m_vPolicyToProperty.remove(property);
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5263
5264
5265
5266
5267
5268
5269
5270
5273
5274
5278 d_ptr->q_ptr =
this;
5280 d_ptr->m_intPropertyManager =
new QtIntPropertyManager(
this);
5281 connect(d_ptr->m_intPropertyManager, &QtIntPropertyManager::valueChanged,
this,
5282 [
this](
QtProperty *property,
int value) { d_ptr->slotIntChanged(property, value); });
5284 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
5286 d_ptr->m_enumPropertyManager =
new QtEnumPropertyManager(
this);
5287 connect(d_ptr->m_enumPropertyManager, &QtEnumPropertyManager::valueChanged,
this,
5288 [
this](
QtProperty *property,
int value) { d_ptr->slotEnumChanged(property, value); });
5290 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
5294
5295
5302
5303
5304
5305
5306
5307
5308
5309
5310
5313 return d_ptr->m_intPropertyManager;
5317
5318
5319
5320
5321
5322
5323
5324
5325
5328 return d_ptr->m_enumPropertyManager;
5332
5333
5334
5335
5336
5337
5338
5341 return d_ptr->m_values.value(property, QSizePolicy());
5345
5346
5349 const auto it = d_ptr->m_values.constFind(property);
5350 if (it == d_ptr->m_values.constEnd())
5353 const QSizePolicy sp = it.value();
5355 const int hIndex = mep->sizePolicyToIndex(sp.horizontalPolicy());
5356 const int vIndex = mep->sizePolicyToIndex(sp.verticalPolicy());
5358 const QString hPolicy = hIndex != -1 ? mep->policyEnumNames().at(hIndex) : tr(
"<Invalid>");
5359 const QString vPolicy = vIndex != -1 ? mep->policyEnumNames().at(vIndex) : tr(
"<Invalid>");
5360 const QString str = tr(
"[%1, %2, %3, %4]").arg(hPolicy, vPolicy).arg(sp.horizontalStretch()).arg(sp.verticalStretch());
5365
5366
5367
5368
5369
5370
5371
5374 const auto it = d_ptr->m_values.find(property);
5375 if (it == d_ptr->m_values.end())
5378 if (it.value() == val)
5383 d_ptr->m_enumPropertyManager->setValue(d_ptr->m_propertyToHPolicy[property],
5384 metaEnumProvider()->sizePolicyToIndex(val.horizontalPolicy()));
5385 d_ptr->m_enumPropertyManager->setValue(d_ptr->m_propertyToVPolicy[property],
5386 metaEnumProvider()->sizePolicyToIndex(val.verticalPolicy()));
5387 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToHStretch[property],
5388 val.horizontalStretch());
5389 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToVStretch[property],
5390 val.verticalStretch());
5392 emit propertyChanged(property);
5393 emit valueChanged(property, val);
5397
5398
5402 d_ptr->m_values[property] = val;
5404 QtProperty *hPolicyProp = d_ptr->m_enumPropertyManager->addProperty();
5405 hPolicyProp->setPropertyName(tr(
"Horizontal Policy"));
5406 d_ptr->m_enumPropertyManager->setEnumNames(hPolicyProp, metaEnumProvider()->policyEnumNames());
5407 d_ptr->m_enumPropertyManager->setValue(hPolicyProp,
5408 metaEnumProvider()->sizePolicyToIndex(val.horizontalPolicy()));
5409 d_ptr->m_propertyToHPolicy[property] = hPolicyProp;
5410 d_ptr->m_hPolicyToProperty[hPolicyProp] = property;
5413 QtProperty *vPolicyProp = d_ptr->m_enumPropertyManager->addProperty();
5414 vPolicyProp->setPropertyName(tr(
"Vertical Policy"));
5415 d_ptr->m_enumPropertyManager->setEnumNames(vPolicyProp, metaEnumProvider()->policyEnumNames());
5416 d_ptr->m_enumPropertyManager->setValue(vPolicyProp,
5417 metaEnumProvider()->sizePolicyToIndex(val.verticalPolicy()));
5418 d_ptr->m_propertyToVPolicy[property] = vPolicyProp;
5419 d_ptr->m_vPolicyToProperty[vPolicyProp] = property;
5422 QtProperty *hStretchProp = d_ptr->m_intPropertyManager->addProperty();
5423 hStretchProp->setPropertyName(tr(
"Horizontal Stretch"));
5424 d_ptr->m_intPropertyManager->setValue(hStretchProp, val.horizontalStretch());
5425 d_ptr->m_intPropertyManager->setRange(hStretchProp, 0, 0xff);
5426 d_ptr->m_propertyToHStretch[property] = hStretchProp;
5427 d_ptr->m_hStretchToProperty[hStretchProp] = property;
5430 QtProperty *vStretchProp = d_ptr->m_intPropertyManager->addProperty();
5431 vStretchProp->setPropertyName(tr(
"Vertical Stretch"));
5432 d_ptr->m_intPropertyManager->setValue(vStretchProp, val.verticalStretch());
5433 d_ptr->m_intPropertyManager->setRange(vStretchProp, 0, 0xff);
5434 d_ptr->m_propertyToVStretch[property] = vStretchProp;
5435 d_ptr->m_vStretchToProperty[vStretchProp] = property;
5441
5442
5445 QtProperty *hPolicyProp = d_ptr->m_propertyToHPolicy[property];
5447 d_ptr->m_hPolicyToProperty.remove(hPolicyProp);
5450 d_ptr->m_propertyToHPolicy.remove(property);
5452 QtProperty *vPolicyProp = d_ptr->m_propertyToVPolicy[property];
5454 d_ptr->m_vPolicyToProperty.remove(vPolicyProp);
5457 d_ptr->m_propertyToVPolicy.remove(property);
5459 QtProperty *hStretchProp = d_ptr->m_propertyToHStretch[property];
5461 d_ptr->m_hStretchToProperty.remove(hStretchProp);
5462 delete hStretchProp;
5464 d_ptr->m_propertyToHStretch.remove(property);
5466 QtProperty *vStretchProp = d_ptr->m_propertyToVStretch[property];
5468 d_ptr->m_vStretchToProperty.remove(vStretchProp);
5469 delete vStretchProp;
5471 d_ptr->m_propertyToVStretch.remove(property);
5473 d_ptr->m_values.remove(property);
5487 Q_DECLARE_PUBLIC(QtFontPropertyManager)
5531 if (
QtProperty *prop = m_pointSizeToProperty.value(property,
nullptr)) {
5532 QFont f = m_values[prop];
5533 f.setPointSize(value);
5534 q_ptr->setValue(prop, f);
5542 if (
QtProperty *prop = m_familyToProperty.value(property,
nullptr)) {
5543 QFont f = m_values[prop];
5544 f.setFamily(m_familyNames.at(value));
5545 q_ptr->setValue(prop, f);
5546 }
else if (
auto *prop = m_weightToProperty.value(property,
nullptr)) {
5547 QFont f = m_values[prop];
5548 f.setWeight(weightFromIndex(value));
5549 q_ptr->setValue(prop, f);
5557 if (
QtProperty *prop = m_boldToProperty.value(property,
nullptr)) {
5558 QFont f = m_values[prop];
5560 q_ptr->setValue(prop, f);
5561 }
else if (
QtProperty *prop = m_italicToProperty.value(property,
nullptr)) {
5562 QFont f = m_values[prop];
5564 q_ptr->setValue(prop, f);
5565 }
else if (
QtProperty *prop = m_underlineToProperty.value(property,
nullptr)) {
5566 QFont f = m_values[prop];
5567 f.setUnderline(value);
5568 q_ptr->setValue(prop, f);
5569 }
else if (
QtProperty *prop = m_strikeOutToProperty.value(property,
nullptr)) {
5570 QFont f = m_values[prop];
5571 f.setStrikeOut(value);
5572 q_ptr->setValue(prop, f);
5573 }
else if (
QtProperty *prop = m_kerningToProperty.value(property,
nullptr)) {
5574 QFont f = m_values[prop];
5575 f.setKerning(value);
5576 q_ptr->setValue(prop, f);
5582 if (
QtProperty *pointProp = m_pointSizeToProperty.value(property,
nullptr)) {
5583 m_propertyToPointSize[pointProp] =
nullptr;
5584 m_pointSizeToProperty.remove(property);
5585 }
else if (
QtProperty *pointProp = m_familyToProperty.value(property,
nullptr)) {
5586 m_propertyToFamily[pointProp] =
nullptr;
5587 m_familyToProperty.remove(property);
5588 }
else if (
QtProperty *pointProp = m_boldToProperty.value(property,
nullptr)) {
5589 m_propertyToBold[pointProp] =
nullptr;
5590 m_boldToProperty.remove(property);
5591 }
else if (
QtProperty *pointProp = m_italicToProperty.value(property,
nullptr)) {
5592 m_propertyToItalic[pointProp] =
nullptr;
5593 m_italicToProperty.remove(property);
5594 }
else if (
QtProperty *pointProp = m_underlineToProperty.value(property,
nullptr)) {
5595 m_propertyToUnderline[pointProp] =
nullptr;
5596 m_underlineToProperty.remove(property);
5597 }
else if (
QtProperty *pointProp = m_strikeOutToProperty.value(property,
nullptr)) {
5598 m_propertyToStrikeOut[pointProp] =
nullptr;
5599 m_strikeOutToProperty.remove(property);
5600 }
else if (
QtProperty *pointProp = m_kerningToProperty.value(property,
nullptr)) {
5601 m_propertyToKerning[pointProp] =
nullptr;
5602 m_kerningToProperty.remove(property);
5603 }
else if (
QtProperty *weightProp = m_weightToProperty.value(property,
nullptr)) {
5604 m_propertyToWeight[weightProp] =
nullptr;
5605 m_weightToProperty.remove(property);
5611 if (!m_fontDatabaseChangeTimer) {
5612 m_fontDatabaseChangeTimer =
new QTimer(q_ptr);
5613 m_fontDatabaseChangeTimer->setInterval(0);
5614 m_fontDatabaseChangeTimer->setSingleShot(
true);
5615 QObject::connect(m_fontDatabaseChangeTimer, &QTimer::timeout, q_ptr,
5616 [
this] { slotFontDatabaseDelayedChange(); });
5618 if (!m_fontDatabaseChangeTimer->isActive())
5619 m_fontDatabaseChangeTimer->start();
5625 const QStringList oldFamilies = m_familyNames;
5626 m_familyNames = QFontDatabase::families();
5629 if (!m_propertyToFamily.isEmpty()) {
5630 for (QtProperty *familyProp : std::as_const(m_propertyToFamily)) {
5631 const int oldIdx = m_enumPropertyManager->value(familyProp);
5632 qsizetype newIdx = m_familyNames.indexOf(oldFamilies.at(oldIdx));
5635 m_enumPropertyManager->setEnumNames(familyProp, m_familyNames);
5636 m_enumPropertyManager->setValue(familyProp, newIdx);
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5669
5670
5671
5672
5673
5674
5675
5676
5679
5680
5684 d_ptr->q_ptr =
this;
5685 QObject::connect(qApp, &QGuiApplication::fontDatabaseChanged,
this,
5686 [
this] { d_ptr->slotFontDatabaseChanged(); });
5688 d_ptr->m_intPropertyManager =
new QtIntPropertyManager(
this);
5689 connect(d_ptr->m_intPropertyManager, &QtIntPropertyManager::valueChanged,
this,
5690 [
this](
QtProperty *property,
int value) { d_ptr->slotIntChanged(property, value); });
5692 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
5694 d_ptr->m_enumPropertyManager =
new QtEnumPropertyManager(
this);
5695 connect(d_ptr->m_enumPropertyManager, &QtEnumPropertyManager::valueChanged,
this,
5696 [
this](
QtProperty *property,
int value) { d_ptr->slotEnumChanged(property, value); });
5698 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
5700 d_ptr->m_boolPropertyManager =
new QtBoolPropertyManager(
this);
5701 connect(d_ptr->m_boolPropertyManager, &QtBoolPropertyManager::valueChanged,
this,
5702 [
this](
QtProperty *property,
bool value) { d_ptr->slotBoolChanged(property, value); });
5704 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
5708
5709
5716
5717
5718
5719
5720
5721
5722
5723
5726 return d_ptr->m_intPropertyManager;
5730
5731
5732
5733
5734
5735
5736
5737
5740 return d_ptr->m_enumPropertyManager;
5744
5745
5746
5747
5748
5749
5750
5751
5752
5755 return d_ptr->m_boolPropertyManager;
5759
5760
5761
5762
5763
5764
5765
5766
5769 return d_ptr->m_values.value(property, QFont());
5773
5774
5777 const auto it = d_ptr->m_values.constFind(property);
5778 if (it == d_ptr->m_values.constEnd())
5781 return QtPropertyBrowserUtils::fontValueText(it.value());
5785
5786
5789 const auto it = d_ptr->m_values.constFind(property);
5790 if (it == d_ptr->m_values.constEnd())
5793 return QtPropertyBrowserUtils::fontValueIcon(it.value());
5797
5798
5799
5800
5801
5802
5803
5806 const auto it = d_ptr->m_values.find(property);
5807 if (it == d_ptr->m_values.end())
5810 const QFont &oldVal = it.value();
5811 if (oldVal == val && oldVal.resolveMask() == val.resolveMask())
5816 qsizetype idx = d_ptr->m_familyNames.indexOf(val.family());
5819 bool settingValue = d_ptr->m_settingValue;
5820 d_ptr->m_settingValue =
true;
5821 d_ptr->m_enumPropertyManager->setValue(d_ptr->m_propertyToFamily[property], idx);
5822 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToPointSize[property], val.pointSize());
5823 d_ptr->m_boolPropertyManager->setValue(d_ptr->m_propertyToBold[property], val.bold());
5824 d_ptr->m_boolPropertyManager->setValue(d_ptr->m_propertyToItalic[property], val.italic());
5825 d_ptr->m_boolPropertyManager->setValue(d_ptr->m_propertyToUnderline[property], val.underline());
5826 d_ptr->m_boolPropertyManager->setValue(d_ptr->m_propertyToStrikeOut[property], val.strikeOut());
5827 d_ptr->m_boolPropertyManager->setValue(d_ptr->m_propertyToKerning[property], val.kerning());
5828 d_ptr->m_enumPropertyManager->setValue(d_ptr->m_propertyToWeight[property],
5829 indexOfFontWeight(val.weight()));
5830 d_ptr->m_settingValue = settingValue;
5832 emit propertyChanged(property);
5833 emit valueChanged(property, val);
5838 static const DisambiguatedTranslation weightsC[] = {
5839 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"Thin",
"QFont::Weight combo"),
5840 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"ExtraLight",
"QFont::Weight combo"),
5841 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"Light",
"QFont::Weight combo"),
5842 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"Normal",
"QFont::Weight combo"),
5843 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"Medium",
"QFont::Weight combo"),
5844 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"DemiBold",
"QFont::Weight combo"),
5845 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"Bold",
"QFont::Weight combo"),
5846 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"ExtraBold",
"QFont::Weight combo"),
5847 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"Black",
"QFont::Weight combo")
5851 for (
const auto &w : weightsC)
5852 result.append(QCoreApplication::translate(
"FontPropertyManager", w.first, w.second));
5857
5858
5862 d_ptr->m_values[property] = val;
5864 QtProperty *familyProp = d_ptr->m_enumPropertyManager->addProperty();
5865 familyProp->setPropertyName(tr(
"Family"));
5866 if (d_ptr->m_familyNames.isEmpty())
5867 d_ptr->m_familyNames = QFontDatabase::families();
5868 d_ptr->m_enumPropertyManager->setEnumNames(familyProp, d_ptr->m_familyNames);
5869 qsizetype idx = d_ptr->m_familyNames.indexOf(val.family());
5872 d_ptr->m_enumPropertyManager->setValue(familyProp, idx);
5873 d_ptr->m_propertyToFamily[property] = familyProp;
5874 d_ptr->m_familyToProperty[familyProp] = property;
5877 QtProperty *pointSizeProp = d_ptr->m_intPropertyManager->addProperty();
5878 pointSizeProp->setPropertyName(tr(
"Point Size"));
5879 d_ptr->m_intPropertyManager->setValue(pointSizeProp, val.pointSize());
5880 d_ptr->m_intPropertyManager->setMinimum(pointSizeProp, 1);
5881 d_ptr->m_propertyToPointSize[property] = pointSizeProp;
5882 d_ptr->m_pointSizeToProperty[pointSizeProp] = property;
5885 QtProperty *boldProp = d_ptr->m_boolPropertyManager->addProperty();
5886 boldProp->setPropertyName(tr(
"Bold",
"Bold toggle"));
5887 d_ptr->m_boolPropertyManager->setValue(boldProp, val.bold());
5888 d_ptr->m_propertyToBold[property] = boldProp;
5889 d_ptr->m_boldToProperty[boldProp] = property;
5892 QtProperty *italicProp = d_ptr->m_boolPropertyManager->addProperty();
5893 italicProp->setPropertyName(tr(
"Italic"));
5894 d_ptr->m_boolPropertyManager->setValue(italicProp, val.italic());
5895 d_ptr->m_propertyToItalic[property] = italicProp;
5896 d_ptr->m_italicToProperty[italicProp] = property;
5899 QtProperty *underlineProp = d_ptr->m_boolPropertyManager->addProperty();
5900 underlineProp->setPropertyName(tr(
"Underline"));
5901 d_ptr->m_boolPropertyManager->setValue(underlineProp, val.underline());
5902 d_ptr->m_propertyToUnderline[property] = underlineProp;
5903 d_ptr->m_underlineToProperty[underlineProp] = property;
5906 QtProperty *strikeOutProp = d_ptr->m_boolPropertyManager->addProperty();
5907 strikeOutProp->setPropertyName(tr(
"Strikeout"));
5908 d_ptr->m_boolPropertyManager->setValue(strikeOutProp, val.strikeOut());
5909 d_ptr->m_propertyToStrikeOut[property] = strikeOutProp;
5910 d_ptr->m_strikeOutToProperty[strikeOutProp] = property;
5913 QtProperty *kerningProp = d_ptr->m_boolPropertyManager->addProperty();
5914 kerningProp->setPropertyName(tr(
"Kerning"));
5915 d_ptr->m_boolPropertyManager->setValue(kerningProp, val.kerning());
5916 d_ptr->m_propertyToKerning[property] = kerningProp;
5917 d_ptr->m_kerningToProperty[kerningProp] = property;
5920 auto *weightProp = d_ptr->m_enumPropertyManager->addProperty();
5921 weightProp->setPropertyName(tr(
"Weight"));
5922 static const QStringList weightNames = fontWeightNames();
5923 d_ptr->m_enumPropertyManager->setEnumNames(weightProp, weightNames);
5924 d_ptr->m_enumPropertyManager->setValue(weightProp, indexOfFontWeight(val.weight()));
5925 d_ptr->m_propertyToWeight[property] = weightProp;
5926 d_ptr->m_weightToProperty[weightProp] = property;
5931
5932
5935 QtProperty *familyProp = d_ptr->m_propertyToFamily[property];
5937 d_ptr->m_familyToProperty.remove(familyProp);
5940 d_ptr->m_propertyToFamily.remove(property);
5942 QtProperty *pointSizeProp = d_ptr->m_propertyToPointSize[property];
5943 if (pointSizeProp) {
5944 d_ptr->m_pointSizeToProperty.remove(pointSizeProp);
5945 delete pointSizeProp;
5947 d_ptr->m_propertyToPointSize.remove(property);
5949 QtProperty *boldProp = d_ptr->m_propertyToBold[property];
5951 d_ptr->m_boldToProperty.remove(boldProp);
5954 d_ptr->m_propertyToBold.remove(property);
5956 QtProperty *italicProp = d_ptr->m_propertyToItalic[property];
5958 d_ptr->m_italicToProperty.remove(italicProp);
5961 d_ptr->m_propertyToItalic.remove(property);
5963 QtProperty *underlineProp = d_ptr->m_propertyToUnderline[property];
5964 if (underlineProp) {
5965 d_ptr->m_underlineToProperty.remove(underlineProp);
5966 delete underlineProp;
5968 d_ptr->m_propertyToUnderline.remove(property);
5970 QtProperty *strikeOutProp = d_ptr->m_propertyToStrikeOut[property];
5971 if (strikeOutProp) {
5972 d_ptr->m_strikeOutToProperty.remove(strikeOutProp);
5973 delete strikeOutProp;
5975 d_ptr->m_propertyToStrikeOut.remove(property);
5977 QtProperty *kerningProp = d_ptr->m_propertyToKerning[property];
5979 d_ptr->m_kerningToProperty.remove(kerningProp);
5982 d_ptr->m_propertyToKerning.remove(property);
5984 if (
auto weightProp = d_ptr->m_propertyToWeight[property]) {
5985 d_ptr->m_weightToProperty.remove(weightProp);
5989 d_ptr->m_values.remove(property);
5997 Q_DECLARE_PUBLIC(QtColorPropertyManager)
6020 if (
QtProperty *prop = m_rToProperty.value(property,
nullptr)) {
6021 QColor c = m_values[prop];
6023 q_ptr->setValue(prop, c);
6024 }
else if (
QtProperty *prop = m_gToProperty.value(property,
nullptr)) {
6025 QColor c = m_values[prop];
6027 q_ptr->setValue(prop, c);
6028 }
else if (
QtProperty *prop = m_bToProperty.value(property,
nullptr)) {
6029 QColor c = m_values[prop];
6031 q_ptr->setValue(prop, c);
6032 }
else if (
QtProperty *prop = m_aToProperty.value(property,
nullptr)) {
6033 QColor c = m_values[prop];
6035 q_ptr->setValue(prop, c);
6041 if (
QtProperty *pointProp = m_rToProperty.value(property,
nullptr)) {
6042 m_propertyToR[pointProp] =
nullptr;
6043 m_rToProperty.remove(property);
6044 }
else if (
QtProperty *pointProp = m_gToProperty.value(property,
nullptr)) {
6045 m_propertyToG[pointProp] =
nullptr;
6046 m_gToProperty.remove(property);
6047 }
else if (
QtProperty *pointProp = m_bToProperty.value(property,
nullptr)) {
6048 m_propertyToB[pointProp] =
nullptr;
6049 m_bToProperty.remove(property);
6050 }
else if (
QtProperty *pointProp = m_aToProperty.value(property,
nullptr)) {
6051 m_propertyToA[pointProp] =
nullptr;
6052 m_aToProperty.remove(property);
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6082
6083
6084
6085
6086
6087
6088
6089
6092
6093
6097 d_ptr->q_ptr =
this;
6099 d_ptr->m_intPropertyManager =
new QtIntPropertyManager(
this);
6100 connect(d_ptr->m_intPropertyManager, &QtIntPropertyManager::valueChanged,
this,
6101 [
this](
QtProperty *property,
int value) { d_ptr->slotIntChanged(property, value); });
6103 [
this](
QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
6107
6108
6115
6116
6117
6118
6119
6120
6121
6122
6123
6126 return d_ptr->m_intPropertyManager;
6130
6131
6132
6133
6134
6135
6136
6139 return d_ptr->m_values.value(property, QColor());
6143
6144
6148 const auto it = d_ptr->m_values.constFind(property);
6149 if (it == d_ptr->m_values.constEnd())
6152 return QtPropertyBrowserUtils::colorValueText(it.value());
6156
6157
6161 const auto it = d_ptr->m_values.constFind(property);
6162 if (it == d_ptr->m_values.constEnd())
6164 return QtPropertyBrowserUtils::brushValueIcon(QBrush(it.value()));
6168
6169
6170
6171
6172
6173
6174
6177 const auto it = d_ptr->m_values.find(property);
6178 if (it == d_ptr->m_values.end())
6181 if (it.value() == val)
6186 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToR[property], val.red());
6187 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToG[property], val.green());
6188 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToB[property], val.blue());
6189 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToA[property], val.alpha());
6191 emit propertyChanged(property);
6192 emit valueChanged(property, val);
6196
6197
6201 d_ptr->m_values[property] = val;
6203 QtProperty *rProp = d_ptr->m_intPropertyManager->addProperty();
6204 rProp->setPropertyName(tr(
"Red"));
6205 d_ptr->m_intPropertyManager->setValue(rProp, val.red());
6206 d_ptr->m_intPropertyManager->setRange(rProp, 0, 0xFF);
6207 d_ptr->m_propertyToR[property] = rProp;
6208 d_ptr->m_rToProperty[rProp] = property;
6211 QtProperty *gProp = d_ptr->m_intPropertyManager->addProperty();
6212 gProp->setPropertyName(tr(
"Green"));
6213 d_ptr->m_intPropertyManager->setValue(gProp, val.green());
6214 d_ptr->m_intPropertyManager->setRange(gProp, 0, 0xFF);
6215 d_ptr->m_propertyToG[property] = gProp;
6216 d_ptr->m_gToProperty[gProp] = property;
6219 QtProperty *bProp = d_ptr->m_intPropertyManager->addProperty();
6220 bProp->setPropertyName(tr(
"Blue"));
6221 d_ptr->m_intPropertyManager->setValue(bProp, val.blue());
6222 d_ptr->m_intPropertyManager->setRange(bProp, 0, 0xFF);
6223 d_ptr->m_propertyToB[property] = bProp;
6224 d_ptr->m_bToProperty[bProp] = property;
6227 QtProperty *aProp = d_ptr->m_intPropertyManager->addProperty();
6228 aProp->setPropertyName(tr(
"Alpha"));
6229 d_ptr->m_intPropertyManager->setValue(aProp, val.alpha());
6230 d_ptr->m_intPropertyManager->setRange(aProp, 0, 0xFF);
6231 d_ptr->m_propertyToA[property] = aProp;
6232 d_ptr->m_aToProperty[aProp] = property;
6237
6238
6241 QtProperty *rProp = d_ptr->m_propertyToR[property];
6243 d_ptr->m_rToProperty.remove(rProp);
6246 d_ptr->m_propertyToR.remove(property);
6248 QtProperty *gProp = d_ptr->m_propertyToG[property];
6250 d_ptr->m_gToProperty.remove(gProp);
6253 d_ptr->m_propertyToG.remove(property);
6255 QtProperty *bProp = d_ptr->m_propertyToB[property];
6257 d_ptr->m_bToProperty.remove(bProp);
6260 d_ptr->m_propertyToB.remove(property);
6262 QtProperty *aProp = d_ptr->m_propertyToA[property];
6264 d_ptr->m_aToProperty.remove(aProp);
6267 d_ptr->m_propertyToA.remove(property);
6269 d_ptr->m_values.remove(property);
6277 Q_DECLARE_PUBLIC(QtCursorPropertyManager)
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6300
6301
6302
6303
6304
6305
6306
6307
6310
6311
6315 d_ptr->q_ptr =
this;
6319
6320
6327
6328
6329
6330
6331
6332
6333
6337 return d_ptr->m_values.value(property, QCursor());
6342
6343
6346 const auto it = d_ptr->m_values.constFind(property);
6347 if (it == d_ptr->m_values.constEnd())
6354
6355
6358 const auto it = d_ptr->m_values.constFind(property);
6359 if (it == d_ptr->m_values.constEnd())
6366
6367
6368
6369
6370
6371
6375 const auto it = d_ptr->m_values.find(property);
6376 if (it == d_ptr->m_values.end())
6379 if (it.value().shape() == value.shape() && value.shape() != Qt::BitmapCursor)
6384 emit propertyChanged(property);
6385 emit valueChanged(property, value);
6390
6391
6395 d_ptr->m_values[property] = QCursor();
6400
6401
6404 d_ptr->m_values.remove(property);
6409#include "moc_qtpropertymanager_p.cpp"
6410#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