7#include <QtCore/QDateTime>
9#include <QtCore/QLocale>
11#include <QtCore/QMetaEnum>
12#include <QtCore/QRegularExpression>
13#include <QtCore/QTimer>
14#include <QtGui/QFontDatabase>
16#include <QtGui/QPainter>
17#include <QtWidgets/QApplication>
18#include <QtWidgets/QLabel>
19#include <QtWidgets/QStyle>
20#include <QtWidgets/QStyleOption>
30# pragma warning(disable: 4786
)
35using DisambiguatedTranslation = std::pair<
const char *,
const char *>;
38 QFont::Thin, QFont::ExtraLight, QFont::Light, QFont::Normal, QFont::Medium, QFont::DemiBold,
39 QFont::Bold, QFont::ExtraBold, QFont::Black
44 auto it =
std::find(
std::begin(weightValues),
std::end(weightValues), w);
45 return int(it -
std::begin(weightValues));
50 return weightValues[i];
53template <
class PrivateData,
class Value>
56 data->minVal = minVal;
57 if (data->maxVal < data->minVal)
58 data->maxVal = data->minVal;
60 if (data->val < data->minVal)
61 data->val = data->minVal;
64template <
class PrivateData,
class Value>
67 data->maxVal = maxVal;
68 if (data->minVal > data->maxVal)
69 data->minVal = data->maxVal;
71 if (data->val > data->maxVal)
72 data->val = data->maxVal;
75template <
class PrivateData,
class Value>
78 data->minVal = newMinVal;
79 if (data->maxVal.width() < data->minVal.width())
80 data->maxVal.setWidth(data->minVal.width());
81 if (data->maxVal.height() < data->minVal.height())
82 data->maxVal.setHeight(data->minVal.height());
84 if (data->val.width() < data->minVal.width())
85 data->val.setWidth(data->minVal.width());
86 if (data->val.height() < data->minVal.height())
87 data->val.setHeight(data->minVal.height());
90template <
class PrivateData,
class Value>
93 data->maxVal = newMaxVal;
94 if (data->minVal.width() > data->maxVal.width())
95 data->minVal.setWidth(data->maxVal.width());
96 if (data->minVal.height() > data->maxVal.height())
97 data->minVal.setHeight(data->maxVal.height());
99 if (data->val.width() > data->maxVal.width())
100 data->val.setWidth(data->maxVal.width());
101 if (data->val.height() > data->maxVal.height())
102 data->val.setHeight(data->maxVal.height());
105template <
class SizeValue>
106static SizeValue
qBoundSize(
const SizeValue &minVal,
const SizeValue &val,
const SizeValue &maxVal)
108 SizeValue croppedVal = val;
109 if (minVal.width() > val.width())
110 croppedVal.setWidth(minVal.width());
111 else if (maxVal.width() < val.width())
112 croppedVal.setWidth(maxVal.width());
114 if (minVal.height() > val.height())
115 croppedVal.setHeight(minVal.height());
116 else if (maxVal.height() < val.height())
117 croppedVal.setHeight(maxVal.height());
125 return qBoundSize(minVal, val, maxVal);
130 return qBoundSize(minVal, val, maxVal);
136template <
class Value>
137void orderBorders(Value &minVal, Value &maxVal)
140 qSwap(minVal, maxVal);
143template <
class Value>
144static void orderSizeBorders(Value &minVal, Value &maxVal)
146 Value fromSize = minVal;
147 Value toSize = maxVal;
148 if (fromSize.width() > toSize.width()) {
149 fromSize.setWidth(maxVal.width());
150 toSize.setWidth(minVal.width());
152 if (fromSize.height() > toSize.height()) {
153 fromSize.setHeight(maxVal.height());
154 toSize.setHeight(minVal.height());
160void orderBorders(QSize &minVal, QSize &maxVal)
162 orderSizeBorders(minVal, maxVal);
165void orderBorders(QSizeF &minVal, QSizeF &maxVal)
167 orderSizeBorders(minVal, maxVal);
174template <
class Value,
class PrivateData>
175static Value
getData(
const QHash<
const QtProperty *, PrivateData> &propertyMap,
176 Value PrivateData::*data,
177 const QtProperty *property,
const Value &defaultValue = Value())
179 const auto it = propertyMap.constFind(property);
180 if (it == propertyMap.constEnd())
182 return it.value().*data;
185template <
class Value,
class PrivateData>
186static Value
getValue(
const QHash<
const QtProperty *, PrivateData> &propertyMap,
187 const QtProperty *property,
const Value &defaultValue = Value())
189 return getData<Value>(propertyMap, &PrivateData::val, property, defaultValue);
192template <
class Value,
class PrivateData>
193static Value
getMinimum(
const QHash<
const QtProperty *, PrivateData> &propertyMap,
194 const QtProperty *property,
const Value &defaultValue = Value())
196 return getData<Value>(propertyMap, &PrivateData::minVal, property, defaultValue);
199template <
class Value,
class PrivateData>
200static Value
getMaximum(
const QHash<
const QtProperty *, PrivateData> &propertyMap,
201 const QtProperty *property,
const Value &defaultValue = Value())
203 return getData<Value>(propertyMap, &PrivateData::maxVal, property, defaultValue);
206template <
class ValueChangeParameter,
class Value,
class PropertyManager>
208 PropertyManager *manager,
209 void (PropertyManager::*propertyChangedSignal)(
QtProperty *),
210 void (PropertyManager::*valueChangedSignal)(
QtProperty *, ValueChangeParameter),
213 const auto it = propertyMap.find(property);
214 if (it == propertyMap.end())
217 if (it.value() == val)
222 emit (manager->*propertyChangedSignal)(property);
223 emit (manager->*valueChangedSignal)(property, val);
226template <
class ValueChangeParameter,
class PropertyManagerPrivate,
class PropertyManager,
class Value>
227static void setValueInRange(PropertyManager *manager, PropertyManagerPrivate *managerPrivate,
228 void (PropertyManager::*propertyChangedSignal)(
QtProperty *),
229 void (PropertyManager::*valueChangedSignal)(
QtProperty *, ValueChangeParameter),
231 void (PropertyManagerPrivate::*setSubPropertyValue)(
QtProperty *, ValueChangeParameter))
233 const auto it = managerPrivate->m_values.find(property);
234 if (it == managerPrivate->m_values.end())
237 auto &data = it.value();
242 const Value oldVal = data.val;
244 data.val = qBound(data.minVal, val, data.maxVal);
246 if (data.val == oldVal)
249 if (setSubPropertyValue)
250 (managerPrivate->*setSubPropertyValue)(property, data.val);
252 emit (manager->*propertyChangedSignal)(property);
253 emit (manager->*valueChangedSignal)(property, data.val);
256template <
class ValueChangeParameter,
class PropertyManagerPrivate,
class PropertyManager,
class Value>
257static void setBorderValues(PropertyManager *manager, PropertyManagerPrivate *managerPrivate,
258 void (PropertyManager::*propertyChangedSignal)(
QtProperty *),
259 void (PropertyManager::*valueChangedSignal)(
QtProperty *, ValueChangeParameter),
260 void (PropertyManager::*rangeChangedSignal)(
QtProperty *, ValueChangeParameter, ValueChangeParameter),
261 QtProperty *property, ValueChangeParameter minVal, ValueChangeParameter maxVal,
262 void (PropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *,
263 ValueChangeParameter, ValueChangeParameter, ValueChangeParameter))
265 const auto it = managerPrivate->m_values.find(property);
266 if (it == managerPrivate->m_values.end())
269 Value fromVal = minVal;
270 Value toVal = maxVal;
271 orderBorders(fromVal, toVal);
273 auto &data = it.value();
275 if (data.minVal == fromVal && data.maxVal == toVal)
278 const Value oldVal = data.val;
280 data.setMinimumValue(fromVal);
281 data.setMaximumValue(toVal);
283 emit (manager->*rangeChangedSignal)(property, data.minVal, data.maxVal);
285 if (setSubPropertyRange)
286 (managerPrivate->*setSubPropertyRange)(property, data.minVal, data.maxVal, data.val);
288 if (data.val == oldVal)
291 emit (manager->*propertyChangedSignal)(property);
292 emit (manager->*valueChangedSignal)(property, data.val);
295template <
class ValueChangeParameter,
class PropertyManagerPrivate,
class PropertyManager,
class Value,
class PrivateData>
296static void setBorderValue(PropertyManager *manager, PropertyManagerPrivate *managerPrivate,
297 void (PropertyManager::*propertyChangedSignal)(
QtProperty *),
298 void (PropertyManager::*valueChangedSignal)(
QtProperty *, ValueChangeParameter),
299 void (PropertyManager::*rangeChangedSignal)(
QtProperty *, ValueChangeParameter, ValueChangeParameter),
301 Value (PrivateData::*getRangeVal)()
const,
302 void (PrivateData::*setRangeVal)(ValueChangeParameter),
const Value &borderVal,
303 void (PropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *,
304 ValueChangeParameter, ValueChangeParameter, ValueChangeParameter))
306 const auto it = managerPrivate->m_values.find(property);
307 if (it == managerPrivate->m_values.end())
310 PrivateData &data = it.value();
312 if ((data.*getRangeVal)() == borderVal)
315 const Value oldVal = data.val;
317 (data.*setRangeVal)(borderVal);
319 emit (manager->*rangeChangedSignal)(property, data.minVal, data.maxVal);
321 if (setSubPropertyRange)
322 (managerPrivate->*setSubPropertyRange)(property, data.minVal, data.maxVal, data.val);
324 if (data.val == oldVal)
327 emit (manager->*propertyChangedSignal)(property);
328 emit (manager->*valueChangedSignal)(property, data.val);
331template <
class ValueChangeParameter,
class PropertyManagerPrivate,
class PropertyManager,
class Value,
class PrivateData>
332static void setMinimumValue(PropertyManager *manager, PropertyManagerPrivate *managerPrivate,
333 void (PropertyManager::*propertyChangedSignal)(
QtProperty *),
334 void (PropertyManager::*valueChangedSignal)(
QtProperty *, ValueChangeParameter),
335 void (PropertyManager::*rangeChangedSignal)(
QtProperty *, ValueChangeParameter, ValueChangeParameter),
338 void (PropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *,
339 ValueChangeParameter, ValueChangeParameter, ValueChangeParameter) =
nullptr;
340 setBorderValue<ValueChangeParameter, PropertyManagerPrivate, PropertyManager, Value, PrivateData>(manager, managerPrivate,
341 propertyChangedSignal, valueChangedSignal, rangeChangedSignal,
342 property, &PropertyManagerPrivate::Data::minimumValue, &PropertyManagerPrivate::Data::setMinimumValue, minVal, setSubPropertyRange);
345template <
class ValueChangeParameter,
class PropertyManagerPrivate,
class PropertyManager,
class Value,
class PrivateData>
346static void setMaximumValue(PropertyManager *manager, PropertyManagerPrivate *managerPrivate,
347 void (PropertyManager::*propertyChangedSignal)(
QtProperty *),
348 void (PropertyManager::*valueChangedSignal)(
QtProperty *, ValueChangeParameter),
349 void (PropertyManager::*rangeChangedSignal)(
QtProperty *, ValueChangeParameter, ValueChangeParameter),
352 void (PropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *,
353 ValueChangeParameter, ValueChangeParameter, ValueChangeParameter) =
nullptr;
354 setBorderValue<ValueChangeParameter, PropertyManagerPrivate, PropertyManager, Value, PrivateData>(manager, managerPrivate,
355 propertyChangedSignal, valueChangedSignal, rangeChangedSignal,
356 property, &PropertyManagerPrivate::Data::maximumValue, &PropertyManagerPrivate::Data::setMaximumValue, maxVal, setSubPropertyRange);
362 Q_PROPERTY(QSizePolicy::Policy policy READ policy)
381 void indexToLocale(
int languageIndex,
int territoryIndex, QLocale::Language *language, QLocale::Territory *territory)
const;
382 void localeToIndex(QLocale::Language language, QLocale::Territory territory,
int *languageIndex,
int *territoryIndex)
const;
387 QStringList m_policyEnumNames;
388 QStringList m_languageEnumNames;
389 QMap<QLocale::Language, QStringList> m_territoryEnumNames;
390 QMap<
int, QLocale::Language> m_indexToLanguage;
391 QMap<QLocale::Language,
int> m_languageToIndex;
392 QMap<
int, QMap<
int, QLocale::Territory> > m_indexToTerritory;
394 QMetaEnum m_policyEnum;
399 QMultiMap<QString, QLocale::Territory> nameToTerritory;
400 for (
const QLocale &locale : locales) {
401 const auto territory = locale.territory();
402 nameToTerritory.insert(QLocale::territoryToString(territory), territory);
404 return nameToTerritory.values();
409 QMultiMap<QString, QLocale::Language> nameToLanguage;
410 for (
int l = QLocale::C, last = QLocale::LastLanguage; l <= last; ++l) {
411 const QLocale::Language language =
static_cast<QLocale::Language>(l);
412 QLocale locale(language);
413 if (locale.language() == language)
414 nameToLanguage.insert(QLocale::languageToString(language), language);
417 const QLocale system = QLocale::system();
418 if (!nameToLanguage.contains(QLocale::languageToString(system.language())))
419 nameToLanguage.insert(QLocale::languageToString(system.language()), system.language());
421 const auto languages = nameToLanguage.values();
422 for (QLocale::Language language : languages) {
423 auto locales = QLocale::matchingLocales(language, QLocale::AnyScript,
424 QLocale::AnyTerritory);
426 if (!locales.isEmpty() && !m_languageToIndex.contains(language)) {
427 const auto territories = sortedTerritories(locales);
428 qsizetype langIdx = m_languageEnumNames.size();
429 m_indexToLanguage[langIdx] = language;
430 m_languageToIndex[language] = langIdx;
431 QStringList territoryNames;
432 int territoryIdx = 0;
433 for (QLocale::Territory territory : territories) {
434 territoryNames << QLocale::territoryToString(territory);
435 m_indexToTerritory[langIdx][territoryIdx] = territory;
436 m_territoryToIndex[language][territory] = territoryIdx;
439 m_languageEnumNames << QLocale::languageToString(language);
440 m_territoryEnumNames[language] = territoryNames;
449 p = QtMetaEnumWrapper::staticMetaObject.property(
450 QtMetaEnumWrapper::staticMetaObject.propertyOffset() + 0);
451 m_policyEnum = p.enumerator();
452 const int keyCount = m_policyEnum.keyCount();
453 for (
int i = 0; i < keyCount; i++)
454 m_policyEnumNames << QLatin1StringView(m_policyEnum.key(i));
461 return static_cast<QSizePolicy::Policy>(m_policyEnum.value(index));
466 const int keyCount = m_policyEnum.keyCount();
467 for (
int i = 0; i < keyCount; i++)
468 if (indexToSizePolicy(i) == policy)
475 QLocale::Language l = QLocale::C;
476 QLocale::Territory c = QLocale::AnyTerritory;
477 const auto lit = m_indexToLanguage.constFind(languageIndex);
478 if (lit != m_indexToLanguage.cend()) {
480 const auto tit = m_indexToTerritory.constFind(languageIndex);
481 if (tit != m_indexToTerritory.end()) {
482 const auto tit2 = tit.value().constFind(territoryIndex);
483 if (tit2 != tit.value().cend())
497 const auto lit = m_languageToIndex.constFind(language);
498 if (lit != m_languageToIndex.cend()) {
500 const auto tit = m_territoryToIndex.constFind(language);
501 if (tit != m_territoryToIndex.cend()) {
502 const auto tit2 = tit.value().constFind(territory);
503 if (tit2 != tit.value().cend())
519
520
521
522
523
524
525
526
527
528
529
532
533
541
542
543QtGroupPropertyManager::~QtGroupPropertyManager() =
default;
546
547
555
556
563
564
575 Q_DECLARE_PUBLIC(QtIntPropertyManager)
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
619
620
621
622
623
624
625
626
629
630
631
632
633
634
635
636
639
640
641
642
643
644
645
646
649
650
658
659
666
667
668
669
670
671
672
675 return getValue<
int>(d_ptr->m_values, property, 0);
679
680
681
682
685 return getMinimum<
int>(d_ptr->m_values, property, 0);
689
690
691
692
695 return getMaximum<
int>(d_ptr->m_values, property, 0);
699
700
701
702
703
704
707 return getData<
int>(d_ptr->m_values, &QtIntPropertyManagerPrivate::Data::singleStep, property, 0);
711
712
715 const auto it = d_ptr->m_values.constFind(property);
716 if (it == d_ptr->m_values.constEnd())
718 return QString::number(it.value().val);
722
723
724
725
726
727
728
729
730
731
734 void (QtIntPropertyManagerPrivate::*setSubPropertyValue)(
QtProperty *,
int) =
nullptr;
735 setValueInRange<
int, QtIntPropertyManagerPrivate, QtIntPropertyManager,
int>(
this, d_ptr.data(),
736 &QtIntPropertyManager::propertyChanged,
737 &QtIntPropertyManager::valueChanged,
738 property, val, setSubPropertyValue);
742
743
744
745
746
747
748
749
752 setMinimumValue<
int, QtIntPropertyManagerPrivate, QtIntPropertyManager,
int, QtIntPropertyManagerPrivate::Data>(
this, d_ptr.data(),
753 &QtIntPropertyManager::propertyChanged,
754 &QtIntPropertyManager::valueChanged,
755 &QtIntPropertyManager::rangeChanged,
760
761
762
763
764
765
766
767
770 setMaximumValue<
int, QtIntPropertyManagerPrivate, QtIntPropertyManager,
int, QtIntPropertyManagerPrivate::Data>(
this, d_ptr.data(),
771 &QtIntPropertyManager::propertyChanged,
772 &QtIntPropertyManager::valueChanged,
773 &QtIntPropertyManager::rangeChanged,
778
779
780
781
782
783
784
785
786
787
788
789
790
793 void (QtIntPropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *,
int,
int,
int) =
nullptr;
794 setBorderValues<
int, QtIntPropertyManagerPrivate, QtIntPropertyManager,
int>(
this, d_ptr.data(),
795 &QtIntPropertyManager::propertyChanged,
796 &QtIntPropertyManager::valueChanged,
797 &QtIntPropertyManager::rangeChanged,
798 property, minVal, maxVal, setSubPropertyRange);
802
803
804
805
806
807
810 const auto it = d_ptr->m_values.find(property);
811 if (it == d_ptr->m_values.end())
814 QtIntPropertyManagerPrivate::Data data = it.value();
819 if (data.singleStep == step)
822 data.singleStep = step;
826 emit singleStepChanged(property, data.singleStep);
830
831
834 d_ptr->m_values[property] = QtIntPropertyManagerPrivate::Data();
838
839
842 d_ptr->m_values.remove(property);
850 Q_DECLARE_PUBLIC(QtDoublePropertyManager)
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
896
897
898
899
900
901
902
903
906
907
908
909
910
911
912
913
916
917
918
919
920
921
922
923
926
927
928
929
930
931
932
933
936
937
945
946
953
954
955
956
957
958
959
962 return getValue<
double>(d_ptr->m_values, property, 0.0);
966
967
968
969
972 return getMinimum<
double>(d_ptr->m_values, property, 0.0);
976
977
978
979
982 return getMaximum<
double>(d_ptr->m_values, property, 0.0);
986
987
988
989
990
991
994 return getData<
double>(d_ptr->m_values, &QtDoublePropertyManagerPrivate::Data::singleStep, property, 0);
998
999
1000
1001
1004 return getData<
int>(d_ptr->m_values, &QtDoublePropertyManagerPrivate::Data::decimals, property, 0);
1008
1009
1012 const auto it = d_ptr->m_values.constFind(property);
1013 if (it == d_ptr->m_values.constEnd())
1015 return QString::number(it.value().val,
'f', it.value().decimals);
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1031 void (QtDoublePropertyManagerPrivate::*setSubPropertyValue)(
QtProperty *,
double) =
nullptr;
1032 setValueInRange<
double, QtDoublePropertyManagerPrivate, QtDoublePropertyManager,
double>(
this, d_ptr.data(),
1033 &QtDoublePropertyManager::propertyChanged,
1034 &QtDoublePropertyManager::valueChanged,
1035 property, val, setSubPropertyValue);
1039
1040
1041
1042
1043
1044
1047 const auto it = d_ptr->m_values.find(property);
1048 if (it == d_ptr->m_values.end())
1051 QtDoublePropertyManagerPrivate::Data data = it.value();
1056 if (data.singleStep == step)
1059 data.singleStep = step;
1063 emit singleStepChanged(property, data.singleStep);
1067
1068
1069
1070
1071
1072
1073
1074
1077 const auto it = d_ptr->m_values.find(property);
1078 if (it == d_ptr->m_values.end())
1081 QtDoublePropertyManagerPrivate::Data data = it.value();
1088 if (data.decimals == prec)
1091 data.decimals = prec;
1095 emit decimalsChanged(property, data.decimals);
1099
1100
1101
1102
1103
1104
1105
1106
1109 setMinimumValue<
double, QtDoublePropertyManagerPrivate, QtDoublePropertyManager,
double, QtDoublePropertyManagerPrivate::Data>(
this, d_ptr.data(),
1110 &QtDoublePropertyManager::propertyChanged,
1111 &QtDoublePropertyManager::valueChanged,
1112 &QtDoublePropertyManager::rangeChanged,
1117
1118
1119
1120
1121
1122
1123
1124
1127 setMaximumValue<
double, QtDoublePropertyManagerPrivate, QtDoublePropertyManager,
double, QtDoublePropertyManagerPrivate::Data>(
this, d_ptr.data(),
1128 &QtDoublePropertyManager::propertyChanged,
1129 &QtDoublePropertyManager::valueChanged,
1130 &QtDoublePropertyManager::rangeChanged,
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1150 void (QtDoublePropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *,
double,
double,
double) =
nullptr;
1151 setBorderValues<
double, QtDoublePropertyManagerPrivate, QtDoublePropertyManager,
double>(
this, d_ptr.data(),
1152 &QtDoublePropertyManager::propertyChanged,
1153 &QtDoublePropertyManager::valueChanged,
1154 &QtDoublePropertyManager::rangeChanged,
1155 property, minVal, maxVal, setSubPropertyRange);
1159
1160
1163 d_ptr->m_values[property] = QtDoublePropertyManagerPrivate::Data();
1167
1168
1171 d_ptr->m_values.remove(property);
1179 Q_DECLARE_PUBLIC(QtStringPropertyManager)
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1215
1216
1217
1218
1219
1220
1221
1222
1225
1226
1227
1228
1229
1230
1231
1232
1235
1236
1240 d_ptr->q_ptr =
this;
1244
1245
1252
1253
1254
1255
1256
1257
1258
1261 return getValue<QString>(d_ptr->m_values, property);
1265
1266
1267
1268
1269
1270
1271
1274 return getData<QRegularExpression>(d_ptr->m_values, &QtStringPropertyManagerPrivate::Data::regExp, property, QRegularExpression());
1278
1279
1282 const auto it = d_ptr->m_values.constFind(property);
1283 if (it == d_ptr->m_values.constEnd())
1285 return it.value().val;
1289
1290
1291
1292
1293
1294
1295
1296
1297
1300 const auto it = d_ptr->m_values.find(property);
1301 if (it == d_ptr->m_values.end())
1304 QtStringPropertyManagerPrivate::Data data = it.value();
1306 if (data.val == val)
1309 if (data.regExp.isValid() && !data.regExp.pattern().isEmpty()
1310 && !data.regExp.match(val).hasMatch()) {
1318 emit propertyChanged(property);
1319 emit valueChanged(property, data.val);
1323
1324
1325
1326
1329 const auto it = d_ptr->m_values.find(property);
1330 if (it == d_ptr->m_values.end())
1333 QtStringPropertyManagerPrivate::Data data = it.value() ;
1335 if (data.regExp == regExp)
1338 data.regExp = regExp;
1342 emit regExpChanged(property, data.regExp);
1346
1347
1350 d_ptr->m_values[property] = QtStringPropertyManagerPrivate::Data();
1354
1355
1358 d_ptr->m_values.remove(property);
1365 QStyleOptionButton opt;
1366 opt.state |= value ? QStyle::State_On : QStyle::State_Off;
1367 opt.state |= QStyle::State_Enabled;
1368 const QStyle *style = QApplication::style();
1372 const int indicatorWidth = style->pixelMetric(QStyle::PM_IndicatorWidth, &opt);
1373 const int indicatorHeight = style->pixelMetric(QStyle::PM_IndicatorHeight, &opt);
1374 const int listViewIconSize = indicatorWidth;
1375 const int pixmapWidth = indicatorWidth;
1376 const int pixmapHeight = qMax(indicatorHeight, listViewIconSize);
1378 opt.rect = QRect(0, 0, indicatorWidth, indicatorHeight);
1379 QPixmap pixmap = QPixmap(pixmapWidth, pixmapHeight);
1380 pixmap.fill(Qt::transparent);
1383 const int xoff = (pixmapWidth > indicatorWidth) ? (pixmapWidth - indicatorWidth) / 2 : 0;
1384 const int yoff = (pixmapHeight > indicatorHeight) ? (pixmapHeight - indicatorHeight) / 2 : 0;
1385 QPainter painter(&pixmap);
1386 painter.translate(xoff, yoff);
1387 style->drawPrimitive(QStyle::PE_IndicatorCheckBox, &opt, &painter);
1389 return QIcon(pixmap);
1395 Q_DECLARE_PUBLIC(QtBoolPropertyManager)
1405 m_checkedIcon(drawCheckBox(
true)),
1406 m_uncheckedIcon(drawCheckBox(
false))
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1429
1430
1431
1432
1433
1434
1437
1438
1442 d_ptr->q_ptr =
this;
1446
1447
1454
1455
1456
1457
1458
1459
1460
1463 return d_ptr->m_values.value(property,
false);
1467
1468
1471 const auto it = d_ptr->m_values.constFind(property);
1472 if (it == d_ptr->m_values.constEnd())
1475 static const QString trueText = tr(
"True");
1476 static const QString falseText = tr(
"False");
1477 return it.value() ? trueText : falseText;
1481
1482
1485 const auto it = d_ptr->m_values.constFind(property);
1486 if (it == d_ptr->m_values.constEnd())
1489 return it.value() ? d_ptr->m_checkedIcon : d_ptr->m_uncheckedIcon;
1493
1494
1495
1496
1497
1498
1501 setSimpleValue<
bool,
bool, QtBoolPropertyManager>(d_ptr->m_values,
this,
1502 &QtBoolPropertyManager::propertyChanged,
1503 &QtBoolPropertyManager::valueChanged,
1508
1509
1512 d_ptr->m_values[property] =
false;
1516
1517
1520 d_ptr->m_values.remove(property);
1528 Q_DECLARE_PUBLIC(QtDatePropertyManager)
1550 m_format(QtPropertyBrowserUtils::dateFormat())
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1580
1581
1582
1583
1584
1585
1586
1587
1590
1591
1592
1593
1594
1595
1596
1597
1600
1601
1608
1609
1616
1617
1618
1619
1620
1621
1622
1625 return getValue<QDate>(d_ptr->m_values, property);
1629
1630
1631
1632
1635 return getMinimum<QDate>(d_ptr->m_values, property);
1639
1640
1641
1642
1645 return getMaximum<QDate>(d_ptr->m_values, property);
1649
1650
1653 const auto it = d_ptr->m_values.constFind(property);
1654 if (it == d_ptr->m_values.constEnd())
1656 return it.value().val.toString(d_ptr->m_format);
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1672 void (QtDatePropertyManagerPrivate::*setSubPropertyValue)(
QtProperty *, QDate) =
nullptr;
1673 setValueInRange<QDate, QtDatePropertyManagerPrivate, QtDatePropertyManager,
const QDate>(
this, d_ptr.data(),
1674 &QtDatePropertyManager::propertyChanged,
1675 &QtDatePropertyManager::valueChanged,
1676 property, val, setSubPropertyValue);
1680
1681
1682
1683
1684
1685
1686
1687
1690 setMinimumValue<QDate, QtDatePropertyManagerPrivate, QtDatePropertyManager, QDate, QtDatePropertyManagerPrivate::Data>(
this, d_ptr.data(),
1691 &QtDatePropertyManager::propertyChanged,
1692 &QtDatePropertyManager::valueChanged,
1693 &QtDatePropertyManager::rangeChanged,
1698
1699
1700
1701
1702
1703
1704
1705
1708 setMaximumValue<QDate, QtDatePropertyManagerPrivate, QtDatePropertyManager, QDate, QtDatePropertyManagerPrivate::Data>(
this, d_ptr.data(),
1709 &QtDatePropertyManager::propertyChanged,
1710 &QtDatePropertyManager::valueChanged,
1711 &QtDatePropertyManager::rangeChanged,
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1731 void (QtDatePropertyManagerPrivate::*setSubPropertyRange)(
QtProperty *, QDate, QDate, QDate) =
nullptr;
1732 setBorderValues<QDate, QtDatePropertyManagerPrivate, QtDatePropertyManager, QDate>(
this, d_ptr.data(),
1733 &QtDatePropertyManager::propertyChanged,
1734 &QtDatePropertyManager::valueChanged,
1735 &QtDatePropertyManager::rangeChanged,
1736 property, minVal, maxVal, setSubPropertyRange);
1740
1741
1744 d_ptr->m_values[property] = QtDatePropertyManagerPrivate::Data();
1748
1749
1752 d_ptr->m_values.remove(property);
1760 Q_DECLARE_PUBLIC(QtTimePropertyManager)
1771 m_format(QtPropertyBrowserUtils::timeFormat())
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1794
1795
1796
1797
1798
1799
1800
1801
1804
1805
1812
1813
1820
1821
1822
1823
1824
1825
1826
1829 return d_ptr->m_values.value(property, QTime());
1833
1834
1837 const auto it = d_ptr->m_values.constFind(property);
1838 if (it == d_ptr->m_values.constEnd())
1840 return it.value().toString(d_ptr->m_format);
1844
1845
1846
1847
1848
1849
1852 setSimpleValue<QTime, QTime, QtTimePropertyManager>(d_ptr->m_values,
this,
1853 &QtTimePropertyManager::propertyChanged,
1854 &QtTimePropertyManager::valueChanged,
1859
1860
1863 d_ptr->m_values[property] = QTime::currentTime();
1867
1868
1871 d_ptr->m_values.remove(property);
1879 Q_DECLARE_PUBLIC(QtDateTimePropertyManager)
1890 m_format(QtPropertyBrowserUtils::dateTimeFormat())
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1911
1912
1913
1914
1915
1916
1919
1920
1927
1928
1935
1936
1937
1938
1939
1940
1941
1944 return d_ptr->m_values.value(property, QDateTime());
1948
1949
1952 const auto it = d_ptr->m_values.constFind(property);
1953 if (it == d_ptr->m_values.constEnd())
1955 return it.value().toString(d_ptr->m_format);
1959
1960
1961
1962
1963
1964
1967 setSimpleValue<
const QDateTime &, QDateTime, QtDateTimePropertyManager>(d_ptr->m_values,
this,
1968 &QtDateTimePropertyManager::propertyChanged,
1969 &QtDateTimePropertyManager::valueChanged,
1974
1975
1978 d_ptr->m_values[property] = QDateTime::currentDateTime();
1982
1983
1986 d_ptr->m_values.remove(property);
1994 Q_DECLARE_PUBLIC(QtKeySequencePropertyManager)
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2020
2021
2022
2023
2024
2025
2028
2029
2033 d_ptr->q_ptr =
this;
2037
2038
2045
2046
2047
2048
2049
2050
2051
2054 return d_ptr->m_values.value(property, QKeySequence());
2058
2059
2062 const auto it = d_ptr->m_values.constFind(property);
2063 if (it == d_ptr->m_values.constEnd())
2065 return it.value().toString(QKeySequence::NativeText);
2069
2070
2071
2072
2073
2074
2077 setSimpleValue<
const QKeySequence &, QKeySequence, QtKeySequencePropertyManager>(d_ptr->m_values,
this,
2078 &QtKeySequencePropertyManager::propertyChanged,
2079 &QtKeySequencePropertyManager::valueChanged,
2084
2085
2088 d_ptr->m_values[property] = QKeySequence();
2092
2093
2096 d_ptr->m_values.remove(property);
2104 Q_DECLARE_PUBLIC(QtCharPropertyManager)
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2128
2129
2130
2131
2132
2133
2136
2137
2141 d_ptr->q_ptr =
this;
2145
2146
2153
2154
2155
2156
2157
2158
2159
2162 return d_ptr->m_values.value(property, QChar());
2166
2167
2170 const auto it = d_ptr->m_values.constFind(property);
2171 if (it == d_ptr->m_values.constEnd())
2173 const QChar c = it.value();
2174 return c.isNull() ? QString() : QString(c);
2178
2179
2180
2181
2182
2183
2186 setSimpleValue<
const QChar &, QChar, QtCharPropertyManager>(d_ptr->m_values,
this,
2187 &QtCharPropertyManager::propertyChanged,
2188 &QtCharPropertyManager::valueChanged,
2193
2194
2197 d_ptr->m_values[property] = QChar();
2201
2202
2205 d_ptr->m_values.remove(property);
2213 Q_DECLARE_PUBLIC(QtLocalePropertyManager)
2232 if (
QtProperty *prop = m_languageToProperty.value(property,
nullptr)) {
2233 const QLocale loc = m_values[prop];
2234 QLocale::Language newLanguage = loc.language();
2235 QLocale::Territory newTerritory = loc.territory();
2236 metaEnumProvider()->indexToLocale(value, 0, &newLanguage,
nullptr);
2237 QLocale newLoc(newLanguage, newTerritory);
2238 q_ptr->setValue(prop, newLoc);
2239 }
else if (
QtProperty *prop = m_territoryToProperty.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(m_enumPropertyManager->value(m_propertyToLanguage.value(prop)), value, &newLanguage, &newTerritory);
2244 QLocale newLoc(newLanguage, newTerritory);
2245 q_ptr->setValue(prop, newLoc);
2251 if (
QtProperty *subProp = m_languageToProperty.value(property,
nullptr)) {
2252 m_propertyToLanguage[subProp] =
nullptr;
2253 m_languageToProperty.remove(property);
2254 }
else if (
QtProperty *subProp = m_territoryToProperty.value(property,
nullptr)) {
2255 m_propertyToTerritory[subProp] =
nullptr;
2256 m_territoryToProperty.remove(property);
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2285
2286
2287
2288
2289
2290
2291
2292
2295
2296
2300 d_ptr->q_ptr =
this;
2302 d_ptr->m_enumPropertyManager =
new QtEnumPropertyManager(
this);
2303 connect(d_ptr->m_enumPropertyManager, &QtEnumPropertyManager::valueChanged,
this,
2304 [
this](QtProperty *property,
int value) { d_ptr->slotEnumChanged(property, value); });
2305 connect(d_ptr->m_enumPropertyManager, &QtAbstractPropertyManager::propertyDestroyed,
this,
2306 [
this](QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
2310
2311
2318
2319
2320
2321
2322
2323
2324
2325
2326
2329 return d_ptr->m_enumPropertyManager;
2333
2334
2335
2336
2337
2338
2339
2342 return d_ptr->m_values.value(property, QLocale());
2346
2347
2350 const auto it = d_ptr->m_values.constFind(property);
2351 if (it == d_ptr->m_values.constEnd())
2354 const QLocale &loc = it.value();
2357 int territoryIdx = 0;
2359 me->localeToIndex(loc.language(), loc.territory(), &langIdx, &territoryIdx);
2361 qWarning(
"QtLocalePropertyManager::valueText: Unknown language %d", loc.language());
2362 return tr(
"<Invalid>");
2364 QString languageName = me->languageEnumNames().at(langIdx);
2365 if (territoryIdx < 0) {
2366 qWarning(
"QtLocalePropertyManager::valueText: Unknown territory %d for %s", loc.territory(), qPrintable(languageName));
2367 return languageName;
2369 const QString territoryName = me->territoryEnumNames(loc.language()).at(territoryIdx);
2370 return tr(
"%1, %2").arg(languageName, territoryName);
2374
2375
2376
2377
2378
2379
2380
2383 const auto it = d_ptr->m_values.find(property);
2384 if (it == d_ptr->m_values.end())
2387 const QLocale &loc = it.value();
2394 int territoryIdx = 0;
2395 metaEnumProvider()->localeToIndex(val.language(), val.territory(), &langIdx, &territoryIdx);
2396 if (loc.language() != val.language()) {
2397 d_ptr->m_enumPropertyManager->setValue(d_ptr->m_propertyToLanguage.value(property), langIdx);
2398 d_ptr->m_enumPropertyManager->setEnumNames(d_ptr->m_propertyToTerritory.value(property),
2399 metaEnumProvider()->territoryEnumNames(val.language()));
2401 d_ptr->m_enumPropertyManager->setValue(d_ptr->m_propertyToTerritory.value(property), territoryIdx);
2403 emit propertyChanged(property);
2404 emit valueChanged(property, val);
2408
2409
2413 d_ptr->m_values[property] = val;
2416 int territoryIdx = 0;
2417 metaEnumProvider()->localeToIndex(val.language(), val.territory(), &langIdx, &territoryIdx);
2419 QtProperty *languageProp = d_ptr->m_enumPropertyManager->addProperty();
2420 languageProp->setPropertyName(tr(
"Language"));
2421 d_ptr->m_enumPropertyManager->setEnumNames(languageProp, metaEnumProvider()->languageEnumNames());
2422 d_ptr->m_enumPropertyManager->setValue(languageProp, langIdx);
2423 d_ptr->m_propertyToLanguage[property] = languageProp;
2424 d_ptr->m_languageToProperty[languageProp] = property;
2427 QtProperty *territoryProp = d_ptr->m_enumPropertyManager->addProperty();
2428 territoryProp->setPropertyName(tr(
"Territory"));
2429 d_ptr->m_enumPropertyManager->setEnumNames(territoryProp, metaEnumProvider()->territoryEnumNames(val.language()));
2430 d_ptr->m_enumPropertyManager->setValue(territoryProp, territoryIdx);
2431 d_ptr->m_propertyToTerritory[property] = territoryProp;
2432 d_ptr->m_territoryToProperty[territoryProp] = property;
2437
2438
2441 QtProperty *languageProp = d_ptr->m_propertyToLanguage[property];
2443 d_ptr->m_languageToProperty.remove(languageProp);
2444 delete languageProp;
2446 d_ptr->m_propertyToLanguage.remove(property);
2448 QtProperty *territoryProp = d_ptr->m_propertyToTerritory[property];
2449 if (territoryProp) {
2450 d_ptr->m_territoryToProperty.remove(territoryProp);
2451 delete territoryProp;
2453 d_ptr->m_propertyToTerritory.remove(property);
2455 d_ptr->m_values.remove(property);
2463 Q_DECLARE_PUBLIC(QtPointPropertyManager)
2482 if (
QtProperty *xprop = m_xToProperty.value(property,
nullptr)) {
2483 QPoint p = m_values[xprop];
2485 q_ptr->setValue(xprop, p);
2486 }
else if (
QtProperty *yprop = m_yToProperty.value(property,
nullptr)) {
2487 QPoint p = m_values[yprop];
2489 q_ptr->setValue(yprop, p);
2495 if (
QtProperty *pointProp = m_xToProperty.value(property,
nullptr)) {
2496 m_propertyToX[pointProp] =
nullptr;
2497 m_xToProperty.remove(property);
2498 }
else if (
QtProperty *pointProp = m_yToProperty.value(property,
nullptr)) {
2499 m_propertyToY[pointProp] =
nullptr;
2500 m_yToProperty.remove(property);
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2528
2529
2530
2531
2532
2533
2534
2535
2538
2539
2543 d_ptr->q_ptr =
this;
2545 d_ptr->m_intPropertyManager =
new QtIntPropertyManager(
this);
2546 connect(d_ptr->m_intPropertyManager, &QtIntPropertyManager::valueChanged,
this,
2547 [
this](QtProperty *property,
int value) { d_ptr->slotIntChanged(property, value); });
2548 connect(d_ptr->m_intPropertyManager, &QtAbstractPropertyManager::propertyDestroyed,
this,
2549 [
this](QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
2553
2554
2561
2562
2563
2564
2565
2566
2567
2568
2569
2572 return d_ptr->m_intPropertyManager;
2576
2577
2578
2579
2580
2581
2582
2585 return d_ptr->m_values.value(property, QPoint());
2589
2590
2593 const auto it = d_ptr->m_values.constFind(property);
2594 if (it == d_ptr->m_values.constEnd())
2596 const QPoint v = it.value();
2597 return tr(
"(%1, %2)").arg(v.x()).arg(v.y());
2601
2602
2603
2604
2605
2606
2607
2610 const auto it = d_ptr->m_values.find(property);
2611 if (it == d_ptr->m_values.end())
2614 if (it.value() == val)
2618 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToX[property], val.x());
2619 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToY[property], val.y());
2621 emit propertyChanged(property);
2622 emit valueChanged(property, val);
2626
2627
2630 d_ptr->m_values[property] = QPoint(0, 0);
2632 QtProperty *xProp = d_ptr->m_intPropertyManager->addProperty();
2633 xProp->setPropertyName(tr(
"X"));
2634 d_ptr->m_intPropertyManager->setValue(xProp, 0);
2635 d_ptr->m_propertyToX[property] = xProp;
2636 d_ptr->m_xToProperty[xProp] = property;
2639 QtProperty *yProp = d_ptr->m_intPropertyManager->addProperty();
2640 yProp->setPropertyName(tr(
"Y"));
2641 d_ptr->m_intPropertyManager->setValue(yProp, 0);
2642 d_ptr->m_propertyToY[property] = yProp;
2643 d_ptr->m_yToProperty[yProp] = property;
2648
2649
2652 QtProperty *xProp = d_ptr->m_propertyToX[property];
2654 d_ptr->m_xToProperty.remove(xProp);
2657 d_ptr->m_propertyToX.remove(property);
2659 QtProperty *yProp = d_ptr->m_propertyToY[property];
2661 d_ptr->m_yToProperty.remove(yProp);
2664 d_ptr->m_propertyToY.remove(property);
2666 d_ptr->m_values.remove(property);
2674 Q_DECLARE_PUBLIC(QtPointFPropertyManager)
2699 if (
QtProperty *prop = m_xToProperty.value(property,
nullptr)) {
2700 QPointF p = m_values[prop].val;
2702 q_ptr->setValue(prop, p);
2703 }
else if (
QtProperty *prop = m_yToProperty.value(property,
nullptr)) {
2704 QPointF p = m_values[prop].val;
2706 q_ptr->setValue(prop, p);
2712 if (
QtProperty *pointProp = m_xToProperty.value(property,
nullptr)) {
2713 m_propertyToX[pointProp] =
nullptr;
2714 m_xToProperty.remove(property);
2715 }
else if (
QtProperty *pointProp = m_yToProperty.value(property,
nullptr)) {
2716 m_propertyToY[pointProp] =
nullptr;
2717 m_yToProperty.remove(property);
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2745
2746
2747
2748
2749
2750
2751
2752
2755
2756
2757
2758
2759
2760
2761
2762
2765
2766
2770 d_ptr->q_ptr =
this;
2772 d_ptr->m_doublePropertyManager =
new QtDoublePropertyManager(
this);
2773 connect(d_ptr->m_doublePropertyManager, &QtDoublePropertyManager::valueChanged,
this,
2774 [
this](QtProperty *property,
double value) { d_ptr->slotDoubleChanged(property, value); });
2775 connect(d_ptr->m_doublePropertyManager, &QtAbstractPropertyManager::propertyDestroyed,
this,
2776 [
this](QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
2780
2781
2788
2789
2790
2791
2792
2793
2794
2795
2796
2799 return d_ptr->m_doublePropertyManager;
2803
2804
2805
2806
2807
2808
2809
2812 return getValue<QPointF>(d_ptr->m_values, property);
2816
2817
2818
2819
2822 return getData<
int>(d_ptr->m_values, &QtPointFPropertyManagerPrivate::Data::decimals, property, 0);
2826
2827
2830 const auto it = d_ptr->m_values.constFind(property);
2831 if (it == d_ptr->m_values.constEnd())
2833 const QPointF v = it.value().val;
2834 const int dec = it.value().decimals;
2835 return tr(
"(%1, %2)").arg(QString::number(v.x(),
'f', dec),
2836 QString::number(v.y(),
'f', dec));
2840
2841
2842
2843
2844
2845
2846
2849 const auto it = d_ptr->m_values.find(property);
2850 if (it == d_ptr->m_values.end())
2853 if (it.value().val == val)
2856 it.value().val = val;
2857 d_ptr->m_doublePropertyManager->setValue(d_ptr->m_propertyToX[property], val.x());
2858 d_ptr->m_doublePropertyManager->setValue(d_ptr->m_propertyToY[property], val.y());
2860 emit propertyChanged(property);
2861 emit valueChanged(property, val);
2865
2866
2867
2868
2869
2870
2871
2872
2875 const auto it = d_ptr->m_values.find(property);
2876 if (it == d_ptr->m_values.end())
2879 QtPointFPropertyManagerPrivate::Data data = it.value();
2886 if (data.decimals == prec)
2889 data.decimals = prec;
2890 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToX[property], prec);
2891 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToY[property], prec);
2895 emit decimalsChanged(property, data.decimals);
2899
2900
2903 d_ptr->m_values[property] = QtPointFPropertyManagerPrivate::Data();
2905 QtProperty *xProp = d_ptr->m_doublePropertyManager->addProperty();
2906 xProp->setPropertyName(tr(
"X"));
2907 d_ptr->m_doublePropertyManager->setDecimals(xProp, decimals(property));
2908 d_ptr->m_doublePropertyManager->setValue(xProp, 0);
2909 d_ptr->m_propertyToX[property] = xProp;
2910 d_ptr->m_xToProperty[xProp] = property;
2913 QtProperty *yProp = d_ptr->m_doublePropertyManager->addProperty();
2914 yProp->setPropertyName(tr(
"Y"));
2915 d_ptr->m_doublePropertyManager->setDecimals(yProp, decimals(property));
2916 d_ptr->m_doublePropertyManager->setValue(yProp, 0);
2917 d_ptr->m_propertyToY[property] = yProp;
2918 d_ptr->m_yToProperty[yProp] = property;
2923
2924
2927 QtProperty *xProp = d_ptr->m_propertyToX[property];
2929 d_ptr->m_xToProperty.remove(xProp);
2932 d_ptr->m_propertyToX.remove(property);
2934 QtProperty *yProp = d_ptr->m_propertyToY[property];
2936 d_ptr->m_yToProperty.remove(yProp);
2939 d_ptr->m_propertyToY.remove(property);
2941 d_ptr->m_values.remove(property);
2949 Q_DECLARE_PUBLIC(QtSizePropertyManager)
2956 QSize minVal, QSize maxVal, QSize val);
2982 if (
QtProperty *prop = m_wToProperty.value(property,
nullptr)) {
2983 QSize s = m_values[prop].val;
2985 q_ptr->setValue(prop, s);
2986 }
else if (
QtProperty *prop = m_hToProperty.value(property,
nullptr)) {
2987 QSize s = m_values[prop].val;
2989 q_ptr->setValue(prop, s);
2995 if (
QtProperty *pointProp = m_wToProperty.value(property,
nullptr)) {
2996 m_propertyToW[pointProp] =
nullptr;
2997 m_wToProperty.remove(property);
2998 }
else if (
QtProperty *pointProp = m_hToProperty.value(property,
nullptr)) {
2999 m_propertyToH[pointProp] =
nullptr;
3000 m_hToProperty.remove(property);
3006 m_intPropertyManager->setValue(m_propertyToW.value(property), val.width());
3007 m_intPropertyManager->setValue(m_propertyToH.value(property), val.height());
3011 QSize minVal, QSize maxVal, QSize val)
3013 QtProperty *wProperty = m_propertyToW.value(property);
3014 QtProperty *hProperty = m_propertyToH.value(property);
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3054
3055
3056
3057
3058
3059
3060
3061
3064
3065
3066
3067
3068
3069
3070
3071
3074
3075
3079 d_ptr->q_ptr =
this;
3081 d_ptr->m_intPropertyManager =
new QtIntPropertyManager(
this);
3082 connect(d_ptr->m_intPropertyManager, &QtIntPropertyManager::valueChanged,
this,
3083 [
this](QtProperty *property,
int value) { d_ptr->slotIntChanged(property, value); });
3084 connect(d_ptr->m_intPropertyManager, &QtAbstractPropertyManager::propertyDestroyed,
this,
3085 [
this](QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
3089
3090
3097
3098
3099
3100
3101
3102
3103
3104
3105
3108 return d_ptr->m_intPropertyManager;
3112
3113
3114
3115
3116
3117
3118
3121 return getValue<QSize>(d_ptr->m_values, property);
3125
3126
3127
3128
3131 return getMinimum<QSize>(d_ptr->m_values, property);
3135
3136
3137
3138
3141 return getMaximum<QSize>(d_ptr->m_values, property);
3145
3146
3149 const auto it = d_ptr->m_values.constFind(property);
3150 if (it == d_ptr->m_values.constEnd())
3152 const QSize v = it.value().val;
3153 return tr(
"%1 x %2").arg(v.width()).arg(v.height());
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3169 setValueInRange<QSize, QtSizePropertyManagerPrivate, QtSizePropertyManager,
const QSize>(
this, d_ptr.data(),
3170 &QtSizePropertyManager::propertyChanged,
3171 &QtSizePropertyManager::valueChanged,
3172 property, val, &QtSizePropertyManagerPrivate::setValue);
3176
3177
3178
3179
3180
3181
3182
3183
3186 setBorderValue<QSize, QtSizePropertyManagerPrivate, QtSizePropertyManager, QSize, QtSizePropertyManagerPrivate::Data>(
this, d_ptr.data(),
3187 &QtSizePropertyManager::propertyChanged,
3188 &QtSizePropertyManager::valueChanged,
3189 &QtSizePropertyManager::rangeChanged,
3191 &QtSizePropertyManagerPrivate::Data::minimumValue,
3192 &QtSizePropertyManagerPrivate::Data::setMinimumValue,
3193 minVal, &QtSizePropertyManagerPrivate::setRange);
3197
3198
3199
3200
3201
3202
3203
3204
3207 setBorderValue<QSize, QtSizePropertyManagerPrivate, QtSizePropertyManager, QSize, QtSizePropertyManagerPrivate::Data>(
this, d_ptr.data(),
3208 &QtSizePropertyManager::propertyChanged,
3209 &QtSizePropertyManager::valueChanged,
3210 &QtSizePropertyManager::rangeChanged,
3212 &QtSizePropertyManagerPrivate::Data::maximumValue,
3213 &QtSizePropertyManagerPrivate::Data::setMaximumValue,
3214 maxVal, &QtSizePropertyManagerPrivate::setRange);
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3233 setBorderValues<QSize, QtSizePropertyManagerPrivate, QtSizePropertyManager, QSize>(
this, d_ptr.data(),
3234 &QtSizePropertyManager::propertyChanged,
3235 &QtSizePropertyManager::valueChanged,
3236 &QtSizePropertyManager::rangeChanged,
3237 property, minVal, maxVal, &QtSizePropertyManagerPrivate::setRange);
3241
3242
3245 d_ptr->m_values[property] = QtSizePropertyManagerPrivate::Data();
3247 QtProperty *wProp = d_ptr->m_intPropertyManager->addProperty();
3248 wProp->setPropertyName(tr(
"Width"));
3249 d_ptr->m_intPropertyManager->setValue(wProp, 0);
3250 d_ptr->m_intPropertyManager->setMinimum(wProp, 0);
3251 d_ptr->m_propertyToW[property] = wProp;
3252 d_ptr->m_wToProperty[wProp] = property;
3255 QtProperty *hProp = d_ptr->m_intPropertyManager->addProperty();
3256 hProp->setPropertyName(tr(
"Height"));
3257 d_ptr->m_intPropertyManager->setValue(hProp, 0);
3258 d_ptr->m_intPropertyManager->setMinimum(hProp, 0);
3259 d_ptr->m_propertyToH[property] = hProp;
3260 d_ptr->m_hToProperty[hProp] = property;
3265
3266
3269 QtProperty *wProp = d_ptr->m_propertyToW[property];
3271 d_ptr->m_wToProperty.remove(wProp);
3274 d_ptr->m_propertyToW.remove(property);
3276 QtProperty *hProp = d_ptr->m_propertyToH[property];
3278 d_ptr->m_hToProperty.remove(hProp);
3281 d_ptr->m_propertyToH.remove(property);
3283 d_ptr->m_values.remove(property);
3291 Q_DECLARE_PUBLIC(QtSizeFPropertyManager)
3298 QSizeF minVal, QSizeF maxVal, QSizeF val);
3325 if (
QtProperty *prop = m_wToProperty.value(property,
nullptr)) {
3326 QSizeF s = m_values[prop].val;
3328 q_ptr->setValue(prop, s);
3329 }
else if (
QtProperty *prop = m_hToProperty.value(property,
nullptr)) {
3330 QSizeF s = m_values[prop].val;
3332 q_ptr->setValue(prop, s);
3338 if (
QtProperty *pointProp = m_wToProperty.value(property,
nullptr)) {
3339 m_propertyToW[pointProp] =
nullptr;
3340 m_wToProperty.remove(property);
3341 }
else if (
QtProperty *pointProp = m_hToProperty.value(property,
nullptr)) {
3342 m_propertyToH[pointProp] =
nullptr;
3343 m_hToProperty.remove(property);
3349 m_doublePropertyManager->setValue(m_propertyToW.value(property), val.width());
3350 m_doublePropertyManager->setValue(m_propertyToH.value(property), val.height());
3354 QSizeF minVal, QSizeF maxVal, QSizeF val)
3356 m_doublePropertyManager->setRange(m_propertyToW[property], minVal.width(), maxVal.width());
3357 m_doublePropertyManager->setValue(m_propertyToW[property], val.width());
3358 m_doublePropertyManager->setRange(m_propertyToH[property], minVal.height(), maxVal.height());
3359 m_doublePropertyManager->setValue(m_propertyToH[property], val.height());
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3395
3396
3397
3398
3399
3400
3401
3402
3405
3406
3407
3408
3409
3410
3411
3412
3415
3416
3417
3418
3419
3420
3421
3422
3425
3426
3430 d_ptr->q_ptr =
this;
3432 d_ptr->m_doublePropertyManager =
new QtDoublePropertyManager(
this);
3433 connect(d_ptr->m_doublePropertyManager, &QtDoublePropertyManager::valueChanged,
this,
3434 [
this](QtProperty *property,
double value) { d_ptr->slotDoubleChanged(property, value); });
3435 connect(d_ptr->m_doublePropertyManager, &QtAbstractPropertyManager::propertyDestroyed,
this,
3436 [
this](QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
3440
3441
3448
3449
3450
3451
3452
3453
3454
3455
3456
3459 return d_ptr->m_doublePropertyManager;
3463
3464
3465
3466
3467
3468
3469
3472 return getValue<QSizeF>(d_ptr->m_values, property);
3476
3477
3478
3479
3482 return getData<
int>(d_ptr->m_values, &QtSizeFPropertyManagerPrivate::Data::decimals, property, 0);
3486
3487
3488
3489
3492 return getMinimum<QSizeF>(d_ptr->m_values, property);
3496
3497
3498
3499
3502 return getMaximum<QSizeF>(d_ptr->m_values, property);
3506
3507
3510 const auto it = d_ptr->m_values.constFind(property);
3511 if (it == d_ptr->m_values.constEnd())
3513 const QSizeF v = it.value().val;
3514 const int dec = it.value().decimals;
3515 return tr(
"%1 x %2").arg(QString::number(v.width(),
'f', dec),
3516 QString::number(v.height(),
'f', dec));
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3532 setValueInRange<QSizeF, QtSizeFPropertyManagerPrivate, QtSizeFPropertyManager, QSizeF>(
this, d_ptr.data(),
3533 &QtSizeFPropertyManager::propertyChanged,
3534 &QtSizeFPropertyManager::valueChanged,
3535 property, val, &QtSizeFPropertyManagerPrivate::setValue);
3539
3540
3541
3542
3543
3544
3545
3546
3549 const auto it = d_ptr->m_values.find(property);
3550 if (it == d_ptr->m_values.end())
3564 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToW[property], prec);
3565 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToH[property], prec);
3569 emit decimalsChanged(property, data
.decimals);
3573
3574
3575
3576
3577
3578
3579
3580
3583 setBorderValue<QSizeF, QtSizeFPropertyManagerPrivate, QtSizeFPropertyManager, QSizeF, QtSizeFPropertyManagerPrivate::Data>(
this, d_ptr.data(),
3584 &QtSizeFPropertyManager::propertyChanged,
3585 &QtSizeFPropertyManager::valueChanged,
3586 &QtSizeFPropertyManager::rangeChanged,
3588 &QtSizeFPropertyManagerPrivate::Data::minimumValue,
3589 &QtSizeFPropertyManagerPrivate::Data::setMinimumValue,
3590 minVal, &QtSizeFPropertyManagerPrivate::setRange);
3594
3595
3596
3597
3598
3599
3600
3601
3604 setBorderValue<QSizeF, QtSizeFPropertyManagerPrivate, QtSizeFPropertyManager, QSizeF, QtSizeFPropertyManagerPrivate::Data>(
this, d_ptr.data(),
3605 &QtSizeFPropertyManager::propertyChanged,
3606 &QtSizeFPropertyManager::valueChanged,
3607 &QtSizeFPropertyManager::rangeChanged,
3609 &QtSizeFPropertyManagerPrivate::Data::maximumValue,
3610 &QtSizeFPropertyManagerPrivate::Data::setMaximumValue,
3611 maxVal, &QtSizeFPropertyManagerPrivate::setRange);
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3630 setBorderValues<QSizeF, QtSizeFPropertyManagerPrivate, QtSizeFPropertyManager, QSizeF>(
this, d_ptr.data(),
3631 &QtSizeFPropertyManager::propertyChanged,
3632 &QtSizeFPropertyManager::valueChanged,
3633 &QtSizeFPropertyManager::rangeChanged,
3634 property, minVal, maxVal, &QtSizeFPropertyManagerPrivate::setRange);
3638
3639
3642 d_ptr->m_values[property] = QtSizeFPropertyManagerPrivate::Data();
3644 QtProperty *wProp = d_ptr->m_doublePropertyManager->addProperty();
3645 wProp->setPropertyName(tr(
"Width"));
3646 d_ptr->m_doublePropertyManager->setDecimals(wProp, decimals(property));
3647 d_ptr->m_doublePropertyManager->setValue(wProp, 0);
3648 d_ptr->m_doublePropertyManager->setMinimum(wProp, 0);
3649 d_ptr->m_propertyToW[property] = wProp;
3650 d_ptr->m_wToProperty[wProp] = property;
3653 QtProperty *hProp = d_ptr->m_doublePropertyManager->addProperty();
3654 hProp->setPropertyName(tr(
"Height"));
3655 d_ptr->m_doublePropertyManager->setDecimals(hProp, decimals(property));
3656 d_ptr->m_doublePropertyManager->setValue(hProp, 0);
3657 d_ptr->m_doublePropertyManager->setMinimum(hProp, 0);
3658 d_ptr->m_propertyToH[property] = hProp;
3659 d_ptr->m_hToProperty[hProp] = property;
3664
3665
3668 QtProperty *wProp = d_ptr->m_propertyToW[property];
3670 d_ptr->m_wToProperty.remove(wProp);
3673 d_ptr->m_propertyToW.remove(property);
3675 QtProperty *hProp = d_ptr->m_propertyToH[property];
3677 d_ptr->m_hToProperty.remove(hProp);
3680 d_ptr->m_propertyToH.remove(property);
3682 d_ptr->m_values.remove(property);
3690 Q_DECLARE_PUBLIC(QtRectPropertyManager)
3720 if (
QtProperty *prop = m_xToProperty.value(property,
nullptr)) {
3721 QRect r = m_values[prop].val;
3723 q_ptr->setValue(prop, r);
3724 }
else if (
QtProperty *prop = m_yToProperty.value(property)) {
3725 QRect r = m_values[prop].val;
3727 q_ptr->setValue(prop, r);
3728 }
else if (
QtProperty *prop = m_wToProperty.value(property,
nullptr)) {
3729 Data data = m_values[prop];
3732 if (!data.constraint.isNull() && data.constraint.x() + data.constraint.width() < r.x() + r.width()) {
3733 r.moveLeft(data.constraint.left() + data.constraint.width() - r.width());
3735 q_ptr->setValue(prop, r);
3736 }
else if (
QtProperty *prop = m_hToProperty.value(property,
nullptr)) {
3737 Data data = m_values[prop];
3740 if (!data.constraint.isNull() && data.constraint.y() + data.constraint.height() < r.y() + r.height()) {
3741 r.moveTop(data.constraint.top() + data.constraint.height() - r.height());
3743 q_ptr->setValue(prop, r);
3749 if (
QtProperty *pointProp = m_xToProperty.value(property,
nullptr)) {
3750 m_propertyToX[pointProp] =
nullptr;
3751 m_xToProperty.remove(property);
3752 }
else if (
QtProperty *pointProp = m_yToProperty.value(property,
nullptr)) {
3753 m_propertyToY[pointProp] =
nullptr;
3754 m_yToProperty.remove(property);
3755 }
else if (
QtProperty *pointProp = m_wToProperty.value(property,
nullptr)) {
3756 m_propertyToW[pointProp] =
nullptr;
3757 m_wToProperty.remove(property);
3758 }
else if (
QtProperty *pointProp = m_hToProperty.value(property,
nullptr)) {
3759 m_propertyToH[pointProp] =
nullptr;
3760 m_hToProperty.remove(property);
3765 QRect constraint, QRect val)
3767 const bool isNull = constraint.isNull();
3768 const int left = isNull ? INT_MIN : constraint.left();
3769 const int right = isNull ? INT_MAX : constraint.left() + constraint.width();
3770 const int top = isNull ? INT_MIN : constraint.top();
3771 const int bottom = isNull ? INT_MAX : constraint.top() + constraint.height();
3772 const int width = isNull ? INT_MAX : constraint.width();
3773 const int height = isNull ? INT_MAX : constraint.height();
3775 m_intPropertyManager->setRange(m_propertyToX[property], left, right);
3776 m_intPropertyManager->setRange(m_propertyToY[property], top, bottom);
3777 m_intPropertyManager->setRange(m_propertyToW[property], 0, width);
3778 m_intPropertyManager->setRange(m_propertyToH[property], 0, height);
3780 m_intPropertyManager->setValue(m_propertyToX[property], val.x());
3781 m_intPropertyManager->setValue(m_propertyToY[property], val.y());
3782 m_intPropertyManager->setValue(m_propertyToW[property], val.width());
3783 m_intPropertyManager->setValue(m_propertyToH[property], val.height());
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3817
3818
3819
3820
3821
3822
3823
3824
3827
3828
3829
3830
3831
3832
3833
3834
3837
3838
3842 d_ptr->q_ptr =
this;
3844 d_ptr->m_intPropertyManager =
new QtIntPropertyManager(
this);
3845 connect(d_ptr->m_intPropertyManager, &QtIntPropertyManager::valueChanged,
this,
3846 [
this](QtProperty *property,
int value) { d_ptr->slotIntChanged(property, value); });
3847 connect(d_ptr->m_intPropertyManager, &QtAbstractPropertyManager::propertyDestroyed,
this,
3848 [
this](QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
3852
3853
3860
3861
3862
3863
3864
3865
3866
3867
3868
3871 return d_ptr->m_intPropertyManager;
3875
3876
3877
3878
3879
3880
3881
3884 return getValue<QRect>(d_ptr->m_values, property);
3888
3889
3890
3891
3894 return getData<QRect>(d_ptr->m_values, &QtRectPropertyManagerPrivate::Data::constraint, property, QRect());
3898
3899
3902 const auto it = d_ptr->m_values.constFind(property);
3903 if (it == d_ptr->m_values.constEnd())
3905 const QRect v = it.value().val;
3906 return tr(
"[(%1, %2), %3 x %4]").arg(v.x()) .arg(v.y())
3907 .arg(v.width()).arg(v.height());
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3924 const auto it = d_ptr->m_values.find(property);
3925 if (it == d_ptr->m_values.end())
3930 QRect newRect = val.normalized();
3931 if (!data.constraint.isNull() && !data.constraint.contains(newRect)) {
3932 const QRect r1 = data.constraint;
3933 const QRect r2 = newRect;
3934 newRect.setLeft(qMax(r1.left(), r2.left()));
3935 newRect.setRight(qMin(r1.right(), r2.right()));
3936 newRect.setTop(qMax(r1.top(), r2.top()));
3937 newRect.setBottom(qMin(r1.bottom(), r2.bottom()));
3938 if (newRect.width() < 0 || newRect.height() < 0)
3942 if (data.val == newRect)
3948 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToX[property], newRect.x());
3949 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToY[property], newRect.y());
3950 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToW[property], newRect.width());
3951 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToH[property], newRect.height());
3953 emit propertyChanged(property);
3954 emit valueChanged(property, data.val);
3958
3959
3960
3961
3962
3963
3964
3965
3966
3969 const auto it = d_ptr->m_values.find(property);
3970 if (it == d_ptr->m_values.end())
3975 QRect newConstraint = constraint.normalized();
3976 if (data.constraint == newConstraint)
3979 const QRect oldVal = data.val;
3981 data.constraint = newConstraint;
3983 if (!data.constraint.isNull() && !data.constraint.contains(oldVal)) {
3984 QRect r1 = data.constraint;
3985 QRect r2 = data.val;
3987 if (r2.width() > r1.width())
3988 r2.setWidth(r1.width());
3989 if (r2.height() > r1.height())
3990 r2.setHeight(r1.height());
3991 if (r2.left() < r1.left())
3992 r2.moveLeft(r1.left());
3993 else if (r2.right() > r1.right())
3994 r2.moveRight(r1.right());
3995 if (r2.top() < r1.top())
3996 r2.moveTop(r1.top());
3997 else if (r2.bottom() > r1.bottom())
3998 r2.moveBottom(r1.bottom());
4005 emit constraintChanged(property, data.constraint);
4007 d_ptr->setConstraint(property, data.constraint, data.val);
4009 if (data.val == oldVal)
4012 emit propertyChanged(property);
4013 emit valueChanged(property, data.val);
4017
4018
4021 d_ptr->m_values[property] = QtRectPropertyManagerPrivate::Data();
4023 QtProperty *xProp = d_ptr->m_intPropertyManager->addProperty();
4024 xProp->setPropertyName(tr(
"X"));
4025 d_ptr->m_intPropertyManager->setValue(xProp, 0);
4026 d_ptr->m_propertyToX[property] = xProp;
4027 d_ptr->m_xToProperty[xProp] = property;
4030 QtProperty *yProp = d_ptr->m_intPropertyManager->addProperty();
4031 yProp->setPropertyName(tr(
"Y"));
4032 d_ptr->m_intPropertyManager->setValue(yProp, 0);
4033 d_ptr->m_propertyToY[property] = yProp;
4034 d_ptr->m_yToProperty[yProp] = property;
4037 QtProperty *wProp = d_ptr->m_intPropertyManager->addProperty();
4038 wProp->setPropertyName(tr(
"Width"));
4039 d_ptr->m_intPropertyManager->setValue(wProp, 0);
4040 d_ptr->m_intPropertyManager->setMinimum(wProp, 0);
4041 d_ptr->m_propertyToW[property] = wProp;
4042 d_ptr->m_wToProperty[wProp] = property;
4045 QtProperty *hProp = d_ptr->m_intPropertyManager->addProperty();
4046 hProp->setPropertyName(tr(
"Height"));
4047 d_ptr->m_intPropertyManager->setValue(hProp, 0);
4048 d_ptr->m_intPropertyManager->setMinimum(hProp, 0);
4049 d_ptr->m_propertyToH[property] = hProp;
4050 d_ptr->m_hToProperty[hProp] = property;
4055
4056
4059 QtProperty *xProp = d_ptr->m_propertyToX[property];
4061 d_ptr->m_xToProperty.remove(xProp);
4064 d_ptr->m_propertyToX.remove(property);
4066 QtProperty *yProp = d_ptr->m_propertyToY[property];
4068 d_ptr->m_yToProperty.remove(yProp);
4071 d_ptr->m_propertyToY.remove(property);
4073 QtProperty *wProp = d_ptr->m_propertyToW[property];
4075 d_ptr->m_wToProperty.remove(wProp);
4078 d_ptr->m_propertyToW.remove(property);
4080 QtProperty *hProp = d_ptr->m_propertyToH[property];
4082 d_ptr->m_hToProperty.remove(hProp);
4085 d_ptr->m_propertyToH.remove(property);
4087 d_ptr->m_values.remove(property);
4095 Q_DECLARE_PUBLIC(QtRectFPropertyManager)
4126 if (
QtProperty *prop = m_xToProperty.value(property,
nullptr)) {
4127 QRectF r = m_values[prop].val;
4129 q_ptr->setValue(prop, r);
4130 }
else if (
QtProperty *prop = m_yToProperty.value(property,
nullptr)) {
4131 QRectF r = m_values[prop].val;
4133 q_ptr->setValue(prop, r);
4134 }
else if (
QtProperty *prop = m_wToProperty.value(property,
nullptr)) {
4135 Data data = m_values[prop];
4136 QRectF r = data.val;
4138 if (!data.constraint.isNull() && data.constraint.x() + data.constraint.width() < r.x() + r.width()) {
4139 r.moveLeft(data.constraint.left() + data.constraint.width() - r.width());
4141 q_ptr->setValue(prop, r);
4142 }
else if (
QtProperty *prop = m_hToProperty.value(property,
nullptr)) {
4143 Data data = m_values[prop];
4144 QRectF r = data.val;
4146 if (!data.constraint.isNull() && data.constraint.y() + data.constraint.height() < r.y() + r.height()) {
4147 r.moveTop(data.constraint.top() + data.constraint.height() - r.height());
4149 q_ptr->setValue(prop, r);
4155 if (
QtProperty *pointProp = m_xToProperty.value(property,
nullptr)) {
4156 m_propertyToX[pointProp] =
nullptr;
4157 m_xToProperty.remove(property);
4158 }
else if (
QtProperty *pointProp = m_yToProperty.value(property,
nullptr)) {
4159 m_propertyToY[pointProp] =
nullptr;
4160 m_yToProperty.remove(property);
4161 }
else if (
QtProperty *pointProp = m_wToProperty.value(property,
nullptr)) {
4162 m_propertyToW[pointProp] =
nullptr;
4163 m_wToProperty.remove(property);
4164 }
else if (
QtProperty *pointProp = m_hToProperty.value(property,
nullptr)) {
4165 m_propertyToH[pointProp] =
nullptr;
4166 m_hToProperty.remove(property);
4171 const QRectF &constraint,
const QRectF &val)
4173 const bool isNull = constraint.isNull();
4174 const float left = isNull ? FLT_MIN : constraint.left();
4175 const float right = isNull ? FLT_MAX : constraint.left() + constraint.width();
4176 const float top = isNull ? FLT_MIN : constraint.top();
4177 const float bottom = isNull ? FLT_MAX : constraint.top() + constraint.height();
4178 const float width = isNull ? FLT_MAX : constraint.width();
4179 const float height = isNull ? FLT_MAX : constraint.height();
4181 m_doublePropertyManager->setRange(m_propertyToX[property], left, right);
4182 m_doublePropertyManager->setRange(m_propertyToY[property], top, bottom);
4183 m_doublePropertyManager->setRange(m_propertyToW[property], 0, width);
4184 m_doublePropertyManager->setRange(m_propertyToH[property], 0, height);
4186 m_doublePropertyManager->setValue(m_propertyToX[property], val.x());
4187 m_doublePropertyManager->setValue(m_propertyToY[property], val.y());
4188 m_doublePropertyManager->setValue(m_propertyToW[property], val.width());
4189 m_doublePropertyManager->setValue(m_propertyToH[property], val.height());
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4223
4224
4225
4226
4227
4228
4229
4230
4233
4234
4235
4236
4237
4238
4239
4240
4243
4244
4245
4246
4247
4248
4249
4250
4253
4254
4258 d_ptr->q_ptr =
this;
4260 d_ptr->m_doublePropertyManager =
new QtDoublePropertyManager(
this);
4261 connect(d_ptr->m_doublePropertyManager, &QtDoublePropertyManager::valueChanged,
this,
4262 [
this](QtProperty *property,
double value) { d_ptr->slotDoubleChanged(property, value); });
4263 connect(d_ptr->m_doublePropertyManager, &QtAbstractPropertyManager::propertyDestroyed,
this,
4264 [
this](QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
4268
4269
4276
4277
4278
4279
4280
4281
4282
4283
4284
4287 return d_ptr->m_doublePropertyManager;
4291
4292
4293
4294
4295
4296
4297
4300 return getValue<QRectF>(d_ptr->m_values, property);
4304
4305
4306
4307
4310 return getData<
int>(d_ptr->m_values, &QtRectFPropertyManagerPrivate::Data::decimals, property, 0);
4314
4315
4316
4317
4320 return getData<QRectF>(d_ptr->m_values, &QtRectFPropertyManagerPrivate::Data::constraint, property, QRect());
4324
4325
4328 const auto it = d_ptr->m_values.constFind(property);
4329 if (it == d_ptr->m_values.constEnd())
4331 const QRectF v = it.value().val;
4332 const int dec = it.value().decimals;
4333 return QString(tr(
"[(%1, %2), %3 x %4]").arg(QString::number(v.x(),
'f', dec),
4334 QString::number(v.y(),
'f', dec),
4335 QString::number(v.width(),
'f', dec),
4336 QString::number(v.height(),
'f', dec)));
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4353 const auto it = d_ptr->m_values.find(property);
4354 if (it == d_ptr->m_values.end())
4359 QRectF newRect = val.normalized();
4360 if (!data.constraint.isNull() && !data.constraint.contains(newRect)) {
4361 const QRectF r1 = data.constraint;
4362 const QRectF r2 = newRect;
4363 newRect.setLeft(qMax(r1.left(), r2.left()));
4364 newRect.setRight(qMin(r1.right(), r2.right()));
4365 newRect.setTop(qMax(r1.top(), r2.top()));
4366 newRect.setBottom(qMin(r1.bottom(), r2.bottom()));
4367 if (newRect.width() < 0 || newRect.height() < 0)
4371 if (data.val == newRect)
4377 d_ptr->m_doublePropertyManager->setValue(d_ptr->m_propertyToX[property], newRect.x());
4378 d_ptr->m_doublePropertyManager->setValue(d_ptr->m_propertyToY[property], newRect.y());
4379 d_ptr->m_doublePropertyManager->setValue(d_ptr->m_propertyToW[property], newRect.width());
4380 d_ptr->m_doublePropertyManager->setValue(d_ptr->m_propertyToH[property], newRect.height());
4382 emit propertyChanged(property);
4383 emit valueChanged(property, data.val);
4387
4388
4389
4390
4391
4392
4393
4394
4395
4398 const auto it = d_ptr->m_values.find(property);
4399 if (it == d_ptr->m_values.end())
4404 QRectF newConstraint = constraint.normalized();
4405 if (data.constraint == newConstraint)
4408 const QRectF oldVal = data.val;
4410 data.constraint = newConstraint;
4412 if (!data.constraint.isNull() && !data.constraint.contains(oldVal)) {
4413 QRectF r1 = data.constraint;
4414 QRectF r2 = data.val;
4416 if (r2.width() > r1.width())
4417 r2.setWidth(r1.width());
4418 if (r2.height() > r1.height())
4419 r2.setHeight(r1.height());
4420 if (r2.left() < r1.left())
4421 r2.moveLeft(r1.left());
4422 else if (r2.right() > r1.right())
4423 r2.moveRight(r1.right());
4424 if (r2.top() < r1.top())
4425 r2.moveTop(r1.top());
4426 else if (r2.bottom() > r1.bottom())
4427 r2.moveBottom(r1.bottom());
4434 emit constraintChanged(property, data.constraint);
4436 d_ptr->setConstraint(property, data.constraint, data.val);
4438 if (data.val == oldVal)
4441 emit propertyChanged(property);
4442 emit valueChanged(property, data.val);
4446
4447
4448
4449
4450
4451
4452
4453
4456 const auto it = d_ptr->m_values.find(property);
4457 if (it == d_ptr->m_values.end())
4471 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToX[property], prec);
4472 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToY[property], prec);
4473 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToW[property], prec);
4474 d_ptr->m_doublePropertyManager->setDecimals(d_ptr->m_propertyToH[property], prec);
4478 emit decimalsChanged(property, data
.decimals);
4482
4483
4486 d_ptr->m_values[property] = QtRectFPropertyManagerPrivate::Data();
4488 QtProperty *xProp = d_ptr->m_doublePropertyManager->addProperty();
4489 xProp->setPropertyName(tr(
"X"));
4490 d_ptr->m_doublePropertyManager->setDecimals(xProp, decimals(property));
4491 d_ptr->m_doublePropertyManager->setValue(xProp, 0);
4492 d_ptr->m_propertyToX[property] = xProp;
4493 d_ptr->m_xToProperty[xProp] = property;
4496 QtProperty *yProp = d_ptr->m_doublePropertyManager->addProperty();
4497 yProp->setPropertyName(tr(
"Y"));
4498 d_ptr->m_doublePropertyManager->setDecimals(yProp, decimals(property));
4499 d_ptr->m_doublePropertyManager->setValue(yProp, 0);
4500 d_ptr->m_propertyToY[property] = yProp;
4501 d_ptr->m_yToProperty[yProp] = property;
4504 QtProperty *wProp = d_ptr->m_doublePropertyManager->addProperty();
4505 wProp->setPropertyName(tr(
"Width"));
4506 d_ptr->m_doublePropertyManager->setDecimals(wProp, decimals(property));
4507 d_ptr->m_doublePropertyManager->setValue(wProp, 0);
4508 d_ptr->m_doublePropertyManager->setMinimum(wProp, 0);
4509 d_ptr->m_propertyToW[property] = wProp;
4510 d_ptr->m_wToProperty[wProp] = property;
4513 QtProperty *hProp = d_ptr->m_doublePropertyManager->addProperty();
4514 hProp->setPropertyName(tr(
"Height"));
4515 d_ptr->m_doublePropertyManager->setDecimals(hProp, decimals(property));
4516 d_ptr->m_doublePropertyManager->setValue(hProp, 0);
4517 d_ptr->m_doublePropertyManager->setMinimum(hProp, 0);
4518 d_ptr->m_propertyToH[property] = hProp;
4519 d_ptr->m_hToProperty[hProp] = property;
4524
4525
4528 QtProperty *xProp = d_ptr->m_propertyToX[property];
4530 d_ptr->m_xToProperty.remove(xProp);
4533 d_ptr->m_propertyToX.remove(property);
4535 QtProperty *yProp = d_ptr->m_propertyToY[property];
4537 d_ptr->m_yToProperty.remove(yProp);
4540 d_ptr->m_propertyToY.remove(property);
4542 QtProperty *wProp = d_ptr->m_propertyToW[property];
4544 d_ptr->m_wToProperty.remove(wProp);
4547 d_ptr->m_propertyToW.remove(property);
4549 QtProperty *hProp = d_ptr->m_propertyToH[property];
4551 d_ptr->m_hToProperty.remove(hProp);
4554 d_ptr->m_propertyToH.remove(property);
4556 d_ptr->m_values.remove(property);
4564 Q_DECLARE_PUBLIC(QtEnumPropertyManager)
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4604
4605
4606
4607
4608
4609
4610
4611
4614
4615
4616
4617
4618
4619
4620
4621
4624
4625
4626
4627
4628
4629
4630
4631
4634
4635
4639 d_ptr->q_ptr =
this;
4643
4644
4651
4652
4653
4654
4655
4656
4657
4658
4661 return getValue<
int>(d_ptr->m_values, property, -1);
4665
4666
4667
4668
4671 return getData<QStringList>(d_ptr->m_values, &QtEnumPropertyManagerPrivate::Data::enumNames, property, QStringList());
4675
4676
4677
4678
4681 return getData<QMap<
int, QIcon> >(d_ptr->m_values, &QtEnumPropertyManagerPrivate::Data::enumIcons, property, QMap<
int, QIcon>());
4685
4686
4689 const auto it = d_ptr->m_values.constFind(property);
4690 if (it == d_ptr->m_values.constEnd())
4693 const QtEnumPropertyManagerPrivate::Data &data = it.value();
4695 const int v = data.val;
4696 if (v >= 0 && v < data.enumNames.size())
4697 return data.enumNames.at(v);
4702
4703
4706 const auto it = d_ptr->m_values.constFind(property);
4707 if (it == d_ptr->m_values.constEnd())
4710 const QtEnumPropertyManagerPrivate::Data &data = it.value();
4712 const int v = data.val;
4713 return data.enumIcons.value(v);
4717
4718
4719
4720
4721
4722
4723
4724
4725
4728 const auto it = d_ptr->m_values.find(property);
4729 if (it == d_ptr->m_values.end())
4732 QtEnumPropertyManagerPrivate::Data data = it.value();
4734 if (val >= data.enumNames.size())
4737 if (val < 0 && !data.enumNames.empty())
4743 if (data.val == val)
4750 emit propertyChanged(property);
4751 emit valueChanged(property, data.val);
4755
4756
4757
4758
4759
4760
4761
4762
4763
4766 const auto it = d_ptr->m_values.find(property);
4767 if (it == d_ptr->m_values.end())
4770 QtEnumPropertyManagerPrivate::Data data = it.value();
4772 if (data.enumNames == enumNames)
4775 data.enumNames = enumNames;
4779 if (!enumNames.empty())
4784 emit enumNamesChanged(property, data.enumNames);
4786 emit propertyChanged(property);
4787 emit valueChanged(property, data.val);
4791
4792
4793
4794
4795
4796
4797
4800 const auto it = d_ptr->m_values.find(property);
4801 if (it == d_ptr->m_values.end())
4804 it.value().enumIcons = enumIcons;
4806 emit enumIconsChanged(property, it.value().enumIcons);
4808 emit propertyChanged(property);
4812
4813
4816 d_ptr->m_values[property] = QtEnumPropertyManagerPrivate::Data();
4820
4821
4824 d_ptr->m_values.remove(property);
4832 Q_DECLARE_PUBLIC(QtFlagPropertyManager)
4855 QtProperty *prop = m_flagToProperty.value(property,
nullptr);
4856 if (prop ==
nullptr)
4859 const auto pfit = m_propertyToFlags.constFind(prop);
4860 if (pfit == m_propertyToFlags.constEnd())
4863 for (QtProperty *p : pfit.value()) {
4864 if (p == property) {
4865 int v = m_values[prop].val;
4871 q_ptr->setValue(prop, v);
4880 QtProperty *flagProperty = m_flagToProperty.value(property,
nullptr);
4881 if (flagProperty ==
nullptr)
4884 m_propertyToFlags[flagProperty].replace(m_propertyToFlags[flagProperty].indexOf(property),
nullptr);
4885 m_flagToProperty.remove(property);
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4923
4924
4925
4926
4927
4928
4929
4930
4933
4934
4935
4936
4937
4938
4939
4940
4943
4944
4948 d_ptr->q_ptr =
this;
4950 d_ptr->m_boolPropertyManager =
new QtBoolPropertyManager(
this);
4951 connect(d_ptr->m_boolPropertyManager, &QtBoolPropertyManager::valueChanged,
this,
4952 [
this](QtProperty *property,
bool value) { d_ptr->slotBoolChanged(property, value); });
4953 connect(d_ptr->m_boolPropertyManager, &QtAbstractPropertyManager::propertyDestroyed,
this,
4954 [
this](QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
4958
4959
4966
4967
4968
4969
4970
4971
4972
4973
4974
4977 return d_ptr->m_boolPropertyManager;
4981
4982
4983
4984
4985
4986
4987
4990 return getValue<
int>(d_ptr->m_values, property, 0);
4994
4995
4996
4997
5000 return getData<QStringList>(d_ptr->m_values, &QtFlagPropertyManagerPrivate::Data::flagNames, property, QStringList());
5004
5005
5008 const auto it = d_ptr->m_values.constFind(property);
5009 if (it == d_ptr->m_values.constEnd())
5016 const QChar bar = QLatin1Char(
'|');
5017 for (
const auto &name : data.flagNames) {
5018 if (data.val & (1 << level)) {
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5044 const auto it = d_ptr->m_values.find(property);
5045 if (it == d_ptr->m_values.end())
5050 if (data
.val == val)
5053 if (val > (1 << data.flagNames.size()) - 1)
5063 const auto pfit = d_ptr->m_propertyToFlags.constFind(property);
5065 if (pfit != d_ptr->m_propertyToFlags.constEnd()) {
5066 for (QtProperty *prop : pfit.value()) {
5068 d_ptr->m_boolPropertyManager->setValue(prop, val & (1 << level));
5073 emit propertyChanged(property);
5074 emit valueChanged(property, data
.val);
5078
5079
5080
5081
5082
5083
5086 const auto it = d_ptr->m_values.find(property);
5087 if (it == d_ptr->m_values.end())
5092 if (data.flagNames == flagNames)
5095 data.flagNames = flagNames;
5100 const auto pfit = d_ptr->m_propertyToFlags.find(property);
5101 if (pfit != d_ptr->m_propertyToFlags.end()) {
5102 for (QtProperty *prop : std::as_const(pfit.value())) {
5105 d_ptr->m_flagToProperty.remove(prop);
5108 pfit.value().clear();
5111 for (
const QString &flagName : flagNames) {
5112 QtProperty *prop = d_ptr->m_boolPropertyManager->addProperty();
5113 prop->setPropertyName(flagName);
5114 property->addSubProperty(prop);
5115 d_ptr->m_propertyToFlags[property].append(prop);
5116 d_ptr->m_flagToProperty[prop] = property;
5119 emit flagNamesChanged(property, data.flagNames);
5121 emit propertyChanged(property);
5122 emit valueChanged(property, data
.val);
5126
5127
5130 d_ptr->m_values[property] = QtFlagPropertyManagerPrivate::Data();
5132 d_ptr->m_propertyToFlags[property] = QList<QtProperty *>();
5136
5137
5140 const auto it = d_ptr->m_propertyToFlags.find(property);
5141 if (it != d_ptr->m_propertyToFlags.end()) {
5142 for (QtProperty *prop : std::as_const(it.value())) {
5144 d_ptr->m_flagToProperty.remove(prop);
5149 d_ptr->m_propertyToFlags.erase(it);
5151 d_ptr->m_values.remove(property);
5159 Q_DECLARE_PUBLIC(QtSizePolicyPropertyManager)
5184 if (
QtProperty *prop = m_hStretchToProperty.value(property,
nullptr)) {
5185 QSizePolicy sp = m_values[prop];
5186 sp.setHorizontalStretch(value);
5187 q_ptr->setValue(prop, sp);
5188 }
else if (
QtProperty *prop = m_vStretchToProperty.value(property,
nullptr)) {
5189 QSizePolicy sp = m_values[prop];
5190 sp.setVerticalStretch(value);
5191 q_ptr->setValue(prop, sp);
5197 if (
QtProperty *prop = m_hPolicyToProperty.value(property,
nullptr)) {
5198 QSizePolicy sp = m_values[prop];
5199 sp.setHorizontalPolicy(metaEnumProvider()->indexToSizePolicy(value));
5200 q_ptr->setValue(prop, sp);
5201 }
else if (
QtProperty *prop = m_vPolicyToProperty.value(property,
nullptr)) {
5202 QSizePolicy sp = m_values[prop];
5203 sp.setVerticalPolicy(metaEnumProvider()->indexToSizePolicy(value));
5204 q_ptr->setValue(prop, sp);
5210 if (
QtProperty *pointProp = m_hStretchToProperty.value(property,
nullptr)) {
5211 m_propertyToHStretch[pointProp] =
nullptr;
5212 m_hStretchToProperty.remove(property);
5213 }
else if (
QtProperty *pointProp = m_vStretchToProperty.value(property,
nullptr)) {
5214 m_propertyToVStretch[pointProp] =
nullptr;
5215 m_vStretchToProperty.remove(property);
5216 }
else if (
QtProperty *pointProp = m_hPolicyToProperty.value(property,
nullptr)) {
5217 m_propertyToHPolicy[pointProp] =
nullptr;
5218 m_hPolicyToProperty.remove(property);
5219 }
else if (
QtProperty *pointProp = m_vPolicyToProperty.value(property,
nullptr)) {
5220 m_propertyToVPolicy[pointProp] =
nullptr;
5221 m_vPolicyToProperty.remove(property);
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5252
5253
5254
5255
5256
5257
5258
5259
5262
5263
5267 d_ptr->q_ptr =
this;
5269 d_ptr->m_intPropertyManager =
new QtIntPropertyManager(
this);
5270 connect(d_ptr->m_intPropertyManager, &QtIntPropertyManager::valueChanged,
this,
5271 [
this](QtProperty *property,
int value) { d_ptr->slotIntChanged(property, value); });
5272 connect(d_ptr->m_intPropertyManager, &QtAbstractPropertyManager::propertyDestroyed,
this,
5273 [
this](QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
5275 d_ptr->m_enumPropertyManager =
new QtEnumPropertyManager(
this);
5276 connect(d_ptr->m_enumPropertyManager, &QtEnumPropertyManager::valueChanged,
this,
5277 [
this](QtProperty *property,
int value) { d_ptr->slotEnumChanged(property, value); });
5278 connect(d_ptr->m_enumPropertyManager, &QtEnumPropertyManager::propertyDestroyed,
this,
5279 [
this](QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
5283
5284
5291
5292
5293
5294
5295
5296
5297
5298
5299
5302 return d_ptr->m_intPropertyManager;
5306
5307
5308
5309
5310
5311
5312
5313
5314
5317 return d_ptr->m_enumPropertyManager;
5321
5322
5323
5324
5325
5326
5327
5330 return d_ptr->m_values.value(property, QSizePolicy());
5334
5335
5338 const auto it = d_ptr->m_values.constFind(property);
5339 if (it == d_ptr->m_values.constEnd())
5342 const QSizePolicy sp = it.value();
5344 const int hIndex = mep->sizePolicyToIndex(sp.horizontalPolicy());
5345 const int vIndex = mep->sizePolicyToIndex(sp.verticalPolicy());
5347 const QString hPolicy = hIndex != -1 ? mep->policyEnumNames().at(hIndex) : tr(
"<Invalid>");
5348 const QString vPolicy = vIndex != -1 ? mep->policyEnumNames().at(vIndex) : tr(
"<Invalid>");
5349 const QString str = tr(
"[%1, %2, %3, %4]").arg(hPolicy, vPolicy).arg(sp.horizontalStretch()).arg(sp.verticalStretch());
5354
5355
5356
5357
5358
5359
5360
5363 const auto it = d_ptr->m_values.find(property);
5364 if (it == d_ptr->m_values.end())
5367 if (it.value() == val)
5372 d_ptr->m_enumPropertyManager->setValue(d_ptr->m_propertyToHPolicy[property],
5373 metaEnumProvider()->sizePolicyToIndex(val.horizontalPolicy()));
5374 d_ptr->m_enumPropertyManager->setValue(d_ptr->m_propertyToVPolicy[property],
5375 metaEnumProvider()->sizePolicyToIndex(val.verticalPolicy()));
5376 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToHStretch[property],
5377 val.horizontalStretch());
5378 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToVStretch[property],
5379 val.verticalStretch());
5381 emit propertyChanged(property);
5382 emit valueChanged(property, val);
5386
5387
5391 d_ptr->m_values[property] = val;
5393 QtProperty *hPolicyProp = d_ptr->m_enumPropertyManager->addProperty();
5394 hPolicyProp->setPropertyName(tr(
"Horizontal Policy"));
5395 d_ptr->m_enumPropertyManager->setEnumNames(hPolicyProp, metaEnumProvider()->policyEnumNames());
5396 d_ptr->m_enumPropertyManager->setValue(hPolicyProp,
5397 metaEnumProvider()->sizePolicyToIndex(val.horizontalPolicy()));
5398 d_ptr->m_propertyToHPolicy[property] = hPolicyProp;
5399 d_ptr->m_hPolicyToProperty[hPolicyProp] = property;
5402 QtProperty *vPolicyProp = d_ptr->m_enumPropertyManager->addProperty();
5403 vPolicyProp->setPropertyName(tr(
"Vertical Policy"));
5404 d_ptr->m_enumPropertyManager->setEnumNames(vPolicyProp, metaEnumProvider()->policyEnumNames());
5405 d_ptr->m_enumPropertyManager->setValue(vPolicyProp,
5406 metaEnumProvider()->sizePolicyToIndex(val.verticalPolicy()));
5407 d_ptr->m_propertyToVPolicy[property] = vPolicyProp;
5408 d_ptr->m_vPolicyToProperty[vPolicyProp] = property;
5411 QtProperty *hStretchProp = d_ptr->m_intPropertyManager->addProperty();
5412 hStretchProp->setPropertyName(tr(
"Horizontal Stretch"));
5413 d_ptr->m_intPropertyManager->setValue(hStretchProp, val.horizontalStretch());
5414 d_ptr->m_intPropertyManager->setRange(hStretchProp, 0, 0xff);
5415 d_ptr->m_propertyToHStretch[property] = hStretchProp;
5416 d_ptr->m_hStretchToProperty[hStretchProp] = property;
5419 QtProperty *vStretchProp = d_ptr->m_intPropertyManager->addProperty();
5420 vStretchProp->setPropertyName(tr(
"Vertical Stretch"));
5421 d_ptr->m_intPropertyManager->setValue(vStretchProp, val.verticalStretch());
5422 d_ptr->m_intPropertyManager->setRange(vStretchProp, 0, 0xff);
5423 d_ptr->m_propertyToVStretch[property] = vStretchProp;
5424 d_ptr->m_vStretchToProperty[vStretchProp] = property;
5430
5431
5434 QtProperty *hPolicyProp = d_ptr->m_propertyToHPolicy[property];
5436 d_ptr->m_hPolicyToProperty.remove(hPolicyProp);
5439 d_ptr->m_propertyToHPolicy.remove(property);
5441 QtProperty *vPolicyProp = d_ptr->m_propertyToVPolicy[property];
5443 d_ptr->m_vPolicyToProperty.remove(vPolicyProp);
5446 d_ptr->m_propertyToVPolicy.remove(property);
5448 QtProperty *hStretchProp = d_ptr->m_propertyToHStretch[property];
5450 d_ptr->m_hStretchToProperty.remove(hStretchProp);
5451 delete hStretchProp;
5453 d_ptr->m_propertyToHStretch.remove(property);
5455 QtProperty *vStretchProp = d_ptr->m_propertyToVStretch[property];
5457 d_ptr->m_vStretchToProperty.remove(vStretchProp);
5458 delete vStretchProp;
5460 d_ptr->m_propertyToVStretch.remove(property);
5462 d_ptr->m_values.remove(property);
5476 Q_DECLARE_PUBLIC(QtFontPropertyManager)
5520 if (
QtProperty *prop = m_pointSizeToProperty.value(property,
nullptr)) {
5521 QFont f = m_values[prop];
5522 f.setPointSize(value);
5523 q_ptr->setValue(prop, f);
5531 if (
QtProperty *prop = m_familyToProperty.value(property,
nullptr)) {
5532 QFont f = m_values[prop];
5533 f.setFamily(m_familyNames.at(value));
5534 q_ptr->setValue(prop, f);
5535 }
else if (
auto *prop = m_weightToProperty.value(property,
nullptr)) {
5536 QFont f = m_values[prop];
5537 f.setWeight(weightFromIndex(value));
5538 q_ptr->setValue(prop, f);
5546 if (
QtProperty *prop = m_boldToProperty.value(property,
nullptr)) {
5547 QFont f = m_values[prop];
5549 q_ptr->setValue(prop, f);
5550 }
else if (
QtProperty *prop = m_italicToProperty.value(property,
nullptr)) {
5551 QFont f = m_values[prop];
5553 q_ptr->setValue(prop, f);
5554 }
else if (
QtProperty *prop = m_underlineToProperty.value(property,
nullptr)) {
5555 QFont f = m_values[prop];
5556 f.setUnderline(value);
5557 q_ptr->setValue(prop, f);
5558 }
else if (
QtProperty *prop = m_strikeOutToProperty.value(property,
nullptr)) {
5559 QFont f = m_values[prop];
5560 f.setStrikeOut(value);
5561 q_ptr->setValue(prop, f);
5562 }
else if (
QtProperty *prop = m_kerningToProperty.value(property,
nullptr)) {
5563 QFont f = m_values[prop];
5564 f.setKerning(value);
5565 q_ptr->setValue(prop, f);
5571 if (
QtProperty *pointProp = m_pointSizeToProperty.value(property,
nullptr)) {
5572 m_propertyToPointSize[pointProp] =
nullptr;
5573 m_pointSizeToProperty.remove(property);
5574 }
else if (
QtProperty *pointProp = m_familyToProperty.value(property,
nullptr)) {
5575 m_propertyToFamily[pointProp] =
nullptr;
5576 m_familyToProperty.remove(property);
5577 }
else if (
QtProperty *pointProp = m_boldToProperty.value(property,
nullptr)) {
5578 m_propertyToBold[pointProp] =
nullptr;
5579 m_boldToProperty.remove(property);
5580 }
else if (
QtProperty *pointProp = m_italicToProperty.value(property,
nullptr)) {
5581 m_propertyToItalic[pointProp] =
nullptr;
5582 m_italicToProperty.remove(property);
5583 }
else if (
QtProperty *pointProp = m_underlineToProperty.value(property,
nullptr)) {
5584 m_propertyToUnderline[pointProp] =
nullptr;
5585 m_underlineToProperty.remove(property);
5586 }
else if (
QtProperty *pointProp = m_strikeOutToProperty.value(property,
nullptr)) {
5587 m_propertyToStrikeOut[pointProp] =
nullptr;
5588 m_strikeOutToProperty.remove(property);
5589 }
else if (
QtProperty *pointProp = m_kerningToProperty.value(property,
nullptr)) {
5590 m_propertyToKerning[pointProp] =
nullptr;
5591 m_kerningToProperty.remove(property);
5592 }
else if (
QtProperty *weightProp = m_weightToProperty.value(property,
nullptr)) {
5593 m_propertyToWeight[weightProp] =
nullptr;
5594 m_weightToProperty.remove(property);
5600 if (!m_fontDatabaseChangeTimer) {
5601 m_fontDatabaseChangeTimer =
new QTimer(q_ptr);
5602 m_fontDatabaseChangeTimer->setInterval(0);
5603 m_fontDatabaseChangeTimer->setSingleShot(
true);
5604 QObject::connect(m_fontDatabaseChangeTimer, &QTimer::timeout, q_ptr,
5605 [
this] { slotFontDatabaseDelayedChange(); });
5607 if (!m_fontDatabaseChangeTimer->isActive())
5608 m_fontDatabaseChangeTimer->start();
5614 const QStringList oldFamilies = m_familyNames;
5615 m_familyNames = QFontDatabase::families();
5618 if (!m_propertyToFamily.isEmpty()) {
5619 for (QtProperty *familyProp : std::as_const(m_propertyToFamily)) {
5620 const int oldIdx = m_enumPropertyManager->value(familyProp);
5621 qsizetype newIdx = m_familyNames.indexOf(oldFamilies.at(oldIdx));
5624 m_enumPropertyManager->setEnumNames(familyProp, m_familyNames);
5625 m_enumPropertyManager->setValue(familyProp, newIdx);
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5658
5659
5660
5661
5662
5663
5664
5665
5668
5669
5673 d_ptr->q_ptr =
this;
5674 QObject::connect(qApp, &QGuiApplication::fontDatabaseChanged,
this,
5675 [
this] { d_ptr->slotFontDatabaseChanged(); });
5677 d_ptr->m_intPropertyManager =
new QtIntPropertyManager(
this);
5678 connect(d_ptr->m_intPropertyManager, &QtIntPropertyManager::valueChanged,
this,
5679 [
this](QtProperty *property,
int value) { d_ptr->slotIntChanged(property, value); });
5680 connect(d_ptr->m_intPropertyManager, &QtAbstractPropertyManager::propertyDestroyed,
this,
5681 [
this](QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
5683 d_ptr->m_enumPropertyManager =
new QtEnumPropertyManager(
this);
5684 connect(d_ptr->m_enumPropertyManager, &QtEnumPropertyManager::valueChanged,
this,
5685 [
this](QtProperty *property,
int value) { d_ptr->slotEnumChanged(property, value); });
5686 connect(d_ptr->m_enumPropertyManager, &QtAbstractPropertyManager::propertyDestroyed,
this,
5687 [
this](QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
5689 d_ptr->m_boolPropertyManager =
new QtBoolPropertyManager(
this);
5690 connect(d_ptr->m_boolPropertyManager, &QtBoolPropertyManager::valueChanged,
this,
5691 [
this](QtProperty *property,
bool value) { d_ptr->slotBoolChanged(property, value); });
5692 connect(d_ptr->m_boolPropertyManager, &QtAbstractPropertyManager::propertyDestroyed,
this,
5693 [
this](QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
5697
5698
5705
5706
5707
5708
5709
5710
5711
5712
5715 return d_ptr->m_intPropertyManager;
5719
5720
5721
5722
5723
5724
5725
5726
5729 return d_ptr->m_enumPropertyManager;
5733
5734
5735
5736
5737
5738
5739
5740
5741
5744 return d_ptr->m_boolPropertyManager;
5748
5749
5750
5751
5752
5753
5754
5755
5758 return d_ptr->m_values.value(property, QFont());
5762
5763
5766 const auto it = d_ptr->m_values.constFind(property);
5767 if (it == d_ptr->m_values.constEnd())
5770 return QtPropertyBrowserUtils::fontValueText(it.value());
5774
5775
5778 const auto it = d_ptr->m_values.constFind(property);
5779 if (it == d_ptr->m_values.constEnd())
5782 return QtPropertyBrowserUtils::fontValueIcon(it.value());
5786
5787
5788
5789
5790
5791
5792
5795 const auto it = d_ptr->m_values.find(property);
5796 if (it == d_ptr->m_values.end())
5799 const QFont &oldVal = it.value();
5800 if (oldVal == val && oldVal.resolveMask() == val.resolveMask())
5805 qsizetype idx = d_ptr->m_familyNames.indexOf(val.family());
5808 bool settingValue = d_ptr->m_settingValue;
5809 d_ptr->m_settingValue =
true;
5810 d_ptr->m_enumPropertyManager->setValue(d_ptr->m_propertyToFamily[property], idx);
5811 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToPointSize[property], val.pointSize());
5812 d_ptr->m_boolPropertyManager->setValue(d_ptr->m_propertyToBold[property], val.bold());
5813 d_ptr->m_boolPropertyManager->setValue(d_ptr->m_propertyToItalic[property], val.italic());
5814 d_ptr->m_boolPropertyManager->setValue(d_ptr->m_propertyToUnderline[property], val.underline());
5815 d_ptr->m_boolPropertyManager->setValue(d_ptr->m_propertyToStrikeOut[property], val.strikeOut());
5816 d_ptr->m_boolPropertyManager->setValue(d_ptr->m_propertyToKerning[property], val.kerning());
5817 d_ptr->m_enumPropertyManager->setValue(d_ptr->m_propertyToWeight[property],
5818 indexOfFontWeight(val.weight()));
5819 d_ptr->m_settingValue = settingValue;
5821 emit propertyChanged(property);
5822 emit valueChanged(property, val);
5827 static const DisambiguatedTranslation weightsC[] = {
5828 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"Thin",
"QFont::Weight combo"),
5829 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"ExtraLight",
"QFont::Weight combo"),
5830 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"Light",
"QFont::Weight combo"),
5831 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"Normal",
"QFont::Weight combo"),
5832 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"Medium",
"QFont::Weight combo"),
5833 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"DemiBold",
"QFont::Weight combo"),
5834 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"Bold",
"QFont::Weight combo"),
5835 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"ExtraBold",
"QFont::Weight combo"),
5836 QT_TRANSLATE_NOOP3(
"FontPropertyManager",
"Black",
"QFont::Weight combo")
5840 for (
const auto &w : weightsC)
5841 result.append(QCoreApplication::translate(
"FontPropertyManager", w.first, w.second));
5846
5847
5851 d_ptr->m_values[property] = val;
5853 QtProperty *familyProp = d_ptr->m_enumPropertyManager->addProperty();
5854 familyProp->setPropertyName(tr(
"Family"));
5855 if (d_ptr->m_familyNames.isEmpty())
5856 d_ptr->m_familyNames = QFontDatabase::families();
5857 d_ptr->m_enumPropertyManager->setEnumNames(familyProp, d_ptr->m_familyNames);
5858 qsizetype idx = d_ptr->m_familyNames.indexOf(val.family());
5861 d_ptr->m_enumPropertyManager->setValue(familyProp, idx);
5862 d_ptr->m_propertyToFamily[property] = familyProp;
5863 d_ptr->m_familyToProperty[familyProp] = property;
5866 QtProperty *pointSizeProp = d_ptr->m_intPropertyManager->addProperty();
5867 pointSizeProp->setPropertyName(tr(
"Point Size"));
5868 d_ptr->m_intPropertyManager->setValue(pointSizeProp, val.pointSize());
5869 d_ptr->m_intPropertyManager->setMinimum(pointSizeProp, 1);
5870 d_ptr->m_propertyToPointSize[property] = pointSizeProp;
5871 d_ptr->m_pointSizeToProperty[pointSizeProp] = property;
5874 QtProperty *boldProp = d_ptr->m_boolPropertyManager->addProperty();
5875 boldProp->setPropertyName(tr(
"Bold",
"Bold toggle"));
5876 d_ptr->m_boolPropertyManager->setValue(boldProp, val.bold());
5877 d_ptr->m_propertyToBold[property] = boldProp;
5878 d_ptr->m_boldToProperty[boldProp] = property;
5881 QtProperty *italicProp = d_ptr->m_boolPropertyManager->addProperty();
5882 italicProp->setPropertyName(tr(
"Italic"));
5883 d_ptr->m_boolPropertyManager->setValue(italicProp, val.italic());
5884 d_ptr->m_propertyToItalic[property] = italicProp;
5885 d_ptr->m_italicToProperty[italicProp] = property;
5888 QtProperty *underlineProp = d_ptr->m_boolPropertyManager->addProperty();
5889 underlineProp->setPropertyName(tr(
"Underline"));
5890 d_ptr->m_boolPropertyManager->setValue(underlineProp, val.underline());
5891 d_ptr->m_propertyToUnderline[property] = underlineProp;
5892 d_ptr->m_underlineToProperty[underlineProp] = property;
5895 QtProperty *strikeOutProp = d_ptr->m_boolPropertyManager->addProperty();
5896 strikeOutProp->setPropertyName(tr(
"Strikeout"));
5897 d_ptr->m_boolPropertyManager->setValue(strikeOutProp, val.strikeOut());
5898 d_ptr->m_propertyToStrikeOut[property] = strikeOutProp;
5899 d_ptr->m_strikeOutToProperty[strikeOutProp] = property;
5902 QtProperty *kerningProp = d_ptr->m_boolPropertyManager->addProperty();
5903 kerningProp->setPropertyName(tr(
"Kerning"));
5904 d_ptr->m_boolPropertyManager->setValue(kerningProp, val.kerning());
5905 d_ptr->m_propertyToKerning[property] = kerningProp;
5906 d_ptr->m_kerningToProperty[kerningProp] = property;
5909 auto *weightProp = d_ptr->m_enumPropertyManager->addProperty();
5910 weightProp->setPropertyName(tr(
"Weight"));
5911 static const QStringList weightNames = fontWeightNames();
5912 d_ptr->m_enumPropertyManager->setEnumNames(weightProp, weightNames);
5913 d_ptr->m_enumPropertyManager->setValue(weightProp, indexOfFontWeight(val.weight()));
5914 d_ptr->m_propertyToWeight[property] = weightProp;
5915 d_ptr->m_weightToProperty[weightProp] = property;
5920
5921
5924 QtProperty *familyProp = d_ptr->m_propertyToFamily[property];
5926 d_ptr->m_familyToProperty.remove(familyProp);
5929 d_ptr->m_propertyToFamily.remove(property);
5931 QtProperty *pointSizeProp = d_ptr->m_propertyToPointSize[property];
5932 if (pointSizeProp) {
5933 d_ptr->m_pointSizeToProperty.remove(pointSizeProp);
5934 delete pointSizeProp;
5936 d_ptr->m_propertyToPointSize.remove(property);
5938 QtProperty *boldProp = d_ptr->m_propertyToBold[property];
5940 d_ptr->m_boldToProperty.remove(boldProp);
5943 d_ptr->m_propertyToBold.remove(property);
5945 QtProperty *italicProp = d_ptr->m_propertyToItalic[property];
5947 d_ptr->m_italicToProperty.remove(italicProp);
5950 d_ptr->m_propertyToItalic.remove(property);
5952 QtProperty *underlineProp = d_ptr->m_propertyToUnderline[property];
5953 if (underlineProp) {
5954 d_ptr->m_underlineToProperty.remove(underlineProp);
5955 delete underlineProp;
5957 d_ptr->m_propertyToUnderline.remove(property);
5959 QtProperty *strikeOutProp = d_ptr->m_propertyToStrikeOut[property];
5960 if (strikeOutProp) {
5961 d_ptr->m_strikeOutToProperty.remove(strikeOutProp);
5962 delete strikeOutProp;
5964 d_ptr->m_propertyToStrikeOut.remove(property);
5966 QtProperty *kerningProp = d_ptr->m_propertyToKerning[property];
5968 d_ptr->m_kerningToProperty.remove(kerningProp);
5971 d_ptr->m_propertyToKerning.remove(property);
5973 if (
auto weightProp = d_ptr->m_propertyToWeight[property]) {
5974 d_ptr->m_weightToProperty.remove(weightProp);
5978 d_ptr->m_values.remove(property);
5986 Q_DECLARE_PUBLIC(QtColorPropertyManager)
6009 if (
QtProperty *prop = m_rToProperty.value(property,
nullptr)) {
6010 QColor c = m_values[prop];
6012 q_ptr->setValue(prop, c);
6013 }
else if (
QtProperty *prop = m_gToProperty.value(property,
nullptr)) {
6014 QColor c = m_values[prop];
6016 q_ptr->setValue(prop, c);
6017 }
else if (
QtProperty *prop = m_bToProperty.value(property,
nullptr)) {
6018 QColor c = m_values[prop];
6020 q_ptr->setValue(prop, c);
6021 }
else if (
QtProperty *prop = m_aToProperty.value(property,
nullptr)) {
6022 QColor c = m_values[prop];
6024 q_ptr->setValue(prop, c);
6030 if (
QtProperty *pointProp = m_rToProperty.value(property,
nullptr)) {
6031 m_propertyToR[pointProp] =
nullptr;
6032 m_rToProperty.remove(property);
6033 }
else if (
QtProperty *pointProp = m_gToProperty.value(property,
nullptr)) {
6034 m_propertyToG[pointProp] =
nullptr;
6035 m_gToProperty.remove(property);
6036 }
else if (
QtProperty *pointProp = m_bToProperty.value(property,
nullptr)) {
6037 m_propertyToB[pointProp] =
nullptr;
6038 m_bToProperty.remove(property);
6039 }
else if (
QtProperty *pointProp = m_aToProperty.value(property,
nullptr)) {
6040 m_propertyToA[pointProp] =
nullptr;
6041 m_aToProperty.remove(property);
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6071
6072
6073
6074
6075
6076
6077
6078
6081
6082
6086 d_ptr->q_ptr =
this;
6088 d_ptr->m_intPropertyManager =
new QtIntPropertyManager(
this);
6089 connect(d_ptr->m_intPropertyManager, &QtIntPropertyManager::valueChanged,
this,
6090 [
this](QtProperty *property,
int value) { d_ptr->slotIntChanged(property, value); });
6091 connect(d_ptr->m_intPropertyManager, &QtAbstractPropertyManager::propertyDestroyed,
this,
6092 [
this](QtProperty *property) { d_ptr->slotPropertyDestroyed(property); });
6096
6097
6104
6105
6106
6107
6108
6109
6110
6111
6112
6115 return d_ptr->m_intPropertyManager;
6119
6120
6121
6122
6123
6124
6125
6128 return d_ptr->m_values.value(property, QColor());
6132
6133
6137 const auto it = d_ptr->m_values.constFind(property);
6138 if (it == d_ptr->m_values.constEnd())
6141 return QtPropertyBrowserUtils::colorValueText(it.value());
6145
6146
6150 const auto it = d_ptr->m_values.constFind(property);
6151 if (it == d_ptr->m_values.constEnd())
6153 return QtPropertyBrowserUtils::brushValueIcon(QBrush(it.value()));
6157
6158
6159
6160
6161
6162
6163
6166 const auto it = d_ptr->m_values.find(property);
6167 if (it == d_ptr->m_values.end())
6170 if (it.value() == val)
6175 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToR[property], val.red());
6176 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToG[property], val.green());
6177 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToB[property], val.blue());
6178 d_ptr->m_intPropertyManager->setValue(d_ptr->m_propertyToA[property], val.alpha());
6180 emit propertyChanged(property);
6181 emit valueChanged(property, val);
6185
6186
6190 d_ptr->m_values[property] = val;
6192 QtProperty *rProp = d_ptr->m_intPropertyManager->addProperty();
6193 rProp->setPropertyName(tr(
"Red"));
6194 d_ptr->m_intPropertyManager->setValue(rProp, val.red());
6195 d_ptr->m_intPropertyManager->setRange(rProp, 0, 0xFF);
6196 d_ptr->m_propertyToR[property] = rProp;
6197 d_ptr->m_rToProperty[rProp] = property;
6200 QtProperty *gProp = d_ptr->m_intPropertyManager->addProperty();
6201 gProp->setPropertyName(tr(
"Green"));
6202 d_ptr->m_intPropertyManager->setValue(gProp, val.green());
6203 d_ptr->m_intPropertyManager->setRange(gProp, 0, 0xFF);
6204 d_ptr->m_propertyToG[property] = gProp;
6205 d_ptr->m_gToProperty[gProp] = property;
6208 QtProperty *bProp = d_ptr->m_intPropertyManager->addProperty();
6209 bProp->setPropertyName(tr(
"Blue"));
6210 d_ptr->m_intPropertyManager->setValue(bProp, val.blue());
6211 d_ptr->m_intPropertyManager->setRange(bProp, 0, 0xFF);
6212 d_ptr->m_propertyToB[property] = bProp;
6213 d_ptr->m_bToProperty[bProp] = property;
6216 QtProperty *aProp = d_ptr->m_intPropertyManager->addProperty();
6217 aProp->setPropertyName(tr(
"Alpha"));
6218 d_ptr->m_intPropertyManager->setValue(aProp, val.alpha());
6219 d_ptr->m_intPropertyManager->setRange(aProp, 0, 0xFF);
6220 d_ptr->m_propertyToA[property] = aProp;
6221 d_ptr->m_aToProperty[aProp] = property;
6226
6227
6230 QtProperty *rProp = d_ptr->m_propertyToR[property];
6232 d_ptr->m_rToProperty.remove(rProp);
6235 d_ptr->m_propertyToR.remove(property);
6237 QtProperty *gProp = d_ptr->m_propertyToG[property];
6239 d_ptr->m_gToProperty.remove(gProp);
6242 d_ptr->m_propertyToG.remove(property);
6244 QtProperty *bProp = d_ptr->m_propertyToB[property];
6246 d_ptr->m_bToProperty.remove(bProp);
6249 d_ptr->m_propertyToB.remove(property);
6251 QtProperty *aProp = d_ptr->m_propertyToA[property];
6253 d_ptr->m_aToProperty.remove(aProp);
6256 d_ptr->m_propertyToA.remove(property);
6258 d_ptr->m_values.remove(property);
6266 Q_DECLARE_PUBLIC(QtCursorPropertyManager)
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6289
6290
6291
6292
6293
6294
6295
6296
6299
6300
6304 d_ptr->q_ptr =
this;
6308
6309
6316
6317
6318
6319
6320
6321
6322
6326 return d_ptr->m_values.value(property, QCursor());
6331
6332
6335 const auto it = d_ptr->m_values.constFind(property);
6336 if (it == d_ptr->m_values.constEnd())
6343
6344
6347 const auto it = d_ptr->m_values.constFind(property);
6348 if (it == d_ptr->m_values.constEnd())
6355
6356
6357
6358
6359
6360
6364 const auto it = d_ptr->m_values.find(property);
6365 if (it == d_ptr->m_values.end())
6368 if (it.value().shape() == value.shape() && value.shape() != Qt::BitmapCursor)
6373 emit propertyChanged(property);
6374 emit valueChanged(property, value);
6379
6380
6384 d_ptr->m_values[property] = QCursor();
6389
6390
6393 d_ptr->m_values.remove(property);
6398#include "moc_qtpropertymanager_p.cpp"
6399#include "qtpropertymanager.moc"
The QtAbstractPropertyManager provides an interface for property managers.
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 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.
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 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 QIcon drawCheckBox(bool value)
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