32 QList<OptionalEdit*> editors = editorToProperty.keys();
33 QListIterator<OptionalEdit*> it(editors);
47 connect(manager, SIGNAL(valueChanged(
QtProperty*,
const QVariant&)),
48 this, SLOT(slotPropertyChanged(
QtProperty*,
const QVariant&)));
49 connect(manager, SIGNAL(attributeChanged(
QtProperty*,
const QString&,
const QVariant&)),
50 this, SLOT(slotPropertyAttributeChanged(
QtProperty*,
const QString&,
const QVariant&)));
73 createdEditors[property].append(editor);
74 editorToProperty[editor] = property;
77 connect(editor, SIGNAL(valueChanged(QString)),
78 this, SLOT(slotSetValue(
const QString&)));
79 connect(editor, SIGNAL(enabledChanged(
bool)),
80 this, SLOT(slotSetEnabled(
const bool&)));
81 connect(editor, SIGNAL(destroyed(QObject*)),
82 this, SLOT(slotEditorDestroyed(QObject*)));
90 disconnect(manager, SIGNAL(valueChanged(
QtProperty*,
const QVariant&)),
91 this, SLOT(slotPropertyChanged(
QtProperty*,
const QVariant&)));
92 disconnect(manager, SIGNAL(attributeChanged(
QtProperty*,
const QString&,
const QVariant&)),
93 this, SLOT(slotPropertyAttributeChanged(
QtProperty*,
const QString&,
const QVariant&)));
97 void OptionalVariantFactory::slotPropertyChanged(
QtProperty* property,
98 const QVariant&
value)
100 if (!createdEditors.contains(property))
105 QList<OptionalEdit*> editors = createdEditors[property];
106 QListIterator<OptionalEdit*> itEditor(editors);
107 while (itEditor.hasNext())
109 itEditor.next()->setValue(
value.toString());
113 void OptionalVariantFactory::slotPropertyAttributeChanged(
QtProperty* property,
114 const QString& attribute,
const QVariant&
value)
116 if (!createdEditors.contains(property))
121 if (attribute == QLatin1String(
"enabled"))
123 QList<OptionalEdit*> editors = createdEditors[property];
124 QListIterator<OptionalEdit*> itEditor(editors);
125 while (itEditor.hasNext())
127 itEditor.next()->setPropertyEnabled(
value.toBool());
131 if (attribute == QLatin1String(
"readOnly"))
133 QList<OptionalEdit*> editors = createdEditors[property];
134 QListIterator<OptionalEdit*> itEditor(editors);
135 while (itEditor.hasNext())
137 itEditor.next()->setReadOnly(
value.toBool());
142 void OptionalVariantFactory::slotSetValue(
const QString&
value)
144 QObject*
object = sender();
145 QMap<OptionalEdit*, QtProperty*>::ConstIterator itEditor =
146 editorToProperty.constBegin();
147 while (itEditor != editorToProperty.constEnd())
149 if (itEditor.key() ==
object)
164 void OptionalVariantFactory::slotSetEnabled(
const bool&
value)
166 QObject*
object = sender();
167 QMap<OptionalEdit*, QtProperty*>::ConstIterator itEditor =
168 editorToProperty.constBegin();
169 while (itEditor != editorToProperty.constEnd())
171 if (itEditor.key() ==
object)
186 void OptionalVariantFactory::slotEditorDestroyed(QObject*
object)
188 QMap<OptionalEdit*, QtProperty*>::ConstIterator itEditor =
189 editorToProperty.constBegin();
190 while (itEditor != editorToProperty.constEnd())
192 if (itEditor.key() ==
object)
196 editorToProperty.remove(editor);
197 createdEditors[property].removeAll(editor);
198 if (createdEditors[property].isEmpty())
200 createdEditors.remove(property);