qtvariantproperty.cpp
Go to the documentation of this file.
1/****************************************************************************
2**
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4** Contact: http://www.qt-project.org/legal
5**
6** This file is part of the Qt Solutions component.
7**
8** $QT_BEGIN_LICENSE:BSD$
9** You may use this file under the terms of the BSD license as follows:
10**
11** "Redistribution and use in source and binary forms, with or without
12** modification, are permitted provided that the following conditions are
13** met:
14** * Redistributions of source code must retain the above copyright
15** notice, this list of conditions and the following disclaimer.
16** * Redistributions in binary form must reproduce the above copyright
17** notice, this list of conditions and the following disclaimer in
18** the documentation and/or other materials provided with the
19** distribution.
20** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21** of its contributors may be used to endorse or promote products derived
22** from this software without specific prior written permission.
23**
24**
25** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36**
37** $QT_END_LICENSE$
38**
39****************************************************************************/
40
41
42#include "qtvariantproperty.h"
43
44#include <QDate>
45#include <QIcon>
46#include <QLocale>
47#include <QVariant>
48
49#include "qteditorfactory.h"
50#include "qtpropertymanager.h"
51
52#if defined(Q_CC_MSVC)
53#pragma warning(disable : 4786) /* MS VS 6: truncating debug info after 255 characters */
54#endif
55
56QT_BEGIN_NAMESPACE
57
59{
60};
61
63{
64};
65
67{
68};
69
70QT_END_NAMESPACE
71
72Q_DECLARE_METATYPE(QtEnumPropertyType)
73Q_DECLARE_METATYPE(QtFlagPropertyType)
74Q_DECLARE_METATYPE(QtGroupPropertyType)
75
76QT_BEGIN_NAMESPACE
77
78/*!
79 Returns the type id for an enum property.
80
81 Note that the property's value type can be retrieved using the
82 valueType() function (which is QVariant::Int for the enum property
83 type).
84
85 \sa propertyType(), valueType()
86*/
87int
89{
90 return qMetaTypeId<QtEnumPropertyType>();
91}
92
93/*!
94 Returns the type id for a flag property.
95
96 Note that the property's value type can be retrieved using the
97 valueType() function (which is QVariant::Int for the flag property
98 type).
99
100 \sa propertyType(), valueType()
101*/
102int
104{
105 return qMetaTypeId<QtFlagPropertyType>();
106}
107
108/*!
109 Returns the type id for a group property.
110
111 Note that the property's value type can be retrieved using the
112 valueType() function (which is QVariant::Invalid for the group
113 property type, since it doesn't provide any value).
114
115 \sa propertyType(), valueType()
116*/
117int
119{
120 return qMetaTypeId<QtGroupPropertyType>();
121}
122
123/*!
124 Returns the type id for a icon map attribute.
125
126 Note that the property's attribute type can be retrieved using the
127 attributeType() function.
128
129 \sa attributeType(), QtEnumPropertyManager::enumIcons()
130*/
131int
133{
134 return qMetaTypeId<QtIconMap>();
135}
136
137using PropertyMap = QMap<const QtProperty*, QtProperty*>;
138Q_GLOBAL_STATIC(PropertyMap, propertyToWrappedProperty)
139
140static QtProperty*
141wrappedProperty(QtProperty* property)
142{
143 return propertyToWrappedProperty()->value(property, 0);
144}
145
157
158/*!
159 \class QtVariantProperty
160
161 \brief The QtVariantProperty class is a convenience class handling
162 QVariant based properties.
163
164 QtVariantProperty provides additional API: A property's type,
165 value type, attribute values and current value can easily be
166 retrieved using the propertyType(), valueType(), attributeValue()
167 and value() functions respectively. In addition, the attribute
168 values and the current value can be set using the corresponding
169 setValue() and setAttribute() functions.
170
171 For example, instead of writing:
172
173 \code
174 QtVariantPropertyManager *variantPropertyManager;
175 QtProperty *property;
176
177 variantPropertyManager->setValue(property, 10);
178 \endcode
179
180 you can write:
181
182 \code
183 QtVariantPropertyManager *variantPropertyManager;
184 QtVariantProperty *property;
185
186 property->setValue(10);
187 \endcode
188
189 QtVariantProperty instances can only be created by the
190 QtVariantPropertyManager class.
191
192 \sa QtProperty, QtVariantPropertyManager, QtVariantEditorFactory
193*/
194
195/*!
196 Creates a variant property using the given \a manager.
197
198 Do not use this constructor to create variant property instances;
199 use the QtVariantPropertyManager::addProperty() function
200 instead. This constructor is used internally by the
201 QtVariantPropertyManager::createProperty() function.
202
203 \sa QtVariantPropertyManager
204*/
209
210/*!
211 Destroys this property.
212
213 \sa QtProperty::~QtProperty()
214*/
216{
217 delete d_ptr;
218}
219
220/*!
221 Returns the property's current value.
222
223 \sa valueType(), setValue()
224*/
225QVariant
227{
228 return d_ptr->manager->value(this);
229}
230
231/*!
232 Returns this property's value for the specified \a attribute.
233
234 QtVariantPropertyManager provides a couple of related functions:
235 \l{QtVariantPropertyManager::attributes()}{attributes()} and
236 \l{QtVariantPropertyManager::attributeType()}{attributeType()}.
237
238 \sa setAttribute()
239*/
240QVariant
241QtVariantProperty::attributeValue(const QString& attribute) const
242{
243 return d_ptr->manager->attributeValue(this, attribute);
244}
245
246/*!
247 Returns the type of this property's value.
248
249 \sa propertyType()
250*/
251int
253{
254 return d_ptr->manager->valueType(this);
255}
256
257/*!
258 Returns this property's type.
259
260 QtVariantPropertyManager provides several related functions:
261 \l{QtVariantPropertyManager::enumTypeId()}{enumTypeId()},
262 \l{QtVariantPropertyManager::flagTypeId()}{flagTypeId()} and
263 \l{QtVariantPropertyManager::groupTypeId()}{groupTypeId()}.
264
265 \sa valueType()
266*/
267int
269{
270 return d_ptr->manager->propertyType(this);
271}
272
273/*!
274 Sets the value of this property to \a value.
275
276 The specified \a value must be of the type returned by
277 valueType(), or of a type that can be converted to valueType()
278 using the QVariant::canConvert() function; otherwise this function
279 does nothing.
280
281 \sa value()
282*/
283void
285{
286 d_ptr->manager->setValue(this, value);
287}
288
289/*!
290 Sets the \a attribute of property to \a value.
291
292 QtVariantPropertyManager provides the related
293 \l{QtVariantPropertyManager::setAttribute()}{setAttribute()}
294 function.
295
296 \sa attributeValue()
297*/
298void
299QtVariantProperty::setAttribute(const QString& attribute, const QVariant& value)
300{
301 d_ptr->manager->setAttribute(this, attribute, value);
302}
303
305{
307 Q_DECLARE_PUBLIC(QtVariantPropertyManager)
308public:
310
315
316 void slotValueChanged(QtProperty* property, int val);
317 void slotRangeChanged(QtProperty* property, int min, int max);
318 void slotSingleStepChanged(QtProperty* property, int step);
319 void slotValueChanged(QtProperty* property, double val);
320 void slotRangeChanged(QtProperty* property, double min, double max);
321 void slotSingleStepChanged(QtProperty* property, double step);
322 void slotDecimalsChanged(QtProperty* property, int prec);
323 void slotValueChanged(QtProperty* property, bool val);
324 void slotValueChanged(QtProperty* property, const QString& val);
325 void slotRegExpChanged(QtProperty* property, const QRegExp& regExp);
326 void slotEchoModeChanged(QtProperty* property, int);
327 void slotValueChanged(QtProperty* property, const QDate& val);
328 void slotRangeChanged(QtProperty* property, const QDate& min, const QDate& max);
329 void slotValueChanged(QtProperty* property, const QTime& val);
330 void slotValueChanged(QtProperty* property, const QDateTime& val);
331 void slotValueChanged(QtProperty* property, const QKeySequence& val);
332 void slotValueChanged(QtProperty* property, const QChar& val);
333 void slotValueChanged(QtProperty* property, const QLocale& val);
334 void slotValueChanged(QtProperty* property, const QPoint& val);
335 void slotValueChanged(QtProperty* property, const QPointF& val);
336 void slotValueChanged(QtProperty* property, const QSize& val);
337 void slotRangeChanged(QtProperty* property, const QSize& min, const QSize& max);
338 void slotValueChanged(QtProperty* property, const QSizeF& val);
339 void slotRangeChanged(QtProperty* property, const QSizeF& min, const QSizeF& max);
340 void slotValueChanged(QtProperty* property, const QRect& val);
341 void slotConstraintChanged(QtProperty* property, const QRect& val);
342 void slotValueChanged(QtProperty* property, const QRectF& val);
343 void slotConstraintChanged(QtProperty* property, const QRectF& val);
344 void slotValueChanged(QtProperty* property, const QColor& val);
345 void slotEnumChanged(QtProperty* property, int val);
346 void slotEnumNamesChanged(QtProperty* property, const QStringList& enumNames);
347 void slotEnumIconsChanged(QtProperty* property, const QMap<int, QIcon>& enumIcons);
348 void slotValueChanged(QtProperty* property, const QSizePolicy& val);
349 void slotValueChanged(QtProperty* property, const QFont& val);
350 void slotValueChanged(QtProperty* property, const QCursor& val);
351 void slotFlagChanged(QtProperty* property, int val);
352 void slotFlagNamesChanged(QtProperty* property, const QStringList& flagNames);
353 void slotReadOnlyChanged(QtProperty* property, bool readOnly);
354 void slotTextVisibleChanged(QtProperty* property, bool textVisible);
355 void slotPropertyInserted(QtProperty* property, QtProperty* parent, QtProperty* after);
356 void slotPropertyRemoved(QtProperty* property, QtProperty* parent);
357
358 void valueChanged(QtProperty* property, const QVariant& val);
359
360 int internalPropertyToType(QtProperty* property) const;
363 void removeSubProperty(QtVariantProperty* property);
364
365 QMap<int, QtAbstractPropertyManager*> m_typeToPropertyManager;
366 QMap<int, QMap<QString, int>> m_typeToAttributeToAttributeType;
367
368 QMap<const QtProperty*, QPair<QtVariantProperty*, int>> m_propertyToType;
369
370 QMap<int, int> m_typeToValueType;
371
372
373 QMap<QtProperty*, QtVariantProperty*> m_internalToProperty;
374
377 const QString m_decimalsAttribute;
378 const QString m_enumIconsAttribute;
379 const QString m_enumNamesAttribute;
380 const QString m_flagNamesAttribute;
381 const QString m_maximumAttribute;
382 const QString m_minimumAttribute;
383 const QString m_regExpAttribute;
384 const QString m_echoModeAttribute;
385 const QString m_readOnlyAttribute;
387};
388
390 m_constraintAttribute(QLatin1String("constraint")),
391 m_singleStepAttribute(QLatin1String("singleStep")),
392 m_decimalsAttribute(QLatin1String("decimals")),
393 m_enumIconsAttribute(QLatin1String("enumIcons")),
394 m_enumNamesAttribute(QLatin1String("enumNames")),
395 m_flagNamesAttribute(QLatin1String("flagNames")),
396 m_maximumAttribute(QLatin1String("maximum")),
397 m_minimumAttribute(QLatin1String("minimum")),
398 m_regExpAttribute(QLatin1String("regExp")),
399 m_echoModeAttribute(QLatin1String("echoMode")),
400 m_readOnlyAttribute(QLatin1String("readOnly")),
401 m_textVisibleAttribute(QLatin1String("textVisible"))
402{
403}
404
405int
407{
408 int type = 0;
409 QtAbstractPropertyManager* internPropertyManager = property->propertyManager();
410
411 if (qobject_cast<QtIntPropertyManager*>(internPropertyManager))
412 {
413 type = QVariant::Int;
414 }
415 else if (qobject_cast<QtEnumPropertyManager*>(internPropertyManager))
416 {
418 }
419 else if (qobject_cast<QtBoolPropertyManager*>(internPropertyManager))
420 {
421 type = QVariant::Bool;
422 }
423 else if (qobject_cast<QtDoublePropertyManager*>(internPropertyManager))
424 {
425 type = QVariant::Double;
426 }
427
428 return type;
429}
430
433 QtVariantProperty* after,
434 QtProperty* internal)
435{
436 int type = internalPropertyToType(internal);
437
438 if (!type)
439 {
440 return 0;
441 }
442
443 bool wasCreatingSubProperties = m_creatingSubProperties;
445
446 QtVariantProperty* varChild = q_ptr->addProperty(type, internal->propertyName());
447
448 m_creatingSubProperties = wasCreatingSubProperties;
449
450 varChild->setPropertyName(internal->propertyName());
451 varChild->setToolTip(internal->toolTip());
452 varChild->setStatusTip(internal->statusTip());
453 varChild->setWhatsThis(internal->whatsThis());
454
455 parent->insertSubProperty(varChild, after);
456
457 m_internalToProperty[internal] = varChild;
458 propertyToWrappedProperty()->insert(varChild, internal);
459 return varChild;
460}
461
462void
464{
465 QtProperty* internChild = wrappedProperty(property);
466 bool wasDestroyingSubProperties = m_destroyingSubProperties;
468 delete property;
469 m_destroyingSubProperties = wasDestroyingSubProperties;
470 m_internalToProperty.remove(internChild);
471 propertyToWrappedProperty()->remove(property);
472}
473
474void
476 QtProperty* parent,
477 QtProperty* after)
478{
480 {
481 return;
482 }
483
484 QtVariantProperty* varParent = m_internalToProperty.value(parent, 0);
485
486 if (!varParent)
487 {
488 return;
489 }
490
491 QtVariantProperty* varAfter = 0;
492
493 if (after)
494 {
495 varAfter = m_internalToProperty.value(after, 0);
496
497 if (!varAfter)
498 {
499 return;
500 }
501 }
502
503 createSubProperty(varParent, varAfter, property);
504}
505
506void
508{
509 Q_UNUSED(parent)
510
511 QtVariantProperty* varProperty = m_internalToProperty.value(property, 0);
512
513 if (!varProperty)
514 {
515 return;
516 }
517
518 removeSubProperty(varProperty);
519}
520
521void
523{
524 QtVariantProperty* varProp = m_internalToProperty.value(property, 0);
525
526 if (!varProp)
527 {
528 return;
529 }
530
531 emit q_ptr->valueChanged(varProp, val);
532 emit q_ptr->propertyChanged(varProp);
533}
534
535void
537{
538 valueChanged(property, QVariant(val));
539}
540
541void
543{
544 if (QtVariantProperty* varProp = m_internalToProperty.value(property, 0))
545 {
546 emit q_ptr->attributeChanged(varProp, m_minimumAttribute, QVariant(min));
547 emit q_ptr->attributeChanged(varProp, m_maximumAttribute, QVariant(max));
548 }
549}
550
551void
553{
554 if (QtVariantProperty* varProp = m_internalToProperty.value(property, 0))
555 {
556 emit q_ptr->attributeChanged(varProp, m_singleStepAttribute, QVariant(step));
557 }
558}
559
560void
562{
563 valueChanged(property, QVariant(val));
564}
565
566void
568{
569 if (QtVariantProperty* varProp = m_internalToProperty.value(property, 0))
570 {
571 emit q_ptr->attributeChanged(varProp, m_minimumAttribute, QVariant(min));
572 emit q_ptr->attributeChanged(varProp, m_maximumAttribute, QVariant(max));
573 }
574}
575
576void
578{
579 if (QtVariantProperty* varProp = m_internalToProperty.value(property, 0))
580 {
581 emit q_ptr->attributeChanged(varProp, m_singleStepAttribute, QVariant(step));
582 }
583}
584
585void
587{
588 if (QtVariantProperty* varProp = m_internalToProperty.value(property, 0))
589 {
590 emit q_ptr->attributeChanged(varProp, m_decimalsAttribute, QVariant(prec));
591 }
592}
593
594void
596{
597 valueChanged(property, QVariant(val));
598}
599
600void
602{
603 valueChanged(property, QVariant(val));
604}
605
606void
608{
609 if (QtVariantProperty* varProp = m_internalToProperty.value(property, 0))
610 {
611 emit q_ptr->attributeChanged(varProp, m_regExpAttribute, QVariant(regExp));
612 }
613}
614
615void
617{
618 if (QtVariantProperty* varProp = m_internalToProperty.value(property, 0))
619 {
620 emit q_ptr->attributeChanged(varProp, m_echoModeAttribute, QVariant(mode));
621 }
622}
623
624void
626{
627 if (QtVariantProperty* varProp = m_internalToProperty.value(property, 0))
628 {
629 emit q_ptr->attributeChanged(varProp, m_readOnlyAttribute, QVariant(readOnly));
630 }
631}
632
633void
635{
636 if (QtVariantProperty* varProp = m_internalToProperty.value(property, 0))
637 {
638 emit q_ptr->attributeChanged(varProp, m_textVisibleAttribute, QVariant(textVisible));
639 }
640}
641
642void
644{
645 valueChanged(property, QVariant(val));
646}
647
648void
650 const QDate& min,
651 const QDate& max)
652{
653 if (QtVariantProperty* varProp = m_internalToProperty.value(property, 0))
654 {
655 emit q_ptr->attributeChanged(varProp, m_minimumAttribute, QVariant(min));
656 emit q_ptr->attributeChanged(varProp, m_maximumAttribute, QVariant(max));
657 }
658}
659
660void
662{
663 valueChanged(property, QVariant(val));
664}
665
666void
668{
669 valueChanged(property, QVariant(val));
670}
671
672void
674{
675 QVariant v;
676 qVariantSetValue(v, val);
677 valueChanged(property, v);
678}
679
680void
682{
683 valueChanged(property, QVariant(val));
684}
685
686void
688{
689 valueChanged(property, QVariant(val));
690}
691
692void
694{
695 valueChanged(property, QVariant(val));
696}
697
698void
700{
701 valueChanged(property, QVariant(val));
702}
703
704void
706{
707 valueChanged(property, QVariant(val));
708}
709
710void
712 const QSize& min,
713 const QSize& max)
714{
715 if (QtVariantProperty* varProp = m_internalToProperty.value(property, 0))
716 {
717 emit q_ptr->attributeChanged(varProp, m_minimumAttribute, QVariant(min));
718 emit q_ptr->attributeChanged(varProp, m_maximumAttribute, QVariant(max));
719 }
720}
721
722void
724{
725 valueChanged(property, QVariant(val));
726}
727
728void
730 const QSizeF& min,
731 const QSizeF& max)
732{
733 if (QtVariantProperty* varProp = m_internalToProperty.value(property, 0))
734 {
735 emit q_ptr->attributeChanged(varProp, m_minimumAttribute, QVariant(min));
736 emit q_ptr->attributeChanged(varProp, m_maximumAttribute, QVariant(max));
737 }
738}
739
740void
742{
743 valueChanged(property, QVariant(val));
744}
745
746void
748 const QRect& constraint)
749{
750 if (QtVariantProperty* varProp = m_internalToProperty.value(property, 0))
751 {
752 emit q_ptr->attributeChanged(varProp, m_constraintAttribute, QVariant(constraint));
753 }
754}
755
756void
758{
759 valueChanged(property, QVariant(val));
760}
761
762void
764 const QRectF& constraint)
765{
766 if (QtVariantProperty* varProp = m_internalToProperty.value(property, 0))
767 {
768 emit q_ptr->attributeChanged(varProp, m_constraintAttribute, QVariant(constraint));
769 }
770}
771
772void
774{
775 valueChanged(property, QVariant(val));
776}
777
778void
780 const QStringList& enumNames)
781{
782 if (QtVariantProperty* varProp = m_internalToProperty.value(property, 0))
783 {
784 emit q_ptr->attributeChanged(varProp, m_enumNamesAttribute, QVariant(enumNames));
785 }
786}
787
788void
790 const QMap<int, QIcon>& enumIcons)
791{
792 if (QtVariantProperty* varProp = m_internalToProperty.value(property, 0))
793 {
794 QVariant v;
795 qVariantSetValue(v, enumIcons);
796 emit q_ptr->attributeChanged(varProp, m_enumIconsAttribute, v);
797 }
798}
799
800void
802{
803 valueChanged(property, QVariant(val));
804}
805
806void
808{
809 valueChanged(property, QVariant(val));
810}
811
812void
814{
815#ifndef QT_NO_CURSOR
816 valueChanged(property, QVariant(val));
817#endif
818}
819
820void
822 const QStringList& flagNames)
823{
824 if (QtVariantProperty* varProp = m_internalToProperty.value(property, 0))
825 {
826 emit q_ptr->attributeChanged(varProp, m_flagNamesAttribute, QVariant(flagNames));
827 }
828}
829
830/*!
831 \class QtVariantPropertyManager
832
833 \brief The QtVariantPropertyManager class provides and manages QVariant based properties.
834
835 QtVariantPropertyManager provides the addProperty() function which
836 creates QtVariantProperty objects. The QtVariantProperty class is
837 a convenience class handling QVariant based properties inheriting
838 QtProperty. A QtProperty object created by a
839 QtVariantPropertyManager instance can be converted into a
840 QtVariantProperty object using the variantProperty() function.
841
842 The property's value can be retrieved using the value(), and set
843 using the setValue() slot. In addition the property's type, and
844 the type of its value, can be retrieved using the propertyType()
845 and valueType() functions respectively.
846
847 A property's type is a QVariant::Type enumerator value, and
848 usually a property's type is the same as its value type. But for
849 some properties the types differ, for example for enums, flags and
850 group types in which case QtVariantPropertyManager provides the
851 enumTypeId(), flagTypeId() and groupTypeId() functions,
852 respectively, to identify their property type (the value types are
853 QVariant::Int for the enum and flag types, and QVariant::Invalid
854 for the group type).
855
856 Use the isPropertyTypeSupported() function to check if a particular
857 property type is supported. The currently supported property types
858 are:
859
860 \table
861 \header
862 \o Property Type
863 \o Property Type Id
864 \row
865 \o int
866 \o QVariant::Int
867 \row
868 \o double
869 \o QVariant::Double
870 \row
871 \o bool
872 \o QVariant::Bool
873 \row
874 \o QString
875 \o QVariant::String
876 \row
877 \o QDate
878 \o QVariant::Date
879 \row
880 \o QTime
881 \o QVariant::Time
882 \row
883 \o QDateTime
884 \o QVariant::DateTime
885 \row
886 \o QKeySequence
887 \o QVariant::KeySequence
888 \row
889 \o QChar
890 \o QVariant::Char
891 \row
892 \o QLocale
893 \o QVariant::Locale
894 \row
895 \o QPoint
896 \o QVariant::Point
897 \row
898 \o QPointF
899 \o QVariant::PointF
900 \row
901 \o QSize
902 \o QVariant::Size
903 \row
904 \o QSizeF
905 \o QVariant::SizeF
906 \row
907 \o QRect
908 \o QVariant::Rect
909 \row
910 \o QRectF
911 \o QVariant::RectF
912 \row
913 \o QColor
914 \o QVariant::Color
915 \row
916 \o QSizePolicy
917 \o QVariant::SizePolicy
918 \row
919 \o QFont
920 \o QVariant::Font
921 \row
922 \o QCursor
923 \o QVariant::Cursor
924 \row
925 \o enum
926 \o enumTypeId()
927 \row
928 \o flag
929 \o flagTypeId()
930 \row
931 \o group
932 \o groupTypeId()
933 \endtable
934
935 Each property type can provide additional attributes,
936 e.g. QVariant::Int and QVariant::Double provides minimum and
937 maximum values. The currently supported attributes are:
938
939 \table
940 \header
941 \o Property Type
942 \o Attribute Name
943 \o Attribute Type
944 \row
945 \o \c int
946 \o minimum
947 \o QVariant::Int
948 \row
949 \o
950 \o maximum
951 \o QVariant::Int
952 \row
953 \o
954 \o singleStep
955 \o QVariant::Int
956 \row
957 \o \c double
958 \o minimum
959 \o QVariant::Double
960 \row
961 \o
962 \o maximum
963 \o QVariant::Double
964 \row
965 \o
966 \o singleStep
967 \o QVariant::Double
968 \row
969 \o
970 \o decimals
971 \o QVariant::Int
972 \row
973 \o \c bool
974 \o textVisible
975 \o QVariant::Bool
976 \row
977 \o QString
978 \o regExp
979 \o QVariant::RegExp
980 \row
981 \o
982 \o echoMode
983 \o QVariant::Int
984 \row
985 \o QDate
986 \o minimum
987 \o QVariant::Date
988 \row
989 \o
990 \o maximum
991 \o QVariant::Date
992 \row
993 \o QPointF
994 \o decimals
995 \o QVariant::Int
996 \row
997 \o QSize
998 \o minimum
999 \o QVariant::Size
1000 \row
1001 \o
1002 \o maximum
1003 \o QVariant::Size
1004 \row
1005 \o QSizeF
1006 \o minimum
1007 \o QVariant::SizeF
1008 \row
1009 \o
1010 \o maximum
1011 \o QVariant::SizeF
1012 \row
1013 \o
1014 \o decimals
1015 \o QVariant::Int
1016 \row
1017 \o QRect
1018 \o constraint
1019 \o QVariant::Rect
1020 \row
1021 \o QRectF
1022 \o constraint
1023 \o QVariant::RectF
1024 \row
1025 \o
1026 \o decimals
1027 \o QVariant::Int
1028 \row
1029 \o \c enum
1030 \o enumNames
1031 \o QVariant::StringList
1032 \row
1033 \o
1034 \o enumIcons
1035 \o iconMapTypeId()
1036 \row
1037 \o \c flag
1038 \o flagNames
1039 \o QVariant::StringList
1040 \endtable
1041
1042 The attributes for a given property type can be retrieved using
1043 the attributes() function. Each attribute has a value type which
1044 can be retrieved using the attributeType() function, and a value
1045 accessible through the attributeValue() function. In addition, the
1046 value can be set using the setAttribute() slot.
1047
1048 QtVariantManager also provides the valueChanged() signal which is
1049 emitted whenever a property created by this manager change, and
1050 the attributeChanged() signal which is emitted whenever an
1051 attribute of such a property changes.
1052
1053 \sa QtVariantProperty, QtVariantEditorFactory
1054*/
1055
1056/*!
1057 \fn void QtVariantPropertyManager::valueChanged(QtProperty *property, const QVariant &value)
1058
1059 This signal is emitted whenever a property created by this manager
1060 changes its value, passing a pointer to the \a property and the
1061 new \a value as parameters.
1062
1063 \sa setValue()
1064*/
1065
1066/*!
1067 \fn void QtVariantPropertyManager::attributeChanged(QtProperty *property,
1068 const QString &attribute, const QVariant &value)
1069
1070 This signal is emitted whenever an attribute of a property created
1071 by this manager changes its value, passing a pointer to the \a
1072 property, the \a attribute and the new \a value as parameters.
1073
1074 \sa setAttribute()
1075*/
1076
1077/*!
1078 Creates a manager with the given \a parent.
1079*/
1082{
1084 d_ptr->q_ptr = this;
1085
1086 d_ptr->m_creatingProperty = false;
1087 d_ptr->m_creatingSubProperties = false;
1088 d_ptr->m_destroyingSubProperties = false;
1089 d_ptr->m_propertyType = 0;
1090
1091 // IntPropertyManager
1092 QtIntPropertyManager* intPropertyManager = new QtIntPropertyManager(this);
1093 d_ptr->m_typeToPropertyManager[QVariant::Int] = intPropertyManager;
1094 d_ptr->m_typeToAttributeToAttributeType[QVariant::Int][d_ptr->m_minimumAttribute] =
1095 QVariant::Int;
1096 d_ptr->m_typeToAttributeToAttributeType[QVariant::Int][d_ptr->m_maximumAttribute] =
1097 QVariant::Int;
1098 d_ptr->m_typeToAttributeToAttributeType[QVariant::Int][d_ptr->m_singleStepAttribute] =
1099 QVariant::Int;
1100 d_ptr->m_typeToAttributeToAttributeType[QVariant::Int][d_ptr->m_readOnlyAttribute] =
1101 QVariant::Bool;
1102 d_ptr->m_typeToValueType[QVariant::Int] = QVariant::Int;
1103 connect(intPropertyManager,
1104 SIGNAL(valueChanged(QtProperty*, int)),
1105 this,
1106 SLOT(slotValueChanged(QtProperty*, int)));
1107 connect(intPropertyManager,
1108 SIGNAL(rangeChanged(QtProperty*, int, int)),
1109 this,
1110 SLOT(slotRangeChanged(QtProperty*, int, int)));
1111 connect(intPropertyManager,
1112 SIGNAL(singleStepChanged(QtProperty*, int)),
1113 this,
1114 SLOT(slotSingleStepChanged(QtProperty*, int)));
1115 // DoublePropertyManager
1116 QtDoublePropertyManager* doublePropertyManager = new QtDoublePropertyManager(this);
1117 d_ptr->m_typeToPropertyManager[QVariant::Double] = doublePropertyManager;
1118 d_ptr->m_typeToAttributeToAttributeType[QVariant::Double][d_ptr->m_minimumAttribute] =
1119 QVariant::Double;
1120 d_ptr->m_typeToAttributeToAttributeType[QVariant::Double][d_ptr->m_maximumAttribute] =
1121 QVariant::Double;
1122 d_ptr->m_typeToAttributeToAttributeType[QVariant::Double][d_ptr->m_singleStepAttribute] =
1123 QVariant::Double;
1124 d_ptr->m_typeToAttributeToAttributeType[QVariant::Double][d_ptr->m_decimalsAttribute] =
1125 QVariant::Int;
1126 d_ptr->m_typeToAttributeToAttributeType[QVariant::Double][d_ptr->m_readOnlyAttribute] =
1127 QVariant::Bool;
1128 d_ptr->m_typeToValueType[QVariant::Double] = QVariant::Double;
1129 connect(doublePropertyManager,
1130 SIGNAL(valueChanged(QtProperty*, double)),
1131 this,
1132 SLOT(slotValueChanged(QtProperty*, double)));
1133 connect(doublePropertyManager,
1134 SIGNAL(rangeChanged(QtProperty*, double, double)),
1135 this,
1136 SLOT(slotRangeChanged(QtProperty*, double, double)));
1137 connect(doublePropertyManager,
1138 SIGNAL(singleStepChanged(QtProperty*, double)),
1139 this,
1140 SLOT(slotSingleStepChanged(QtProperty*, double)));
1141 connect(doublePropertyManager,
1142 SIGNAL(decimalsChanged(QtProperty*, int)),
1143 this,
1144 SLOT(slotDecimalsChanged(QtProperty*, int)));
1145 // BoolPropertyManager
1146 QtBoolPropertyManager* boolPropertyManager = new QtBoolPropertyManager(this);
1147 d_ptr->m_typeToPropertyManager[QVariant::Bool] = boolPropertyManager;
1148 d_ptr->m_typeToAttributeToAttributeType[QVariant::Bool][d_ptr->m_textVisibleAttribute] =
1149 QVariant::Bool;
1150 d_ptr->m_typeToValueType[QVariant::Bool] = QVariant::Bool;
1151 connect(boolPropertyManager,
1152 SIGNAL(valueChanged(QtProperty*, bool)),
1153 this,
1154 SLOT(slotValueChanged(QtProperty*, bool)));
1155 connect(boolPropertyManager,
1156 SIGNAL(textVisibleChanged(QtProperty*, bool)),
1157 this,
1158 SLOT(slotTextVisibleChanged(QtProperty*, bool)));
1159 // StringPropertyManager
1160 QtStringPropertyManager* stringPropertyManager = new QtStringPropertyManager(this);
1161 d_ptr->m_typeToPropertyManager[QVariant::String] = stringPropertyManager;
1162 d_ptr->m_typeToValueType[QVariant::String] = QVariant::String;
1163 d_ptr->m_typeToAttributeToAttributeType[QVariant::String][d_ptr->m_regExpAttribute] =
1164 QVariant::RegExp;
1165 d_ptr->m_typeToAttributeToAttributeType[QVariant::String][d_ptr->m_echoModeAttribute] =
1166 QVariant::Int;
1167 d_ptr->m_typeToAttributeToAttributeType[QVariant::String][d_ptr->m_readOnlyAttribute] =
1168 QVariant::Bool;
1169
1170 connect(stringPropertyManager,
1171 SIGNAL(valueChanged(QtProperty*, const QString&)),
1172 this,
1173 SLOT(slotValueChanged(QtProperty*, const QString&)));
1174 connect(stringPropertyManager,
1175 SIGNAL(regExpChanged(QtProperty*, const QRegExp&)),
1176 this,
1177 SLOT(slotRegExpChanged(QtProperty*, const QRegExp&)));
1178 connect(stringPropertyManager,
1179 SIGNAL(echoModeChanged(QtProperty*, int)),
1180 this,
1181 SLOT(slotEchoModeChanged(QtProperty*, int)));
1182 connect(stringPropertyManager,
1183 SIGNAL(readOnlyChanged(QtProperty*, bool)),
1184 this,
1185 SLOT(slotReadOnlyChanged(QtProperty*, bool)));
1186
1187 // DatePropertyManager
1188 QtDatePropertyManager* datePropertyManager = new QtDatePropertyManager(this);
1189 d_ptr->m_typeToPropertyManager[QVariant::Date] = datePropertyManager;
1190 d_ptr->m_typeToValueType[QVariant::Date] = QVariant::Date;
1191 d_ptr->m_typeToAttributeToAttributeType[QVariant::Date][d_ptr->m_minimumAttribute] =
1192 QVariant::Date;
1193 d_ptr->m_typeToAttributeToAttributeType[QVariant::Date][d_ptr->m_maximumAttribute] =
1194 QVariant::Date;
1195 connect(datePropertyManager,
1196 SIGNAL(valueChanged(QtProperty*, const QDate&)),
1197 this,
1198 SLOT(slotValueChanged(QtProperty*, const QDate&)));
1199 connect(datePropertyManager,
1200 SIGNAL(rangeChanged(QtProperty*, const QDate&, const QDate&)),
1201 this,
1202 SLOT(slotRangeChanged(QtProperty*, const QDate&, const QDate&)));
1203 // TimePropertyManager
1204 QtTimePropertyManager* timePropertyManager = new QtTimePropertyManager(this);
1205 d_ptr->m_typeToPropertyManager[QVariant::Time] = timePropertyManager;
1206 d_ptr->m_typeToValueType[QVariant::Time] = QVariant::Time;
1207 connect(timePropertyManager,
1208 SIGNAL(valueChanged(QtProperty*, const QTime&)),
1209 this,
1210 SLOT(slotValueChanged(QtProperty*, const QTime&)));
1211 // DateTimePropertyManager
1212 QtDateTimePropertyManager* dateTimePropertyManager = new QtDateTimePropertyManager(this);
1213 d_ptr->m_typeToPropertyManager[QVariant::DateTime] = dateTimePropertyManager;
1214 d_ptr->m_typeToValueType[QVariant::DateTime] = QVariant::DateTime;
1215 connect(dateTimePropertyManager,
1216 SIGNAL(valueChanged(QtProperty*, const QDateTime&)),
1217 this,
1218 SLOT(slotValueChanged(QtProperty*, const QDateTime&)));
1219 // KeySequencePropertyManager
1220 QtKeySequencePropertyManager* keySequencePropertyManager =
1222 d_ptr->m_typeToPropertyManager[QVariant::KeySequence] = keySequencePropertyManager;
1223 d_ptr->m_typeToValueType[QVariant::KeySequence] = QVariant::KeySequence;
1224 connect(keySequencePropertyManager,
1225 SIGNAL(valueChanged(QtProperty*, const QKeySequence&)),
1226 this,
1227 SLOT(slotValueChanged(QtProperty*, const QKeySequence&)));
1228 // CharPropertyManager
1229 QtCharPropertyManager* charPropertyManager = new QtCharPropertyManager(this);
1230 d_ptr->m_typeToPropertyManager[QVariant::Char] = charPropertyManager;
1231 d_ptr->m_typeToValueType[QVariant::Char] = QVariant::Char;
1232 connect(charPropertyManager,
1233 SIGNAL(valueChanged(QtProperty*, const QChar&)),
1234 this,
1235 SLOT(slotValueChanged(QtProperty*, const QChar&)));
1236 // LocalePropertyManager
1237 QtLocalePropertyManager* localePropertyManager = new QtLocalePropertyManager(this);
1238 d_ptr->m_typeToPropertyManager[QVariant::Locale] = localePropertyManager;
1239 d_ptr->m_typeToValueType[QVariant::Locale] = QVariant::Locale;
1240 connect(localePropertyManager,
1241 SIGNAL(valueChanged(QtProperty*, const QLocale&)),
1242 this,
1243 SLOT(slotValueChanged(QtProperty*, const QLocale&)));
1244 connect(localePropertyManager->subEnumPropertyManager(),
1245 SIGNAL(valueChanged(QtProperty*, int)),
1246 this,
1247 SLOT(slotValueChanged(QtProperty*, int)));
1248 connect(localePropertyManager,
1250 this,
1251 SLOT(slotPropertyInserted(QtProperty*, QtProperty*, QtProperty*)));
1252 connect(localePropertyManager,
1254 this,
1255 SLOT(slotPropertyRemoved(QtProperty*, QtProperty*)));
1256 // PointPropertyManager
1257 QtPointPropertyManager* pointPropertyManager = new QtPointPropertyManager(this);
1258 d_ptr->m_typeToPropertyManager[QVariant::Point] = pointPropertyManager;
1259 d_ptr->m_typeToValueType[QVariant::Point] = QVariant::Point;
1260 connect(pointPropertyManager,
1261 SIGNAL(valueChanged(QtProperty*, const QPoint&)),
1262 this,
1263 SLOT(slotValueChanged(QtProperty*, const QPoint&)));
1264 connect(pointPropertyManager->subIntPropertyManager(),
1265 SIGNAL(valueChanged(QtProperty*, int)),
1266 this,
1267 SLOT(slotValueChanged(QtProperty*, int)));
1268 connect(pointPropertyManager,
1270 this,
1271 SLOT(slotPropertyInserted(QtProperty*, QtProperty*, QtProperty*)));
1272 connect(pointPropertyManager,
1274 this,
1275 SLOT(slotPropertyRemoved(QtProperty*, QtProperty*)));
1276 // PointFPropertyManager
1277 QtPointFPropertyManager* pointFPropertyManager = new QtPointFPropertyManager(this);
1278 d_ptr->m_typeToPropertyManager[QVariant::PointF] = pointFPropertyManager;
1279 d_ptr->m_typeToValueType[QVariant::PointF] = QVariant::PointF;
1280 d_ptr->m_typeToAttributeToAttributeType[QVariant::PointF][d_ptr->m_decimalsAttribute] =
1281 QVariant::Int;
1282 connect(pointFPropertyManager,
1283 SIGNAL(valueChanged(QtProperty*, const QPointF&)),
1284 this,
1285 SLOT(slotValueChanged(QtProperty*, const QPointF&)));
1286 connect(pointFPropertyManager,
1287 SIGNAL(decimalsChanged(QtProperty*, int)),
1288 this,
1289 SLOT(slotDecimalsChanged(QtProperty*, int)));
1290 connect(pointFPropertyManager->subDoublePropertyManager(),
1291 SIGNAL(valueChanged(QtProperty*, double)),
1292 this,
1293 SLOT(slotValueChanged(QtProperty*, double)));
1294 connect(pointFPropertyManager,
1296 this,
1297 SLOT(slotPropertyInserted(QtProperty*, QtProperty*, QtProperty*)));
1298 connect(pointFPropertyManager,
1300 this,
1301 SLOT(slotPropertyRemoved(QtProperty*, QtProperty*)));
1302 // SizePropertyManager
1303 QtSizePropertyManager* sizePropertyManager = new QtSizePropertyManager(this);
1304 d_ptr->m_typeToPropertyManager[QVariant::Size] = sizePropertyManager;
1305 d_ptr->m_typeToValueType[QVariant::Size] = QVariant::Size;
1306 d_ptr->m_typeToAttributeToAttributeType[QVariant::Size][d_ptr->m_minimumAttribute] =
1307 QVariant::Size;
1308 d_ptr->m_typeToAttributeToAttributeType[QVariant::Size][d_ptr->m_maximumAttribute] =
1309 QVariant::Size;
1310 connect(sizePropertyManager,
1311 SIGNAL(valueChanged(QtProperty*, const QSize&)),
1312 this,
1313 SLOT(slotValueChanged(QtProperty*, const QSize&)));
1314 connect(sizePropertyManager,
1315 SIGNAL(rangeChanged(QtProperty*, const QSize&, const QSize&)),
1316 this,
1317 SLOT(slotRangeChanged(QtProperty*, const QSize&, const QSize&)));
1318 connect(sizePropertyManager->subIntPropertyManager(),
1319 SIGNAL(valueChanged(QtProperty*, int)),
1320 this,
1321 SLOT(slotValueChanged(QtProperty*, int)));
1322 connect(sizePropertyManager->subIntPropertyManager(),
1323 SIGNAL(rangeChanged(QtProperty*, int, int)),
1324 this,
1325 SLOT(slotRangeChanged(QtProperty*, int, int)));
1326 connect(sizePropertyManager,
1328 this,
1329 SLOT(slotPropertyInserted(QtProperty*, QtProperty*, QtProperty*)));
1330 connect(sizePropertyManager,
1332 this,
1333 SLOT(slotPropertyRemoved(QtProperty*, QtProperty*)));
1334 // SizeFPropertyManager
1335 QtSizeFPropertyManager* sizeFPropertyManager = new QtSizeFPropertyManager(this);
1336 d_ptr->m_typeToPropertyManager[QVariant::SizeF] = sizeFPropertyManager;
1337 d_ptr->m_typeToValueType[QVariant::SizeF] = QVariant::SizeF;
1338 d_ptr->m_typeToAttributeToAttributeType[QVariant::SizeF][d_ptr->m_minimumAttribute] =
1339 QVariant::SizeF;
1340 d_ptr->m_typeToAttributeToAttributeType[QVariant::SizeF][d_ptr->m_maximumAttribute] =
1341 QVariant::SizeF;
1342 d_ptr->m_typeToAttributeToAttributeType[QVariant::SizeF][d_ptr->m_decimalsAttribute] =
1343 QVariant::Int;
1344 connect(sizeFPropertyManager,
1345 SIGNAL(valueChanged(QtProperty*, const QSizeF&)),
1346 this,
1347 SLOT(slotValueChanged(QtProperty*, const QSizeF&)));
1348 connect(sizeFPropertyManager,
1349 SIGNAL(rangeChanged(QtProperty*, const QSizeF&, const QSizeF&)),
1350 this,
1351 SLOT(slotRangeChanged(QtProperty*, const QSizeF&, const QSizeF&)));
1352 connect(sizeFPropertyManager,
1353 SIGNAL(decimalsChanged(QtProperty*, int)),
1354 this,
1355 SLOT(slotDecimalsChanged(QtProperty*, int)));
1356 connect(sizeFPropertyManager->subDoublePropertyManager(),
1357 SIGNAL(valueChanged(QtProperty*, double)),
1358 this,
1359 SLOT(slotValueChanged(QtProperty*, double)));
1360 connect(sizeFPropertyManager->subDoublePropertyManager(),
1361 SIGNAL(rangeChanged(QtProperty*, double, double)),
1362 this,
1363 SLOT(slotRangeChanged(QtProperty*, double, double)));
1364 connect(sizeFPropertyManager,
1366 this,
1367 SLOT(slotPropertyInserted(QtProperty*, QtProperty*, QtProperty*)));
1368 connect(sizeFPropertyManager,
1370 this,
1371 SLOT(slotPropertyRemoved(QtProperty*, QtProperty*)));
1372 // RectPropertyManager
1373 QtRectPropertyManager* rectPropertyManager = new QtRectPropertyManager(this);
1374 d_ptr->m_typeToPropertyManager[QVariant::Rect] = rectPropertyManager;
1375 d_ptr->m_typeToValueType[QVariant::Rect] = QVariant::Rect;
1376 d_ptr->m_typeToAttributeToAttributeType[QVariant::Rect][d_ptr->m_constraintAttribute] =
1377 QVariant::Rect;
1378 connect(rectPropertyManager,
1379 SIGNAL(valueChanged(QtProperty*, const QRect&)),
1380 this,
1381 SLOT(slotValueChanged(QtProperty*, const QRect&)));
1382 connect(rectPropertyManager,
1383 SIGNAL(constraintChanged(QtProperty*, const QRect&)),
1384 this,
1385 SLOT(slotConstraintChanged(QtProperty*, const QRect&)));
1386 connect(rectPropertyManager->subIntPropertyManager(),
1387 SIGNAL(valueChanged(QtProperty*, int)),
1388 this,
1389 SLOT(slotValueChanged(QtProperty*, int)));
1390 connect(rectPropertyManager->subIntPropertyManager(),
1391 SIGNAL(rangeChanged(QtProperty*, int, int)),
1392 this,
1393 SLOT(slotRangeChanged(QtProperty*, int, int)));
1394 connect(rectPropertyManager,
1396 this,
1397 SLOT(slotPropertyInserted(QtProperty*, QtProperty*, QtProperty*)));
1398 connect(rectPropertyManager,
1400 this,
1401 SLOT(slotPropertyRemoved(QtProperty*, QtProperty*)));
1402 // RectFPropertyManager
1403 QtRectFPropertyManager* rectFPropertyManager = new QtRectFPropertyManager(this);
1404 d_ptr->m_typeToPropertyManager[QVariant::RectF] = rectFPropertyManager;
1405 d_ptr->m_typeToValueType[QVariant::RectF] = QVariant::RectF;
1406 d_ptr->m_typeToAttributeToAttributeType[QVariant::RectF][d_ptr->m_constraintAttribute] =
1407 QVariant::RectF;
1408 d_ptr->m_typeToAttributeToAttributeType[QVariant::RectF][d_ptr->m_decimalsAttribute] =
1409 QVariant::Int;
1410 connect(rectFPropertyManager,
1411 SIGNAL(valueChanged(QtProperty*, const QRectF&)),
1412 this,
1413 SLOT(slotValueChanged(QtProperty*, const QRectF&)));
1414 connect(rectFPropertyManager,
1415 SIGNAL(constraintChanged(QtProperty*, const QRectF&)),
1416 this,
1417 SLOT(slotConstraintChanged(QtProperty*, const QRectF&)));
1418 connect(rectFPropertyManager,
1419 SIGNAL(decimalsChanged(QtProperty*, int)),
1420 this,
1421 SLOT(slotDecimalsChanged(QtProperty*, int)));
1422 connect(rectFPropertyManager->subDoublePropertyManager(),
1423 SIGNAL(valueChanged(QtProperty*, double)),
1424 this,
1425 SLOT(slotValueChanged(QtProperty*, double)));
1426 connect(rectFPropertyManager->subDoublePropertyManager(),
1427 SIGNAL(rangeChanged(QtProperty*, double, double)),
1428 this,
1429 SLOT(slotRangeChanged(QtProperty*, double, double)));
1430 connect(rectFPropertyManager,
1432 this,
1433 SLOT(slotPropertyInserted(QtProperty*, QtProperty*, QtProperty*)));
1434 connect(rectFPropertyManager,
1436 this,
1437 SLOT(slotPropertyRemoved(QtProperty*, QtProperty*)));
1438 // ColorPropertyManager
1439 QtColorPropertyManager* colorPropertyManager = new QtColorPropertyManager(this);
1440 d_ptr->m_typeToPropertyManager[QVariant::Color] = colorPropertyManager;
1441 d_ptr->m_typeToValueType[QVariant::Color] = QVariant::Color;
1442 connect(colorPropertyManager,
1443 SIGNAL(valueChanged(QtProperty*, const QColor&)),
1444 this,
1445 SLOT(slotValueChanged(QtProperty*, const QColor&)));
1446 connect(colorPropertyManager->subIntPropertyManager(),
1447 SIGNAL(valueChanged(QtProperty*, int)),
1448 this,
1449 SLOT(slotValueChanged(QtProperty*, int)));
1450 connect(colorPropertyManager,
1452 this,
1453 SLOT(slotPropertyInserted(QtProperty*, QtProperty*, QtProperty*)));
1454 connect(colorPropertyManager,
1456 this,
1457 SLOT(slotPropertyRemoved(QtProperty*, QtProperty*)));
1458 // EnumPropertyManager
1459 int enumId = enumTypeId();
1460 QtEnumPropertyManager* enumPropertyManager = new QtEnumPropertyManager(this);
1461 d_ptr->m_typeToPropertyManager[enumId] = enumPropertyManager;
1462 d_ptr->m_typeToValueType[enumId] = QVariant::Int;
1463 d_ptr->m_typeToAttributeToAttributeType[enumId][d_ptr->m_enumNamesAttribute] =
1464 QVariant::StringList;
1465 d_ptr->m_typeToAttributeToAttributeType[enumId][d_ptr->m_enumIconsAttribute] = iconMapTypeId();
1466 connect(enumPropertyManager,
1467 SIGNAL(valueChanged(QtProperty*, int)),
1468 this,
1469 SLOT(slotValueChanged(QtProperty*, int)));
1470 connect(enumPropertyManager,
1471 SIGNAL(enumNamesChanged(QtProperty*, const QStringList&)),
1472 this,
1473 SLOT(slotEnumNamesChanged(QtProperty*, const QStringList&)));
1474 connect(enumPropertyManager,
1475 SIGNAL(enumIconsChanged(QtProperty*, const QMap<int, QIcon>&)),
1476 this,
1477 SLOT(slotEnumIconsChanged(QtProperty*, const QMap<int, QIcon>&)));
1478 // SizePolicyPropertyManager
1479 QtSizePolicyPropertyManager* sizePolicyPropertyManager = new QtSizePolicyPropertyManager(this);
1480 d_ptr->m_typeToPropertyManager[QVariant::SizePolicy] = sizePolicyPropertyManager;
1481 d_ptr->m_typeToValueType[QVariant::SizePolicy] = QVariant::SizePolicy;
1482 connect(sizePolicyPropertyManager,
1483 SIGNAL(valueChanged(QtProperty*, const QSizePolicy&)),
1484 this,
1485 SLOT(slotValueChanged(QtProperty*, const QSizePolicy&)));
1486 connect(sizePolicyPropertyManager->subIntPropertyManager(),
1487 SIGNAL(valueChanged(QtProperty*, int)),
1488 this,
1489 SLOT(slotValueChanged(QtProperty*, int)));
1490 connect(sizePolicyPropertyManager->subIntPropertyManager(),
1491 SIGNAL(rangeChanged(QtProperty*, int, int)),
1492 this,
1493 SLOT(slotRangeChanged(QtProperty*, int, int)));
1494 connect(sizePolicyPropertyManager->subEnumPropertyManager(),
1495 SIGNAL(valueChanged(QtProperty*, int)),
1496 this,
1497 SLOT(slotValueChanged(QtProperty*, int)));
1498 connect(sizePolicyPropertyManager->subEnumPropertyManager(),
1499 SIGNAL(enumNamesChanged(QtProperty*, const QStringList&)),
1500 this,
1501 SLOT(slotEnumNamesChanged(QtProperty*, const QStringList&)));
1502 connect(sizePolicyPropertyManager,
1504 this,
1505 SLOT(slotPropertyInserted(QtProperty*, QtProperty*, QtProperty*)));
1506 connect(sizePolicyPropertyManager,
1508 this,
1509 SLOT(slotPropertyRemoved(QtProperty*, QtProperty*)));
1510 // FontPropertyManager
1511 QtFontPropertyManager* fontPropertyManager = new QtFontPropertyManager(this);
1512 d_ptr->m_typeToPropertyManager[QVariant::Font] = fontPropertyManager;
1513 d_ptr->m_typeToValueType[QVariant::Font] = QVariant::Font;
1514 connect(fontPropertyManager,
1515 SIGNAL(valueChanged(QtProperty*, const QFont&)),
1516 this,
1517 SLOT(slotValueChanged(QtProperty*, const QFont&)));
1518 connect(fontPropertyManager->subIntPropertyManager(),
1519 SIGNAL(valueChanged(QtProperty*, int)),
1520 this,
1521 SLOT(slotValueChanged(QtProperty*, int)));
1522 connect(fontPropertyManager->subIntPropertyManager(),
1523 SIGNAL(rangeChanged(QtProperty*, int, int)),
1524 this,
1525 SLOT(slotRangeChanged(QtProperty*, int, int)));
1526 connect(fontPropertyManager->subEnumPropertyManager(),
1527 SIGNAL(valueChanged(QtProperty*, int)),
1528 this,
1529 SLOT(slotValueChanged(QtProperty*, int)));
1530 connect(fontPropertyManager->subEnumPropertyManager(),
1531 SIGNAL(enumNamesChanged(QtProperty*, const QStringList&)),
1532 this,
1533 SLOT(slotEnumNamesChanged(QtProperty*, const QStringList&)));
1534 connect(fontPropertyManager->subBoolPropertyManager(),
1535 SIGNAL(valueChanged(QtProperty*, bool)),
1536 this,
1537 SLOT(slotValueChanged(QtProperty*, bool)));
1538 connect(fontPropertyManager,
1540 this,
1541 SLOT(slotPropertyInserted(QtProperty*, QtProperty*, QtProperty*)));
1542 connect(fontPropertyManager,
1544 this,
1545 SLOT(slotPropertyRemoved(QtProperty*, QtProperty*)));
1546 // CursorPropertyManager
1547 QtCursorPropertyManager* cursorPropertyManager = new QtCursorPropertyManager(this);
1548 d_ptr->m_typeToPropertyManager[QVariant::Cursor] = cursorPropertyManager;
1549 d_ptr->m_typeToValueType[QVariant::Cursor] = QVariant::Cursor;
1550 connect(cursorPropertyManager,
1551 SIGNAL(valueChanged(QtProperty*, const QCursor&)),
1552 this,
1553 SLOT(slotValueChanged(QtProperty*, const QCursor&)));
1554 // FlagPropertyManager
1555 int flagId = flagTypeId();
1556 QtFlagPropertyManager* flagPropertyManager = new QtFlagPropertyManager(this);
1557 d_ptr->m_typeToPropertyManager[flagId] = flagPropertyManager;
1558 d_ptr->m_typeToValueType[flagId] = QVariant::Int;
1559 d_ptr->m_typeToAttributeToAttributeType[flagId][d_ptr->m_flagNamesAttribute] =
1560 QVariant::StringList;
1561 connect(flagPropertyManager,
1562 SIGNAL(valueChanged(QtProperty*, int)),
1563 this,
1564 SLOT(slotValueChanged(QtProperty*, int)));
1565 connect(flagPropertyManager,
1566 SIGNAL(flagNamesChanged(QtProperty*, const QStringList&)),
1567 this,
1568 SLOT(slotFlagNamesChanged(QtProperty*, const QStringList&)));
1569 connect(flagPropertyManager->subBoolPropertyManager(),
1570 SIGNAL(valueChanged(QtProperty*, bool)),
1571 this,
1572 SLOT(slotValueChanged(QtProperty*, bool)));
1573 connect(flagPropertyManager,
1575 this,
1576 SLOT(slotPropertyInserted(QtProperty*, QtProperty*, QtProperty*)));
1577 connect(flagPropertyManager,
1579 this,
1580 SLOT(slotPropertyRemoved(QtProperty*, QtProperty*)));
1581 // FlagPropertyManager
1582 int groupId = groupTypeId();
1583 QtGroupPropertyManager* groupPropertyManager = new QtGroupPropertyManager(this);
1584 d_ptr->m_typeToPropertyManager[groupId] = groupPropertyManager;
1585 d_ptr->m_typeToValueType[groupId] = QVariant::Invalid;
1586}
1587
1588/*!
1589 Destroys this manager, and all the properties it has created.
1590*/
1592{
1593 clear();
1594 delete d_ptr;
1595}
1596
1597/*!
1598 Returns the given \a property converted into a QtVariantProperty.
1599
1600 If the \a property was not created by this variant manager, the
1601 function returns 0.
1602
1603 \sa createProperty()
1604*/
1607{
1608 const QMap<const QtProperty*, QPair<QtVariantProperty*, int>>::const_iterator it =
1609 d_ptr->m_propertyToType.constFind(property);
1610
1611 if (it == d_ptr->m_propertyToType.constEnd())
1612 {
1613 return 0;
1614 }
1615
1616 return it.value().first;
1617}
1618
1619/*!
1620 Returns true if the given \a propertyType is supported by this
1621 variant manager; otherwise false.
1622
1623 \sa propertyType()
1624*/
1625bool
1627{
1628 if (d_ptr->m_typeToValueType.contains(propertyType))
1629 {
1630 return true;
1631 }
1632
1633 return false;
1634}
1635
1636/*!
1637 Creates and returns a variant property of the given \a propertyType
1638 with the given \a name.
1639
1640 If the specified \a propertyType is not supported by this variant
1641 manager, this function returns 0.
1642
1643 Do not use the inherited
1644 QtAbstractPropertyManager::addProperty() function to create a
1645 variant property (that function will always return 0 since it will
1646 not be clear what type the property should have).
1647
1648 \sa isPropertyTypeSupported()
1649*/
1652{
1654 {
1655 return 0;
1656 }
1657
1658 bool wasCreating = d_ptr->m_creatingProperty;
1659 d_ptr->m_creatingProperty = true;
1660 d_ptr->m_propertyType = propertyType;
1662 d_ptr->m_creatingProperty = wasCreating;
1663 d_ptr->m_propertyType = 0;
1664
1665 if (!property)
1666 {
1667 return 0;
1668 }
1669
1670 return variantProperty(property);
1671}
1672
1673/*!
1674 Returns the given \a property's value.
1675
1676 If the given \a property is not managed by this manager, this
1677 function returns an invalid variant.
1678
1679 \sa setValue()
1680*/
1681QVariant
1683{
1684 QtProperty* internProp = propertyToWrappedProperty()->value(property, 0);
1685
1686 if (internProp == 0)
1687 {
1688 return QVariant();
1689 }
1690
1691 QtAbstractPropertyManager* manager = internProp->propertyManager();
1692
1693 if (QtIntPropertyManager* intManager = qobject_cast<QtIntPropertyManager*>(manager))
1694 {
1695 return intManager->value(internProp);
1696 }
1697 else if (QtDoublePropertyManager* doubleManager =
1698 qobject_cast<QtDoublePropertyManager*>(manager))
1699 {
1700 return doubleManager->value(internProp);
1701 }
1702 else if (QtBoolPropertyManager* boolManager = qobject_cast<QtBoolPropertyManager*>(manager))
1703 {
1704 return boolManager->value(internProp);
1705 }
1706 else if (QtStringPropertyManager* stringManager =
1707 qobject_cast<QtStringPropertyManager*>(manager))
1708 {
1709 return stringManager->value(internProp);
1710 }
1711 else if (QtDatePropertyManager* dateManager = qobject_cast<QtDatePropertyManager*>(manager))
1712 {
1713 return dateManager->value(internProp);
1714 }
1715 else if (QtTimePropertyManager* timeManager = qobject_cast<QtTimePropertyManager*>(manager))
1716 {
1717 return timeManager->value(internProp);
1718 }
1719 else if (QtDateTimePropertyManager* dateTimeManager =
1720 qobject_cast<QtDateTimePropertyManager*>(manager))
1721 {
1722 return dateTimeManager->value(internProp);
1723 }
1724 else if (QtKeySequencePropertyManager* keySequenceManager =
1725 qobject_cast<QtKeySequencePropertyManager*>(manager))
1726 {
1727 return QVariant::fromValue(keySequenceManager->value(internProp));
1728 }
1729 else if (QtCharPropertyManager* charManager = qobject_cast<QtCharPropertyManager*>(manager))
1730 {
1731 return charManager->value(internProp);
1732 }
1733 else if (QtLocalePropertyManager* localeManager =
1734 qobject_cast<QtLocalePropertyManager*>(manager))
1735 {
1736 return localeManager->value(internProp);
1737 }
1738 else if (QtPointPropertyManager* pointManager = qobject_cast<QtPointPropertyManager*>(manager))
1739 {
1740 return pointManager->value(internProp);
1741 }
1742 else if (QtPointFPropertyManager* pointFManager =
1743 qobject_cast<QtPointFPropertyManager*>(manager))
1744 {
1745 return pointFManager->value(internProp);
1746 }
1747 else if (QtSizePropertyManager* sizeManager = qobject_cast<QtSizePropertyManager*>(manager))
1748 {
1749 return sizeManager->value(internProp);
1750 }
1751 else if (QtSizeFPropertyManager* sizeFManager = qobject_cast<QtSizeFPropertyManager*>(manager))
1752 {
1753 return sizeFManager->value(internProp);
1754 }
1755 else if (QtRectPropertyManager* rectManager = qobject_cast<QtRectPropertyManager*>(manager))
1756 {
1757 return rectManager->value(internProp);
1758 }
1759 else if (QtRectFPropertyManager* rectFManager = qobject_cast<QtRectFPropertyManager*>(manager))
1760 {
1761 return rectFManager->value(internProp);
1762 }
1763 else if (QtColorPropertyManager* colorManager = qobject_cast<QtColorPropertyManager*>(manager))
1764 {
1765 return colorManager->value(internProp);
1766 }
1767 else if (QtEnumPropertyManager* enumManager = qobject_cast<QtEnumPropertyManager*>(manager))
1768 {
1769 return enumManager->value(internProp);
1770 }
1771 else if (QtSizePolicyPropertyManager* sizePolicyManager =
1772 qobject_cast<QtSizePolicyPropertyManager*>(manager))
1773 {
1774 return sizePolicyManager->value(internProp);
1775 }
1776 else if (QtFontPropertyManager* fontManager = qobject_cast<QtFontPropertyManager*>(manager))
1777 {
1778 return fontManager->value(internProp);
1779#ifndef QT_NO_CURSOR
1780 }
1781 else if (QtCursorPropertyManager* cursorManager =
1782 qobject_cast<QtCursorPropertyManager*>(manager))
1783 {
1784 return cursorManager->value(internProp);
1785#endif
1786 }
1787 else if (QtFlagPropertyManager* flagManager = qobject_cast<QtFlagPropertyManager*>(manager))
1788 {
1789 return flagManager->value(internProp);
1790 }
1791
1792 return QVariant();
1793}
1794
1795/*!
1796 Returns the given \a property's value type.
1797
1798 \sa propertyType()
1799*/
1800int
1802{
1803 int propType = propertyType(property);
1804 return valueType(propType);
1805}
1806
1807/*!
1808 \overload
1809
1810 Returns the value type associated with the given \a propertyType.
1811*/
1812int
1814{
1815 if (d_ptr->m_typeToValueType.contains(propertyType))
1816 {
1817 return d_ptr->m_typeToValueType[propertyType];
1818 }
1819
1820 return 0;
1821}
1822
1823/*!
1824 Returns the given \a property's type.
1825
1826 \sa valueType()
1827*/
1828int
1830{
1831 const QMap<const QtProperty*, QPair<QtVariantProperty*, int>>::const_iterator it =
1832 d_ptr->m_propertyToType.constFind(property);
1833
1834 if (it == d_ptr->m_propertyToType.constEnd())
1835 {
1836 return 0;
1837 }
1838
1839 return it.value().second;
1840}
1841
1842/*!
1843 Returns the given \a property's value for the specified \a
1844 attribute
1845
1846 If the given \a property was not created by \e this manager, or if
1847 the specified \a attribute does not exist, this function returns
1848 an invalid variant.
1849
1850 \sa attributes(), attributeType(), setAttribute()
1851*/
1852QVariant
1853QtVariantPropertyManager::attributeValue(const QtProperty* property, const QString& attribute) const
1854{
1855 int propType = propertyType(property);
1856
1857 if (!propType)
1858 {
1859 return QVariant();
1860 }
1861
1862 QMap<int, QMap<QString, int>>::ConstIterator it =
1863 d_ptr->m_typeToAttributeToAttributeType.find(propType);
1864
1865 if (it == d_ptr->m_typeToAttributeToAttributeType.constEnd())
1866 {
1867 return QVariant();
1868 }
1869
1870 QMap<QString, int> attributes = it.value();
1871 QMap<QString, int>::ConstIterator itAttr = attributes.find(attribute);
1872
1873 if (itAttr == attributes.constEnd())
1874 {
1875 return QVariant();
1876 }
1877
1878 QtProperty* internProp = propertyToWrappedProperty()->value(property, 0);
1879
1880 if (internProp == 0)
1881 {
1882 return QVariant();
1883 }
1884
1885 QtAbstractPropertyManager* manager = internProp->propertyManager();
1886
1887 if (QtIntPropertyManager* intManager = qobject_cast<QtIntPropertyManager*>(manager))
1888 {
1889 if (attribute == d_ptr->m_maximumAttribute)
1890 {
1891 return intManager->maximum(internProp);
1892 }
1893
1894 if (attribute == d_ptr->m_minimumAttribute)
1895 {
1896 return intManager->minimum(internProp);
1897 }
1898
1899 if (attribute == d_ptr->m_singleStepAttribute)
1900 {
1901 return intManager->singleStep(internProp);
1902 }
1903
1904 if (attribute == d_ptr->m_readOnlyAttribute)
1905 {
1906 return intManager->isReadOnly(internProp);
1907 }
1908
1909 return QVariant();
1910 }
1911 else if (QtDoublePropertyManager* doubleManager =
1912 qobject_cast<QtDoublePropertyManager*>(manager))
1913 {
1914 if (attribute == d_ptr->m_maximumAttribute)
1915 {
1916 return doubleManager->maximum(internProp);
1917 }
1918
1919 if (attribute == d_ptr->m_minimumAttribute)
1920 {
1921 return doubleManager->minimum(internProp);
1922 }
1923
1924 if (attribute == d_ptr->m_singleStepAttribute)
1925 {
1926 return doubleManager->singleStep(internProp);
1927 }
1928
1929 if (attribute == d_ptr->m_decimalsAttribute)
1930 {
1931 return doubleManager->decimals(internProp);
1932 }
1933
1934 if (attribute == d_ptr->m_readOnlyAttribute)
1935 {
1936 return doubleManager->isReadOnly(internProp);
1937 }
1938
1939 return QVariant();
1940 }
1941 else if (QtBoolPropertyManager* boolManager = qobject_cast<QtBoolPropertyManager*>(manager))
1942 {
1943 if (attribute == d_ptr->m_textVisibleAttribute)
1944 {
1945 return boolManager->textVisible(internProp);
1946 }
1947
1948 return QVariant();
1949 }
1950 else if (QtStringPropertyManager* stringManager =
1951 qobject_cast<QtStringPropertyManager*>(manager))
1952 {
1953 if (attribute == d_ptr->m_regExpAttribute)
1954 {
1955 return stringManager->regExp(internProp);
1956 }
1957
1958 if (attribute == d_ptr->m_echoModeAttribute)
1959 {
1960 return stringManager->echoMode(internProp);
1961 }
1962
1963 if (attribute == d_ptr->m_readOnlyAttribute)
1964 {
1965 return stringManager->isReadOnly(internProp);
1966 }
1967
1968 return QVariant();
1969 }
1970 else if (QtDatePropertyManager* dateManager = qobject_cast<QtDatePropertyManager*>(manager))
1971 {
1972 if (attribute == d_ptr->m_maximumAttribute)
1973 {
1974 return dateManager->maximum(internProp);
1975 }
1976
1977 if (attribute == d_ptr->m_minimumAttribute)
1978 {
1979 return dateManager->minimum(internProp);
1980 }
1981
1982 return QVariant();
1983 }
1984 else if (QtPointFPropertyManager* pointFManager =
1985 qobject_cast<QtPointFPropertyManager*>(manager))
1986 {
1987 if (attribute == d_ptr->m_decimalsAttribute)
1988 {
1989 return pointFManager->decimals(internProp);
1990 }
1991
1992 return QVariant();
1993 }
1994 else if (QtSizePropertyManager* sizeManager = qobject_cast<QtSizePropertyManager*>(manager))
1995 {
1996 if (attribute == d_ptr->m_maximumAttribute)
1997 {
1998 return sizeManager->maximum(internProp);
1999 }
2000
2001 if (attribute == d_ptr->m_minimumAttribute)
2002 {
2003 return sizeManager->minimum(internProp);
2004 }
2005
2006 return QVariant();
2007 }
2008 else if (QtSizeFPropertyManager* sizeFManager = qobject_cast<QtSizeFPropertyManager*>(manager))
2009 {
2010 if (attribute == d_ptr->m_maximumAttribute)
2011 {
2012 return sizeFManager->maximum(internProp);
2013 }
2014
2015 if (attribute == d_ptr->m_minimumAttribute)
2016 {
2017 return sizeFManager->minimum(internProp);
2018 }
2019
2020 if (attribute == d_ptr->m_decimalsAttribute)
2021 {
2022 return sizeFManager->decimals(internProp);
2023 }
2024
2025 return QVariant();
2026 }
2027 else if (QtRectPropertyManager* rectManager = qobject_cast<QtRectPropertyManager*>(manager))
2028 {
2029 if (attribute == d_ptr->m_constraintAttribute)
2030 {
2031 return rectManager->constraint(internProp);
2032 }
2033
2034 return QVariant();
2035 }
2036 else if (QtRectFPropertyManager* rectFManager = qobject_cast<QtRectFPropertyManager*>(manager))
2037 {
2038 if (attribute == d_ptr->m_constraintAttribute)
2039 {
2040 return rectFManager->constraint(internProp);
2041 }
2042
2043 if (attribute == d_ptr->m_decimalsAttribute)
2044 {
2045 return rectFManager->decimals(internProp);
2046 }
2047
2048 return QVariant();
2049 }
2050 else if (QtEnumPropertyManager* enumManager = qobject_cast<QtEnumPropertyManager*>(manager))
2051 {
2052 if (attribute == d_ptr->m_enumNamesAttribute)
2053 {
2054 return enumManager->enumNames(internProp);
2055 }
2056
2057 if (attribute == d_ptr->m_enumIconsAttribute)
2058 {
2059 QVariant v;
2060 qVariantSetValue(v, enumManager->enumIcons(internProp));
2061 return v;
2062 }
2063
2064 return QVariant();
2065 }
2066 else if (QtFlagPropertyManager* flagManager = qobject_cast<QtFlagPropertyManager*>(manager))
2067 {
2068 if (attribute == d_ptr->m_flagNamesAttribute)
2069 {
2070 return flagManager->flagNames(internProp);
2071 }
2072
2073 return QVariant();
2074 }
2075
2076 return QVariant();
2077}
2078
2079/*!
2080 Returns a list of the given \a propertyType 's attributes.
2081
2082 \sa attributeValue(), attributeType()
2083*/
2084QStringList
2086{
2087 QMap<int, QMap<QString, int>>::ConstIterator it =
2088 d_ptr->m_typeToAttributeToAttributeType.find(propertyType);
2089
2090 if (it == d_ptr->m_typeToAttributeToAttributeType.constEnd())
2091 {
2092 return QStringList();
2093 }
2094
2095 return it.value().keys();
2096}
2097
2098/*!
2099 Returns the type of the specified \a attribute of the given \a
2100 propertyType.
2101
2102 If the given \a propertyType is not supported by \e this manager,
2103 or if the given \a propertyType does not possess the specified \a
2104 attribute, this function returns QVariant::Invalid.
2105
2106 \sa attributes(), valueType()
2107*/
2108int
2109QtVariantPropertyManager::attributeType(int propertyType, const QString& attribute) const
2110{
2111 QMap<int, QMap<QString, int>>::ConstIterator it =
2112 d_ptr->m_typeToAttributeToAttributeType.find(propertyType);
2113
2114 if (it == d_ptr->m_typeToAttributeToAttributeType.constEnd())
2115 {
2116 return 0;
2117 }
2118
2119 QMap<QString, int> attributes = it.value();
2120 QMap<QString, int>::ConstIterator itAttr = attributes.find(attribute);
2121
2122 if (itAttr == attributes.constEnd())
2123 {
2124 return 0;
2125 }
2126
2127 return itAttr.value();
2128}
2129
2130/*!
2131 \fn void QtVariantPropertyManager::setValue(QtProperty *property, const QVariant &value)
2132
2133 Sets the value of the given \a property to \a value.
2134
2135 The specified \a value must be of a type returned by valueType(),
2136 or of type that can be converted to valueType() using the
2137 QVariant::canConvert() function, otherwise this function does
2138 nothing.
2139
2140 \sa value(), QtVariantProperty::setValue(), valueChanged()
2141*/
2142void
2143QtVariantPropertyManager::setValue(QtProperty* property, const QVariant& val)
2144{
2145 int propType = val.userType();
2146
2147 if (!propType)
2148 {
2149 return;
2150 }
2151
2152 int valType = valueType(property);
2153
2154 if (propType != valType && !val.canConvert(static_cast<QVariant::Type>(valType)))
2155 {
2156 return;
2157 }
2158
2159 QtProperty* internProp = propertyToWrappedProperty()->value(property, 0);
2160
2161 if (internProp == 0)
2162 {
2163 return;
2164 }
2165
2166
2167 QtAbstractPropertyManager* manager = internProp->propertyManager();
2168
2169 if (QtIntPropertyManager* intManager = qobject_cast<QtIntPropertyManager*>(manager))
2170 {
2171 intManager->setValue(internProp, val.value<int>());
2172 return;
2173 }
2174 else if (QtDoublePropertyManager* doubleManager =
2175 qobject_cast<QtDoublePropertyManager*>(manager))
2176 {
2177 doubleManager->setValue(internProp, val.value<double>());
2178 return;
2179 }
2180 else if (QtBoolPropertyManager* boolManager = qobject_cast<QtBoolPropertyManager*>(manager))
2181 {
2182 boolManager->setValue(internProp, val.value<bool>());
2183 return;
2184 }
2185 else if (QtStringPropertyManager* stringManager =
2186 qobject_cast<QtStringPropertyManager*>(manager))
2187 {
2188 stringManager->setValue(internProp, val.value<QString>());
2189 return;
2190 }
2191 else if (QtDatePropertyManager* dateManager = qobject_cast<QtDatePropertyManager*>(manager))
2192 {
2193 dateManager->setValue(internProp, val.value<QDate>());
2194 return;
2195 }
2196 else if (QtTimePropertyManager* timeManager = qobject_cast<QtTimePropertyManager*>(manager))
2197 {
2198 timeManager->setValue(internProp, val.value<QTime>());
2199 return;
2200 }
2201 else if (QtDateTimePropertyManager* dateTimeManager =
2202 qobject_cast<QtDateTimePropertyManager*>(manager))
2203 {
2204 dateTimeManager->setValue(internProp, val.value<QDateTime>());
2205 return;
2206 }
2207 else if (QtKeySequencePropertyManager* keySequenceManager =
2208 qobject_cast<QtKeySequencePropertyManager*>(manager))
2209 {
2210 keySequenceManager->setValue(internProp, val.value<QKeySequence>());
2211 return;
2212 }
2213 else if (QtCharPropertyManager* charManager = qobject_cast<QtCharPropertyManager*>(manager))
2214 {
2215 charManager->setValue(internProp, val.value<QChar>());
2216 return;
2217 }
2218 else if (QtLocalePropertyManager* localeManager =
2219 qobject_cast<QtLocalePropertyManager*>(manager))
2220 {
2221 localeManager->setValue(internProp, val.value<QLocale>());
2222 return;
2223 }
2224 else if (QtPointPropertyManager* pointManager = qobject_cast<QtPointPropertyManager*>(manager))
2225 {
2226 pointManager->setValue(internProp, val.value<QPoint>());
2227 return;
2228 }
2229 else if (QtPointFPropertyManager* pointFManager =
2230 qobject_cast<QtPointFPropertyManager*>(manager))
2231 {
2232 pointFManager->setValue(internProp, val.value<QPointF>());
2233 return;
2234 }
2235 else if (QtSizePropertyManager* sizeManager = qobject_cast<QtSizePropertyManager*>(manager))
2236 {
2237 sizeManager->setValue(internProp, val.value<QSize>());
2238 return;
2239 }
2240 else if (QtSizeFPropertyManager* sizeFManager = qobject_cast<QtSizeFPropertyManager*>(manager))
2241 {
2242 sizeFManager->setValue(internProp, val.value<QSizeF>());
2243 return;
2244 }
2245 else if (QtRectPropertyManager* rectManager = qobject_cast<QtRectPropertyManager*>(manager))
2246 {
2247 rectManager->setValue(internProp, val.value<QRect>());
2248 return;
2249 }
2250 else if (QtRectFPropertyManager* rectFManager = qobject_cast<QtRectFPropertyManager*>(manager))
2251 {
2252 rectFManager->setValue(internProp, val.value<QRectF>());
2253 return;
2254 }
2255 else if (QtColorPropertyManager* colorManager = qobject_cast<QtColorPropertyManager*>(manager))
2256 {
2257 colorManager->setValue(internProp, val.value<QColor>());
2258 return;
2259 }
2260 else if (QtEnumPropertyManager* enumManager = qobject_cast<QtEnumPropertyManager*>(manager))
2261 {
2262 enumManager->setValue(internProp, val.value<int>());
2263 return;
2264 }
2265 else if (QtSizePolicyPropertyManager* sizePolicyManager =
2266 qobject_cast<QtSizePolicyPropertyManager*>(manager))
2267 {
2268 sizePolicyManager->setValue(internProp, val.value<QSizePolicy>());
2269 return;
2270 }
2271 else if (QtFontPropertyManager* fontManager = qobject_cast<QtFontPropertyManager*>(manager))
2272 {
2273 fontManager->setValue(internProp, val.value<QFont>());
2274 return;
2275#ifndef QT_NO_CURSOR
2276 }
2277 else if (QtCursorPropertyManager* cursorManager =
2278 qobject_cast<QtCursorPropertyManager*>(manager))
2279 {
2280 cursorManager->setValue(internProp, val.value<QCursor>());
2281 return;
2282#endif
2283 }
2284 else if (QtFlagPropertyManager* flagManager = qobject_cast<QtFlagPropertyManager*>(manager))
2285 {
2286 flagManager->setValue(internProp, val.value<int>());
2287 return;
2288 }
2289}
2290
2291/*!
2292 Sets the value of the specified \a attribute of the given \a
2293 property, to \a value.
2294
2295 The new \a value's type must be of the type returned by
2296 attributeType(), or of a type that can be converted to
2297 attributeType() using the QVariant::canConvert() function,
2298 otherwise this function does nothing.
2299
2300 \sa attributeValue(), QtVariantProperty::setAttribute(), attributeChanged()
2301*/
2302void
2304 const QString& attribute,
2305 const QVariant& value)
2306{
2307 QVariant oldAttr = attributeValue(property, attribute);
2308
2309 if (!oldAttr.isValid())
2310 {
2311 return;
2312 }
2313
2314 int attrType = value.userType();
2315
2316 if (!attrType)
2317 {
2318 return;
2319 }
2320
2321 if (attrType != attributeType(propertyType(property), attribute) &&
2322 !value.canConvert((QVariant::Type)attrType))
2323 {
2324 return;
2325 }
2326
2327 QtProperty* internProp = propertyToWrappedProperty()->value(property, 0);
2328
2329 if (internProp == 0)
2330 {
2331 return;
2332 }
2333
2334 QtAbstractPropertyManager* manager = internProp->propertyManager();
2335
2336 if (QtIntPropertyManager* intManager = qobject_cast<QtIntPropertyManager*>(manager))
2337 {
2338 if (attribute == d_ptr->m_maximumAttribute)
2339 {
2340 intManager->setMaximum(internProp, value.value<int>());
2341 }
2342 else if (attribute == d_ptr->m_minimumAttribute)
2343 {
2344 intManager->setMinimum(internProp, value.value<int>());
2345 }
2346 else if (attribute == d_ptr->m_singleStepAttribute)
2347 {
2348 intManager->setSingleStep(internProp, value.value<int>());
2349 }
2350 else if (attribute == d_ptr->m_readOnlyAttribute)
2351 {
2352 intManager->setReadOnly(internProp, value.value<bool>());
2353 }
2354
2355 return;
2356 }
2357 else if (QtDoublePropertyManager* doubleManager =
2358 qobject_cast<QtDoublePropertyManager*>(manager))
2359 {
2360 if (attribute == d_ptr->m_maximumAttribute)
2361 {
2362 doubleManager->setMaximum(internProp, value.value<double>());
2363 }
2364
2365 if (attribute == d_ptr->m_minimumAttribute)
2366 {
2367 doubleManager->setMinimum(internProp, value.value<double>());
2368 }
2369
2370 if (attribute == d_ptr->m_singleStepAttribute)
2371 {
2372 doubleManager->setSingleStep(internProp, value.value<double>());
2373 }
2374
2375 if (attribute == d_ptr->m_decimalsAttribute)
2376 {
2377 doubleManager->setDecimals(internProp, value.value<int>());
2378 }
2379
2380 if (attribute == d_ptr->m_readOnlyAttribute)
2381 {
2382 doubleManager->setReadOnly(internProp, value.value<bool>());
2383 }
2384
2385 return;
2386 }
2387 else if (QtBoolPropertyManager* boolManager = qobject_cast<QtBoolPropertyManager*>(manager))
2388 {
2389 if (attribute == d_ptr->m_textVisibleAttribute)
2390 {
2391 boolManager->setTextVisible(internProp, value.value<bool>());
2392 }
2393
2394 return;
2395 }
2396 else if (QtStringPropertyManager* stringManager =
2397 qobject_cast<QtStringPropertyManager*>(manager))
2398 {
2399 if (attribute == d_ptr->m_regExpAttribute)
2400 {
2401 stringManager->setRegExp(internProp, value.value<QRegExp>());
2402 }
2403
2404 if (attribute == d_ptr->m_echoModeAttribute)
2405 {
2406 stringManager->setEchoMode(internProp, (EchoMode)value.value<int>());
2407 }
2408
2409 if (attribute == d_ptr->m_readOnlyAttribute)
2410 {
2411 stringManager->setReadOnly(internProp, (EchoMode)value.value<bool>());
2412 }
2413
2414 return;
2415 }
2416 else if (QtDatePropertyManager* dateManager = qobject_cast<QtDatePropertyManager*>(manager))
2417 {
2418 if (attribute == d_ptr->m_maximumAttribute)
2419 {
2420 dateManager->setMaximum(internProp, value.value<QDate>());
2421 }
2422
2423 if (attribute == d_ptr->m_minimumAttribute)
2424 {
2425 dateManager->setMinimum(internProp, value.value<QDate>());
2426 }
2427
2428 return;
2429 }
2430 else if (QtPointFPropertyManager* pointFManager =
2431 qobject_cast<QtPointFPropertyManager*>(manager))
2432 {
2433 if (attribute == d_ptr->m_decimalsAttribute)
2434 {
2435 pointFManager->setDecimals(internProp, value.value<int>());
2436 }
2437
2438 return;
2439 }
2440 else if (QtSizePropertyManager* sizeManager = qobject_cast<QtSizePropertyManager*>(manager))
2441 {
2442 if (attribute == d_ptr->m_maximumAttribute)
2443 {
2444 sizeManager->setMaximum(internProp, value.value<QSize>());
2445 }
2446
2447 if (attribute == d_ptr->m_minimumAttribute)
2448 {
2449 sizeManager->setMinimum(internProp, value.value<QSize>());
2450 }
2451
2452 return;
2453 }
2454 else if (QtSizeFPropertyManager* sizeFManager = qobject_cast<QtSizeFPropertyManager*>(manager))
2455 {
2456 if (attribute == d_ptr->m_maximumAttribute)
2457 {
2458 sizeFManager->setMaximum(internProp, value.value<QSizeF>());
2459 }
2460
2461 if (attribute == d_ptr->m_minimumAttribute)
2462 {
2463 sizeFManager->setMinimum(internProp, value.value<QSizeF>());
2464 }
2465
2466 if (attribute == d_ptr->m_decimalsAttribute)
2467 {
2468 sizeFManager->setDecimals(internProp, value.value<int>());
2469 }
2470
2471 return;
2472 }
2473 else if (QtRectPropertyManager* rectManager = qobject_cast<QtRectPropertyManager*>(manager))
2474 {
2475 if (attribute == d_ptr->m_constraintAttribute)
2476 {
2477 rectManager->setConstraint(internProp, value.value<QRect>());
2478 }
2479
2480 return;
2481 }
2482 else if (QtRectFPropertyManager* rectFManager = qobject_cast<QtRectFPropertyManager*>(manager))
2483 {
2484 if (attribute == d_ptr->m_constraintAttribute)
2485 {
2486 rectFManager->setConstraint(internProp, value.value<QRectF>());
2487 }
2488
2489 if (attribute == d_ptr->m_decimalsAttribute)
2490 {
2491 rectFManager->setDecimals(internProp, value.value<int>());
2492 }
2493
2494 return;
2495 }
2496 else if (QtEnumPropertyManager* enumManager = qobject_cast<QtEnumPropertyManager*>(manager))
2497 {
2498 if (attribute == d_ptr->m_enumNamesAttribute)
2499 {
2500 enumManager->setEnumNames(internProp, value.value<QStringList>());
2501 }
2502
2503 if (attribute == d_ptr->m_enumIconsAttribute)
2504 {
2505 enumManager->setEnumIcons(internProp, value.value<QtIconMap>());
2506 }
2507
2508 return;
2509 }
2510 else if (QtFlagPropertyManager* flagManager = qobject_cast<QtFlagPropertyManager*>(manager))
2511 {
2512 if (attribute == d_ptr->m_flagNamesAttribute)
2513 {
2514 flagManager->setFlagNames(internProp, value.value<QStringList>());
2515 }
2516
2517 return;
2518 }
2519}
2520
2521/*!
2522 \reimp
2523*/
2524bool
2526{
2527 if (propertyType(property) == groupTypeId())
2528 {
2529 return false;
2530 }
2531
2532 return true;
2533}
2534
2535/*!
2536 \reimp
2537*/
2538QString
2540{
2541 const QtProperty* internProp = propertyToWrappedProperty()->value(property, 0);
2542 return internProp ? !internProp->displayText().isEmpty() ? internProp->displayText()
2543 : internProp->valueText()
2544 : QString();
2545}
2546
2547/*!
2548 \reimp
2549*/
2550QIcon
2552{
2553 const QtProperty* internProp = propertyToWrappedProperty()->value(property, 0);
2554 return internProp ? internProp->valueIcon() : QIcon();
2555}
2556
2557/*!
2558 \reimp
2559*/
2560void
2562{
2563 QtVariantProperty* varProp = variantProperty(property);
2564
2565 if (!varProp)
2566 {
2567 return;
2568 }
2569
2570 QMap<int, QtAbstractPropertyManager*>::ConstIterator it =
2571 d_ptr->m_typeToPropertyManager.find(d_ptr->m_propertyType);
2572
2573 if (it != d_ptr->m_typeToPropertyManager.constEnd())
2574 {
2575 QtProperty* internProp = 0;
2576
2577 if (!d_ptr->m_creatingSubProperties)
2578 {
2579 QtAbstractPropertyManager* manager = it.value();
2580 internProp = manager->addProperty();
2581 d_ptr->m_internalToProperty[internProp] = varProp;
2582 }
2583
2584 propertyToWrappedProperty()->insert(varProp, internProp);
2585
2586 if (internProp)
2587 {
2588 QList<QtProperty*> children = internProp->subProperties();
2589 QListIterator<QtProperty*> itChild(children);
2590 QtVariantProperty* lastProperty = 0;
2591
2592 while (itChild.hasNext())
2593 {
2594 QtVariantProperty* prop =
2595 d_ptr->createSubProperty(varProp, lastProperty, itChild.next());
2596 lastProperty = prop ? prop : lastProperty;
2597 }
2598 }
2599 }
2600}
2601
2602/*!
2603 \reimp
2604*/
2605void
2607{
2608 const QMap<const QtProperty*, QPair<QtVariantProperty*, int>>::iterator type_it =
2609 d_ptr->m_propertyToType.find(property);
2610
2611 if (type_it == d_ptr->m_propertyToType.end())
2612 {
2613 return;
2614 }
2615
2616 PropertyMap::iterator it = propertyToWrappedProperty()->find(property);
2617
2618 if (it != propertyToWrappedProperty()->end())
2619 {
2620 QtProperty* internProp = it.value();
2621
2622 if (internProp)
2623 {
2624 d_ptr->m_internalToProperty.remove(internProp);
2625
2626 if (!d_ptr->m_destroyingSubProperties)
2627 {
2628 delete internProp;
2629 }
2630 }
2631
2632 propertyToWrappedProperty()->erase(it);
2633 }
2634
2635 d_ptr->m_propertyToType.erase(type_it);
2636}
2637
2638/*!
2639 \reimp
2640*/
2643{
2644 if (!d_ptr->m_creatingProperty)
2645 {
2646 return 0;
2647 }
2648
2649 QtVariantProperty* property = new QtVariantProperty(this);
2650 d_ptr->m_propertyToType.insert(property, qMakePair(property, d_ptr->m_propertyType));
2651
2652 return property;
2653}
2654
2655/////////////////////////////
2656
2679
2680/*!
2681 \class QtVariantEditorFactory
2682
2683 \brief The QtVariantEditorFactory class provides widgets for properties
2684 created by QtVariantPropertyManager objects.
2685
2686 The variant factory provides the following widgets for the
2687 specified property types:
2688
2689 \table
2690 \header
2691 \o Property Type
2692 \o Widget
2693 \row
2694 \o \c int
2695 \o QSpinBox
2696 \row
2697 \o \c double
2698 \o QDoubleSpinBox
2699 \row
2700 \o \c bool
2701 \o QCheckBox
2702 \row
2703 \o QString
2704 \o QLineEdit
2705 \row
2706 \o QDate
2707 \o QDateEdit
2708 \row
2709 \o QTime
2710 \o QTimeEdit
2711 \row
2712 \o QDateTime
2713 \o QDateTimeEdit
2714 \row
2715 \o QKeySequence
2716 \o customized editor
2717 \row
2718 \o QChar
2719 \o customized editor
2720 \row
2721 \o \c enum
2722 \o QComboBox
2723 \row
2724 \o QCursor
2725 \o QComboBox
2726 \endtable
2727
2728 Note that QtVariantPropertyManager supports several additional property
2729 types for which the QtVariantEditorFactory class does not provide
2730 editing widgets, e.g. QPoint and QSize. To provide widgets for other
2731 types using the variant approach, derive from the QtVariantEditorFactory
2732 class.
2733
2734 \sa QtAbstractEditorFactory, QtVariantPropertyManager
2735*/
2736
2737/*!
2738 Creates a factory with the given \a parent.
2739*/
2742{
2743 d_ptr = new QtVariantEditorFactoryPrivate();
2744 d_ptr->q_ptr = this;
2745
2746 d_ptr->m_spinBoxFactory = new QtSpinBoxFactory(this);
2747 d_ptr->m_factoryToType[d_ptr->m_spinBoxFactory] = QVariant::Int;
2748 d_ptr->m_typeToFactory[QVariant::Int] = d_ptr->m_spinBoxFactory;
2749
2750 d_ptr->m_doubleSpinBoxFactory = new QtDoubleSpinBoxFactory(this);
2751 d_ptr->m_factoryToType[d_ptr->m_doubleSpinBoxFactory] = QVariant::Double;
2752 d_ptr->m_typeToFactory[QVariant::Double] = d_ptr->m_doubleSpinBoxFactory;
2753
2754 d_ptr->m_checkBoxFactory = new QtCheckBoxFactory(this);
2755 d_ptr->m_factoryToType[d_ptr->m_checkBoxFactory] = QVariant::Bool;
2756 d_ptr->m_typeToFactory[QVariant::Bool] = d_ptr->m_checkBoxFactory;
2757
2758 d_ptr->m_lineEditFactory = new QtLineEditFactory(this);
2759 d_ptr->m_factoryToType[d_ptr->m_lineEditFactory] = QVariant::String;
2760 d_ptr->m_typeToFactory[QVariant::String] = d_ptr->m_lineEditFactory;
2761
2762 d_ptr->m_dateEditFactory = new QtDateEditFactory(this);
2763 d_ptr->m_factoryToType[d_ptr->m_dateEditFactory] = QVariant::Date;
2764 d_ptr->m_typeToFactory[QVariant::Date] = d_ptr->m_dateEditFactory;
2765
2766 d_ptr->m_timeEditFactory = new QtTimeEditFactory(this);
2767 d_ptr->m_factoryToType[d_ptr->m_timeEditFactory] = QVariant::Time;
2768 d_ptr->m_typeToFactory[QVariant::Time] = d_ptr->m_timeEditFactory;
2769
2770 d_ptr->m_dateTimeEditFactory = new QtDateTimeEditFactory(this);
2771 d_ptr->m_factoryToType[d_ptr->m_dateTimeEditFactory] = QVariant::DateTime;
2772 d_ptr->m_typeToFactory[QVariant::DateTime] = d_ptr->m_dateTimeEditFactory;
2773
2774 d_ptr->m_keySequenceEditorFactory = new QtKeySequenceEditorFactory(this);
2775 d_ptr->m_factoryToType[d_ptr->m_keySequenceEditorFactory] = QVariant::KeySequence;
2776 d_ptr->m_typeToFactory[QVariant::KeySequence] = d_ptr->m_keySequenceEditorFactory;
2777
2778 d_ptr->m_charEditorFactory = new QtCharEditorFactory(this);
2779 d_ptr->m_factoryToType[d_ptr->m_charEditorFactory] = QVariant::Char;
2780 d_ptr->m_typeToFactory[QVariant::Char] = d_ptr->m_charEditorFactory;
2781
2782 d_ptr->m_cursorEditorFactory = new QtCursorEditorFactory(this);
2783 d_ptr->m_factoryToType[d_ptr->m_cursorEditorFactory] = QVariant::Cursor;
2784 d_ptr->m_typeToFactory[QVariant::Cursor] = d_ptr->m_cursorEditorFactory;
2785
2786 d_ptr->m_colorEditorFactory = new QtColorEditorFactory(this);
2787 d_ptr->m_factoryToType[d_ptr->m_colorEditorFactory] = QVariant::Color;
2788 d_ptr->m_typeToFactory[QVariant::Color] = d_ptr->m_colorEditorFactory;
2789
2790 d_ptr->m_fontEditorFactory = new QtFontEditorFactory(this);
2791 d_ptr->m_factoryToType[d_ptr->m_fontEditorFactory] = QVariant::Font;
2792 d_ptr->m_typeToFactory[QVariant::Font] = d_ptr->m_fontEditorFactory;
2793
2794 d_ptr->m_comboBoxFactory = new QtEnumEditorFactory(this);
2795 const int enumId = QtVariantPropertyManager::enumTypeId();
2796 d_ptr->m_factoryToType[d_ptr->m_comboBoxFactory] = enumId;
2797 d_ptr->m_typeToFactory[enumId] = d_ptr->m_comboBoxFactory;
2798}
2799
2800/*!
2801 Destroys this factory, and all the widgets it has created.
2802*/
2807
2808/*!
2809 \internal
2810
2811 Reimplemented from the QtAbstractEditorFactory class.
2812*/
2813void
2815{
2816 QList<QtIntPropertyManager*> intPropertyManagers =
2817 manager->findChildren<QtIntPropertyManager*>();
2818 QListIterator<QtIntPropertyManager*> itInt(intPropertyManagers);
2819
2820 while (itInt.hasNext())
2821 {
2822 d_ptr->m_spinBoxFactory->addPropertyManager(itInt.next());
2823 }
2824
2825 QList<QtDoublePropertyManager*> doublePropertyManagers =
2826 manager->findChildren<QtDoublePropertyManager*>();
2827 QListIterator<QtDoublePropertyManager*> itDouble(doublePropertyManagers);
2828
2829 while (itDouble.hasNext())
2830 {
2831 d_ptr->m_doubleSpinBoxFactory->addPropertyManager(itDouble.next());
2832 }
2833
2834 QList<QtBoolPropertyManager*> boolPropertyManagers =
2835 manager->findChildren<QtBoolPropertyManager*>();
2836 QListIterator<QtBoolPropertyManager*> itBool(boolPropertyManagers);
2837
2838 while (itBool.hasNext())
2839 {
2840 d_ptr->m_checkBoxFactory->addPropertyManager(itBool.next());
2841 }
2842
2843 QList<QtStringPropertyManager*> stringPropertyManagers =
2844 manager->findChildren<QtStringPropertyManager*>();
2845 QListIterator<QtStringPropertyManager*> itString(stringPropertyManagers);
2846
2847 while (itString.hasNext())
2848 {
2849 d_ptr->m_lineEditFactory->addPropertyManager(itString.next());
2850 }
2851
2852 QList<QtDatePropertyManager*> datePropertyManagers =
2853 manager->findChildren<QtDatePropertyManager*>();
2854 QListIterator<QtDatePropertyManager*> itDate(datePropertyManagers);
2855
2856 while (itDate.hasNext())
2857 {
2858 d_ptr->m_dateEditFactory->addPropertyManager(itDate.next());
2859 }
2860
2861 QList<QtTimePropertyManager*> timePropertyManagers =
2862 manager->findChildren<QtTimePropertyManager*>();
2863 QListIterator<QtTimePropertyManager*> itTime(timePropertyManagers);
2864
2865 while (itTime.hasNext())
2866 {
2867 d_ptr->m_timeEditFactory->addPropertyManager(itTime.next());
2868 }
2869
2870 QList<QtDateTimePropertyManager*> dateTimePropertyManagers =
2871 manager->findChildren<QtDateTimePropertyManager*>();
2872 QListIterator<QtDateTimePropertyManager*> itDateTime(dateTimePropertyManagers);
2873
2874 while (itDateTime.hasNext())
2875 {
2876 d_ptr->m_dateTimeEditFactory->addPropertyManager(itDateTime.next());
2877 }
2878
2879 QList<QtKeySequencePropertyManager*> keySequencePropertyManagers =
2880 manager->findChildren<QtKeySequencePropertyManager*>();
2881 QListIterator<QtKeySequencePropertyManager*> itKeySequence(keySequencePropertyManagers);
2882
2883 while (itKeySequence.hasNext())
2884 {
2885 d_ptr->m_keySequenceEditorFactory->addPropertyManager(itKeySequence.next());
2886 }
2887
2888 QList<QtCharPropertyManager*> charPropertyManagers =
2889 manager->findChildren<QtCharPropertyManager*>();
2890 QListIterator<QtCharPropertyManager*> itChar(charPropertyManagers);
2891
2892 while (itChar.hasNext())
2893 {
2894 d_ptr->m_charEditorFactory->addPropertyManager(itChar.next());
2895 }
2896
2897 QList<QtLocalePropertyManager*> localePropertyManagers =
2898 manager->findChildren<QtLocalePropertyManager*>();
2899 QListIterator<QtLocalePropertyManager*> itLocale(localePropertyManagers);
2900
2901 while (itLocale.hasNext())
2902 {
2903 d_ptr->m_comboBoxFactory->addPropertyManager(itLocale.next()->subEnumPropertyManager());
2904 }
2905
2906 QList<QtPointPropertyManager*> pointPropertyManagers =
2907 manager->findChildren<QtPointPropertyManager*>();
2908 QListIterator<QtPointPropertyManager*> itPoint(pointPropertyManagers);
2909
2910 while (itPoint.hasNext())
2911 {
2912 d_ptr->m_spinBoxFactory->addPropertyManager(itPoint.next()->subIntPropertyManager());
2913 }
2914
2915 QList<QtPointFPropertyManager*> pointFPropertyManagers =
2916 manager->findChildren<QtPointFPropertyManager*>();
2917 QListIterator<QtPointFPropertyManager*> itPointF(pointFPropertyManagers);
2918
2919 while (itPointF.hasNext())
2920 {
2921 d_ptr->m_doubleSpinBoxFactory->addPropertyManager(
2922 itPointF.next()->subDoublePropertyManager());
2923 }
2924
2925 QList<QtSizePropertyManager*> sizePropertyManagers =
2926 manager->findChildren<QtSizePropertyManager*>();
2927 QListIterator<QtSizePropertyManager*> itSize(sizePropertyManagers);
2928
2929 while (itSize.hasNext())
2930 {
2931 d_ptr->m_spinBoxFactory->addPropertyManager(itSize.next()->subIntPropertyManager());
2932 }
2933
2934 QList<QtSizeFPropertyManager*> sizeFPropertyManagers =
2935 manager->findChildren<QtSizeFPropertyManager*>();
2936 QListIterator<QtSizeFPropertyManager*> itSizeF(sizeFPropertyManagers);
2937
2938 while (itSizeF.hasNext())
2939 {
2940 d_ptr->m_doubleSpinBoxFactory->addPropertyManager(
2941 itSizeF.next()->subDoublePropertyManager());
2942 }
2943
2944 QList<QtRectPropertyManager*> rectPropertyManagers =
2945 manager->findChildren<QtRectPropertyManager*>();
2946 QListIterator<QtRectPropertyManager*> itRect(rectPropertyManagers);
2947
2948 while (itRect.hasNext())
2949 {
2950 d_ptr->m_spinBoxFactory->addPropertyManager(itRect.next()->subIntPropertyManager());
2951 }
2952
2953 QList<QtRectFPropertyManager*> rectFPropertyManagers =
2954 manager->findChildren<QtRectFPropertyManager*>();
2955 QListIterator<QtRectFPropertyManager*> itRectF(rectFPropertyManagers);
2956
2957 while (itRectF.hasNext())
2958 {
2959 d_ptr->m_doubleSpinBoxFactory->addPropertyManager(
2960 itRectF.next()->subDoublePropertyManager());
2961 }
2962
2963 QList<QtColorPropertyManager*> colorPropertyManagers =
2964 manager->findChildren<QtColorPropertyManager*>();
2965 QListIterator<QtColorPropertyManager*> itColor(colorPropertyManagers);
2966
2967 while (itColor.hasNext())
2968 {
2969 QtColorPropertyManager* manager = itColor.next();
2970 d_ptr->m_colorEditorFactory->addPropertyManager(manager);
2971 d_ptr->m_spinBoxFactory->addPropertyManager(manager->subIntPropertyManager());
2972 }
2973
2974 QList<QtEnumPropertyManager*> enumPropertyManagers =
2975 manager->findChildren<QtEnumPropertyManager*>();
2976 QListIterator<QtEnumPropertyManager*> itEnum(enumPropertyManagers);
2977
2978 while (itEnum.hasNext())
2979 {
2980 d_ptr->m_comboBoxFactory->addPropertyManager(itEnum.next());
2981 }
2982
2983 QList<QtSizePolicyPropertyManager*> sizePolicyPropertyManagers =
2984 manager->findChildren<QtSizePolicyPropertyManager*>();
2985 QListIterator<QtSizePolicyPropertyManager*> itSizePolicy(sizePolicyPropertyManagers);
2986
2987 while (itSizePolicy.hasNext())
2988 {
2989 QtSizePolicyPropertyManager* manager = itSizePolicy.next();
2990 d_ptr->m_spinBoxFactory->addPropertyManager(manager->subIntPropertyManager());
2991 d_ptr->m_comboBoxFactory->addPropertyManager(manager->subEnumPropertyManager());
2992 }
2993
2994 QList<QtFontPropertyManager*> fontPropertyManagers =
2995 manager->findChildren<QtFontPropertyManager*>();
2996 QListIterator<QtFontPropertyManager*> itFont(fontPropertyManagers);
2997
2998 while (itFont.hasNext())
2999 {
3000 QtFontPropertyManager* manager = itFont.next();
3001 d_ptr->m_fontEditorFactory->addPropertyManager(manager);
3002 d_ptr->m_spinBoxFactory->addPropertyManager(manager->subIntPropertyManager());
3003 d_ptr->m_comboBoxFactory->addPropertyManager(manager->subEnumPropertyManager());
3004 d_ptr->m_checkBoxFactory->addPropertyManager(manager->subBoolPropertyManager());
3005 }
3006
3007 QList<QtCursorPropertyManager*> cursorPropertyManagers =
3008 manager->findChildren<QtCursorPropertyManager*>();
3009 QListIterator<QtCursorPropertyManager*> itCursor(cursorPropertyManagers);
3010
3011 while (itCursor.hasNext())
3012 {
3013 d_ptr->m_cursorEditorFactory->addPropertyManager(itCursor.next());
3014 }
3015
3016 QList<QtFlagPropertyManager*> flagPropertyManagers =
3017 manager->findChildren<QtFlagPropertyManager*>();
3018 QListIterator<QtFlagPropertyManager*> itFlag(flagPropertyManagers);
3019
3020 while (itFlag.hasNext())
3021 {
3022 d_ptr->m_checkBoxFactory->addPropertyManager(itFlag.next()->subBoolPropertyManager());
3023 }
3024}
3025
3026/*!
3027 \internal
3028
3029 Reimplemented from the QtAbstractEditorFactory class.
3030*/
3031QWidget*
3033 QtProperty* property,
3034 QWidget* parent)
3035{
3036 const int propType = manager->propertyType(property);
3037 QtAbstractEditorFactoryBase* factory = d_ptr->m_typeToFactory.value(propType, 0);
3038
3039 if (!factory)
3040 {
3041 return 0;
3042 }
3043
3044 return factory->createEditor(wrappedProperty(property), parent);
3045}
3046
3047/*!
3048 \internal
3049
3050 Reimplemented from the QtAbstractEditorFactory class.
3051*/
3052void
3054{
3055 QList<QtIntPropertyManager*> intPropertyManagers =
3056 manager->findChildren<QtIntPropertyManager*>();
3057 QListIterator<QtIntPropertyManager*> itInt(intPropertyManagers);
3058
3059 while (itInt.hasNext())
3060 {
3061 d_ptr->m_spinBoxFactory->removePropertyManager(itInt.next());
3062 }
3063
3064 QList<QtDoublePropertyManager*> doublePropertyManagers =
3065 manager->findChildren<QtDoublePropertyManager*>();
3066 QListIterator<QtDoublePropertyManager*> itDouble(doublePropertyManagers);
3067
3068 while (itDouble.hasNext())
3069 {
3070 d_ptr->m_doubleSpinBoxFactory->removePropertyManager(itDouble.next());
3071 }
3072
3073 QList<QtBoolPropertyManager*> boolPropertyManagers =
3074 manager->findChildren<QtBoolPropertyManager*>();
3075 QListIterator<QtBoolPropertyManager*> itBool(boolPropertyManagers);
3076
3077 while (itBool.hasNext())
3078 {
3079 d_ptr->m_checkBoxFactory->removePropertyManager(itBool.next());
3080 }
3081
3082 QList<QtStringPropertyManager*> stringPropertyManagers =
3083 manager->findChildren<QtStringPropertyManager*>();
3084 QListIterator<QtStringPropertyManager*> itString(stringPropertyManagers);
3085
3086 while (itString.hasNext())
3087 {
3088 d_ptr->m_lineEditFactory->removePropertyManager(itString.next());
3089 }
3090
3091 QList<QtDatePropertyManager*> datePropertyManagers =
3092 manager->findChildren<QtDatePropertyManager*>();
3093 QListIterator<QtDatePropertyManager*> itDate(datePropertyManagers);
3094
3095 while (itDate.hasNext())
3096 {
3097 d_ptr->m_dateEditFactory->removePropertyManager(itDate.next());
3098 }
3099
3100 QList<QtTimePropertyManager*> timePropertyManagers =
3101 manager->findChildren<QtTimePropertyManager*>();
3102 QListIterator<QtTimePropertyManager*> itTime(timePropertyManagers);
3103
3104 while (itTime.hasNext())
3105 {
3106 d_ptr->m_timeEditFactory->removePropertyManager(itTime.next());
3107 }
3108
3109 QList<QtDateTimePropertyManager*> dateTimePropertyManagers =
3110 manager->findChildren<QtDateTimePropertyManager*>();
3111 QListIterator<QtDateTimePropertyManager*> itDateTime(dateTimePropertyManagers);
3112
3113 while (itDateTime.hasNext())
3114 {
3115 d_ptr->m_dateTimeEditFactory->removePropertyManager(itDateTime.next());
3116 }
3117
3118 QList<QtKeySequencePropertyManager*> keySequencePropertyManagers =
3119 manager->findChildren<QtKeySequencePropertyManager*>();
3120 QListIterator<QtKeySequencePropertyManager*> itKeySequence(keySequencePropertyManagers);
3121
3122 while (itKeySequence.hasNext())
3123 {
3124 d_ptr->m_keySequenceEditorFactory->removePropertyManager(itKeySequence.next());
3125 }
3126
3127 QList<QtCharPropertyManager*> charPropertyManagers =
3128 manager->findChildren<QtCharPropertyManager*>();
3129 QListIterator<QtCharPropertyManager*> itChar(charPropertyManagers);
3130
3131 while (itChar.hasNext())
3132 {
3133 d_ptr->m_charEditorFactory->removePropertyManager(itChar.next());
3134 }
3135
3136 QList<QtLocalePropertyManager*> localePropertyManagers =
3137 manager->findChildren<QtLocalePropertyManager*>();
3138 QListIterator<QtLocalePropertyManager*> itLocale(localePropertyManagers);
3139
3140 while (itLocale.hasNext())
3141 {
3142 d_ptr->m_comboBoxFactory->removePropertyManager(itLocale.next()->subEnumPropertyManager());
3143 }
3144
3145 QList<QtPointPropertyManager*> pointPropertyManagers =
3146 manager->findChildren<QtPointPropertyManager*>();
3147 QListIterator<QtPointPropertyManager*> itPoint(pointPropertyManagers);
3148
3149 while (itPoint.hasNext())
3150 {
3151 d_ptr->m_spinBoxFactory->removePropertyManager(itPoint.next()->subIntPropertyManager());
3152 }
3153
3154 QList<QtPointFPropertyManager*> pointFPropertyManagers =
3155 manager->findChildren<QtPointFPropertyManager*>();
3156 QListIterator<QtPointFPropertyManager*> itPointF(pointFPropertyManagers);
3157
3158 while (itPointF.hasNext())
3159 {
3160 d_ptr->m_doubleSpinBoxFactory->removePropertyManager(
3161 itPointF.next()->subDoublePropertyManager());
3162 }
3163
3164 QList<QtSizePropertyManager*> sizePropertyManagers =
3165 manager->findChildren<QtSizePropertyManager*>();
3166 QListIterator<QtSizePropertyManager*> itSize(sizePropertyManagers);
3167
3168 while (itSize.hasNext())
3169 {
3170 d_ptr->m_spinBoxFactory->removePropertyManager(itSize.next()->subIntPropertyManager());
3171 }
3172
3173 QList<QtSizeFPropertyManager*> sizeFPropertyManagers =
3174 manager->findChildren<QtSizeFPropertyManager*>();
3175 QListIterator<QtSizeFPropertyManager*> itSizeF(sizeFPropertyManagers);
3176
3177 while (itSizeF.hasNext())
3178 {
3179 d_ptr->m_doubleSpinBoxFactory->removePropertyManager(
3180 itSizeF.next()->subDoublePropertyManager());
3181 }
3182
3183 QList<QtRectPropertyManager*> rectPropertyManagers =
3184 manager->findChildren<QtRectPropertyManager*>();
3185 QListIterator<QtRectPropertyManager*> itRect(rectPropertyManagers);
3186
3187 while (itRect.hasNext())
3188 {
3189 d_ptr->m_spinBoxFactory->removePropertyManager(itRect.next()->subIntPropertyManager());
3190 }
3191
3192 QList<QtRectFPropertyManager*> rectFPropertyManagers =
3193 manager->findChildren<QtRectFPropertyManager*>();
3194 QListIterator<QtRectFPropertyManager*> itRectF(rectFPropertyManagers);
3195
3196 while (itRectF.hasNext())
3197 {
3198 d_ptr->m_doubleSpinBoxFactory->removePropertyManager(
3199 itRectF.next()->subDoublePropertyManager());
3200 }
3201
3202 QList<QtColorPropertyManager*> colorPropertyManagers =
3203 manager->findChildren<QtColorPropertyManager*>();
3204 QListIterator<QtColorPropertyManager*> itColor(colorPropertyManagers);
3205
3206 while (itColor.hasNext())
3207 {
3208 QtColorPropertyManager* manager = itColor.next();
3209 d_ptr->m_colorEditorFactory->removePropertyManager(manager);
3210 d_ptr->m_spinBoxFactory->removePropertyManager(manager->subIntPropertyManager());
3211 }
3212
3213 QList<QtEnumPropertyManager*> enumPropertyManagers =
3214 manager->findChildren<QtEnumPropertyManager*>();
3215 QListIterator<QtEnumPropertyManager*> itEnum(enumPropertyManagers);
3216
3217 while (itEnum.hasNext())
3218 {
3219 d_ptr->m_comboBoxFactory->removePropertyManager(itEnum.next());
3220 }
3221
3222 QList<QtSizePolicyPropertyManager*> sizePolicyPropertyManagers =
3223 manager->findChildren<QtSizePolicyPropertyManager*>();
3224 QListIterator<QtSizePolicyPropertyManager*> itSizePolicy(sizePolicyPropertyManagers);
3225
3226 while (itSizePolicy.hasNext())
3227 {
3228 QtSizePolicyPropertyManager* manager = itSizePolicy.next();
3229 d_ptr->m_spinBoxFactory->removePropertyManager(manager->subIntPropertyManager());
3230 d_ptr->m_comboBoxFactory->removePropertyManager(manager->subEnumPropertyManager());
3231 }
3232
3233 QList<QtFontPropertyManager*> fontPropertyManagers =
3234 manager->findChildren<QtFontPropertyManager*>();
3235 QListIterator<QtFontPropertyManager*> itFont(fontPropertyManagers);
3236
3237 while (itFont.hasNext())
3238 {
3239 QtFontPropertyManager* manager = itFont.next();
3240 d_ptr->m_fontEditorFactory->removePropertyManager(manager);
3241 d_ptr->m_spinBoxFactory->removePropertyManager(manager->subIntPropertyManager());
3242 d_ptr->m_comboBoxFactory->removePropertyManager(manager->subEnumPropertyManager());
3243 d_ptr->m_checkBoxFactory->removePropertyManager(manager->subBoolPropertyManager());
3244 }
3245
3246 QList<QtCursorPropertyManager*> cursorPropertyManagers =
3247 manager->findChildren<QtCursorPropertyManager*>();
3248 QListIterator<QtCursorPropertyManager*> itCursor(cursorPropertyManagers);
3249
3250 while (itCursor.hasNext())
3251 {
3252 d_ptr->m_cursorEditorFactory->removePropertyManager(itCursor.next());
3253 }
3254
3255 QList<QtFlagPropertyManager*> flagPropertyManagers =
3256 manager->findChildren<QtFlagPropertyManager*>();
3257 QListIterator<QtFlagPropertyManager*> itFlag(flagPropertyManagers);
3258
3259 while (itFlag.hasNext())
3260 {
3261 d_ptr->m_checkBoxFactory->removePropertyManager(itFlag.next()->subBoolPropertyManager());
3262 }
3263}
3264
3265QT_END_NAMESPACE
3266
3267#include "moc_qtvariantproperty.cpp"
QtAbstractEditorFactoryBase(QObject *parent=0)
virtual QWidget * createEditor(QtProperty *property, QWidget *parent)=0
The QtAbstractPropertyManager provides an interface for property managers.
QtAbstractPropertyManager(QObject *parent=0)
void propertyRemoved(QtProperty *property, QtProperty *parent)
QtProperty * addProperty(const QString &name=QString())
void propertyInserted(QtProperty *property, QtProperty *parent, QtProperty *after)
The QtBoolPropertyManager class provides and manages boolean properties.
The QtCharEditorFactory class provides editor widgets for properties created by QtCharPropertyManager...
The QtCharPropertyManager provides and manages QChar properties.
The QtCheckBoxFactory class provides QCheckBox widgets for properties created by QtBoolPropertyManage...
The QtColorEditorFactory class provides color editing for properties created by QtColorPropertyManage...
The QtColorPropertyManager provides and manages QColor properties.
QtIntPropertyManager * subIntPropertyManager() const
The QtCursorEditorFactory class provides QComboBox widgets for properties created by QtCursorProperty...
The QtCursorPropertyManager provides and manages QCursor properties.
The QtDateEditFactory class provides QDateEdit widgets for properties created by QtDatePropertyManage...
The QtDatePropertyManager provides and manages QDate properties.
The QtDateTimeEditFactory class provides QDateTimeEdit widgets for properties created by QtDateTimePr...
The QtDateTimePropertyManager provides and manages QDateTime properties.
The QtDoublePropertyManager provides and manages double properties.
The QtDoubleSpinBoxFactory class provides QDoubleSpinBox widgets for properties created by QtDoublePr...
The QtEnumEditorFactory class provides QComboBox widgets for properties created by QtEnumPropertyMana...
The QtEnumPropertyManager provides and manages enum properties.
The QtFlagPropertyManager provides and manages flag properties.
QtBoolPropertyManager * subBoolPropertyManager() const
The QtFontEditorFactory class provides font editing for properties created by QtFontPropertyManager o...
The QtFontPropertyManager provides and manages QFont properties.
QtIntPropertyManager * subIntPropertyManager() const
QtEnumPropertyManager * subEnumPropertyManager() const
QtBoolPropertyManager * subBoolPropertyManager() const
The QtGroupPropertyManager provides and manages group properties.
The QtIntPropertyManager provides and manages int properties.
The QtKeySequenceEditorFactory class provides editor widgets for properties created by QtKeySequenceP...
The QtKeySequencePropertyManager provides and manages QKeySequence properties.
The QtLineEditFactory class provides QLineEdit widgets for properties created by QtStringPropertyMana...
The QtLocalePropertyManager provides and manages QLocale properties.
QtEnumPropertyManager * subEnumPropertyManager() const
The QtPointFPropertyManager provides and manages QPointF properties.
QtDoublePropertyManager * subDoublePropertyManager() const
The QtPointPropertyManager provides and manages QPoint properties.
QtIntPropertyManager * subIntPropertyManager() const
The QtProperty class encapsulates an instance of a property.
QString propertyName() const
QIcon valueIcon() const
QString toolTip() const
QString valueText() const
void insertSubProperty(QtProperty *property, QtProperty *afterProperty)
QList< QtProperty * > subProperties() const
QString statusTip() const
QtAbstractPropertyManager * propertyManager() const
void setToolTip(const QString &text)
QString whatsThis() const
void setWhatsThis(const QString &text)
void setPropertyName(const QString &text)
void setStatusTip(const QString &text)
QString displayText() const
QtProperty(QtAbstractPropertyManager *manager)
The QtRectFPropertyManager provides and manages QRectF properties.
QtDoublePropertyManager * subDoublePropertyManager() const
The QtRectPropertyManager provides and manages QRect properties.
QtIntPropertyManager * subIntPropertyManager() const
The QtSizeFPropertyManager provides and manages QSizeF properties.
QtDoublePropertyManager * subDoublePropertyManager() const
The QtSizePolicyPropertyManager provides and manages QSizePolicy properties.
QtIntPropertyManager * subIntPropertyManager() const
QtEnumPropertyManager * subEnumPropertyManager() const
The QtSizePropertyManager provides and manages QSize properties.
QtIntPropertyManager * subIntPropertyManager() const
The QtSpinBoxFactory class provides QSpinBox widgets for properties created by QtIntPropertyManager o...
The QtStringPropertyManager provides and manages QString properties.
The QtTimeEditFactory class provides QTimeEdit widgets for properties created by QtTimePropertyManage...
The QtTimePropertyManager provides and manages QTime properties.
QtCharEditorFactory * m_charEditorFactory
QMap< QtAbstractEditorFactoryBase *, int > m_factoryToType
QMap< int, QtAbstractEditorFactoryBase * > m_typeToFactory
QtFontEditorFactory * m_fontEditorFactory
QtColorEditorFactory * m_colorEditorFactory
QtDateTimeEditFactory * m_dateTimeEditFactory
QtKeySequenceEditorFactory * m_keySequenceEditorFactory
QtCursorEditorFactory * m_cursorEditorFactory
QtDoubleSpinBoxFactory * m_doubleSpinBoxFactory
QtEnumEditorFactory * m_comboBoxFactory
The QtVariantEditorFactory class provides widgets for properties created by QtVariantPropertyManager ...
void connectPropertyManager(QtVariantPropertyManager *manager) override
void disconnectPropertyManager(QtVariantPropertyManager *manager) override
QWidget * createEditor(QtVariantPropertyManager *manager, QtProperty *property, QWidget *parent) override
QtVariantEditorFactory(QObject *parent=0)
QMap< int, QMap< QString, int > > m_typeToAttributeToAttributeType
void slotPropertyRemoved(QtProperty *property, QtProperty *parent)
void slotPropertyInserted(QtProperty *property, QtProperty *parent, QtProperty *after)
void slotRegExpChanged(QtProperty *property, const QRegExp &regExp)
void slotSingleStepChanged(QtProperty *property, int step)
void slotFlagChanged(QtProperty *property, int val)
void slotRangeChanged(QtProperty *property, int min, int max)
void slotTextVisibleChanged(QtProperty *property, bool textVisible)
void slotEnumChanged(QtProperty *property, int val)
void slotDecimalsChanged(QtProperty *property, int prec)
QMap< int, QtAbstractPropertyManager * > m_typeToPropertyManager
int internalPropertyToType(QtProperty *property) const
void slotEchoModeChanged(QtProperty *property, int)
void valueChanged(QtProperty *property, const QVariant &val)
void slotReadOnlyChanged(QtProperty *property, bool readOnly)
QMap< const QtProperty *, QPair< QtVariantProperty *, int > > m_propertyToType
void slotEnumIconsChanged(QtProperty *property, const QMap< int, QIcon > &enumIcons)
QtVariantProperty * createSubProperty(QtVariantProperty *parent, QtVariantProperty *after, QtProperty *internal)
void slotEnumNamesChanged(QtProperty *property, const QStringList &enumNames)
void removeSubProperty(QtVariantProperty *property)
void slotFlagNamesChanged(QtProperty *property, const QStringList &flagNames)
void slotValueChanged(QtProperty *property, int val)
void slotConstraintChanged(QtProperty *property, const QRect &val)
QMap< QtProperty *, QtVariantProperty * > m_internalToProperty
The QtVariantPropertyManager class provides and manages QVariant based properties.
void initializeProperty(QtProperty *property) override
virtual QtVariantProperty * addProperty(int propertyType, const QString &name=QString())
bool hasValue(const QtProperty *property) const override
QtVariantProperty * variantProperty(const QtProperty *property) const
virtual QVariant value(const QtProperty *property) const
QtVariantPropertyManager(QObject *parent=0)
QtProperty * createProperty() override
virtual int attributeType(int propertyType, const QString &attribute) const
virtual QVariant attributeValue(const QtProperty *property, const QString &attribute) const
virtual void setValue(QtProperty *property, const QVariant &val)
QIcon valueIcon(const QtProperty *property) const override
void valueChanged(QtProperty *property, const QVariant &val)
void uninitializeProperty(QtProperty *property) override
virtual void setAttribute(QtProperty *property, const QString &attribute, const QVariant &value)
virtual bool isPropertyTypeSupported(int propertyType) const
virtual QStringList attributes(int propertyType) const
int propertyType(const QtProperty *property) const
QString valueText(const QtProperty *property) const override
int valueType(const QtProperty *property) const
QtVariantPropertyPrivate(QtVariantPropertyManager *m)
QtVariantPropertyManager * manager
The QtVariantProperty class is a convenience class handling QVariant based properties.
QVariant value() const
QtVariantProperty(QtVariantPropertyManager *manager)
void setAttribute(const QString &attribute, const QVariant &value)
friend class QtVariantPropertyManager
QVariant attributeValue(const QString &attribute) const
void setValue(const QVariant &value)
T min(T t1, T t2)
Definition gdiam.h:44
T max(T t1, T t2)
Definition gdiam.h:51
QLineEdit::EchoMode EchoMode
QMap< const QtProperty *, QtProperty * > PropertyMap
QMap< int, QIcon > QtIconMap