575 QtVariantPropertyManager(parent), |
575 QtVariantPropertyManager(parent), |
576 m_changingSubValue(false), |
576 m_changingSubValue(false), |
577 m_core(core), |
577 m_core(core), |
578 m_sourceOfChange(0) |
578 m_sourceOfChange(0) |
579 { |
579 { |
580 connect(this, SIGNAL(valueChanged(QtProperty*,QVariant)), this, SLOT(slotValueChanged(QtProperty*, QVariant))); |
580 connect(this, SIGNAL(valueChanged(QtProperty*,QVariant)), this, SLOT(slotValueChanged(QtProperty*,QVariant))); |
581 connect(this, SIGNAL(propertyDestroyed(QtProperty*)), this, SLOT(slotPropertyDestroyed(QtProperty*))); |
581 connect(this, SIGNAL(propertyDestroyed(QtProperty*)), this, SLOT(slotPropertyDestroyed(QtProperty*))); |
582 } |
582 } |
583 |
583 |
584 DesignerPropertyManager::~DesignerPropertyManager() |
584 DesignerPropertyManager::~DesignerPropertyManager() |
585 { |
585 { |
2215 const QVariant richTextDefaultFont = manager->attributeValue(property, QLatin1String(fontAttributeC)); |
2215 const QVariant richTextDefaultFont = manager->attributeValue(property, QLatin1String(fontAttributeC)); |
2216 if (richTextDefaultFont.type() == QVariant::Font) |
2216 if (richTextDefaultFont.type() == QVariant::Font) |
2217 ed->setRichTextDefaultFont(qvariant_cast<QFont>(richTextDefaultFont)); |
2217 ed->setRichTextDefaultFont(qvariant_cast<QFont>(richTextDefaultFont)); |
2218 m_stringPropertyToEditors[property].append(ed); |
2218 m_stringPropertyToEditors[property].append(ed); |
2219 m_editorToStringProperty[ed] = property; |
2219 m_editorToStringProperty[ed] = property; |
2220 connect(ed, SIGNAL(destroyed(QObject *)), this, SLOT(slotEditorDestroyed(QObject *))); |
2220 connect(ed, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); |
2221 connect(ed, SIGNAL(textChanged(QString)), this, SLOT(slotStringTextChanged(QString))); |
2221 connect(ed, SIGNAL(textChanged(QString)), this, SLOT(slotStringTextChanged(QString))); |
2222 editor = ed; |
2222 editor = ed; |
2223 } |
2223 } |
2224 break; |
2224 break; |
2225 case QVariant::Palette: { |
2225 case QVariant::Palette: { |
2300 ed->setPath(qvariant_cast<PropertySheetPixmapValue>(manager->value(property)).path()); |
2300 ed->setPath(qvariant_cast<PropertySheetPixmapValue>(manager->value(property)).path()); |
2301 ed->setDefaultPixmap(qvariant_cast<QPixmap>(manager->attributeValue(property, QLatin1String(defaultResourceAttributeC)))); |
2301 ed->setDefaultPixmap(qvariant_cast<QPixmap>(manager->attributeValue(property, QLatin1String(defaultResourceAttributeC)))); |
2302 ed->setSpacing(m_spacing); |
2302 ed->setSpacing(m_spacing); |
2303 m_pixmapPropertyToEditors[property].append(ed); |
2303 m_pixmapPropertyToEditors[property].append(ed); |
2304 m_editorToPixmapProperty[ed] = property; |
2304 m_editorToPixmapProperty[ed] = property; |
2305 connect(ed, SIGNAL(destroyed(QObject *)), this, SLOT(slotEditorDestroyed(QObject *))); |
2305 connect(ed, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); |
2306 connect(ed, SIGNAL(pathChanged(const QString &)), this, SLOT(slotPixmapChanged(const QString &))); |
2306 connect(ed, SIGNAL(pathChanged(QString)), this, SLOT(slotPixmapChanged(QString))); |
2307 editor = ed; |
2307 editor = ed; |
2308 } else if (type == DesignerPropertyManager::designerIconTypeId()) { |
2308 } else if (type == DesignerPropertyManager::designerIconTypeId()) { |
2309 PixmapEditor *ed = new PixmapEditor(m_core, parent); |
2309 PixmapEditor *ed = new PixmapEditor(m_core, parent); |
2310 ed->setPixmapCache(m_fwb->pixmapCache()); |
2310 ed->setPixmapCache(m_fwb->pixmapCache()); |
2311 PropertySheetIconValue value = qvariant_cast<PropertySheetIconValue>(manager->value(property)); |
2311 PropertySheetIconValue value = qvariant_cast<PropertySheetIconValue>(manager->value(property)); |
2317 defaultPixmap = m_fwb->iconCache()->icon(value).pixmap(16, 16); |
2317 defaultPixmap = m_fwb->iconCache()->icon(value).pixmap(16, 16); |
2318 ed->setDefaultPixmap(defaultPixmap); |
2318 ed->setDefaultPixmap(defaultPixmap); |
2319 ed->setSpacing(m_spacing); |
2319 ed->setSpacing(m_spacing); |
2320 m_iconPropertyToEditors[property].append(ed); |
2320 m_iconPropertyToEditors[property].append(ed); |
2321 m_editorToIconProperty[ed] = property; |
2321 m_editorToIconProperty[ed] = property; |
2322 connect(ed, SIGNAL(destroyed(QObject *)), this, SLOT(slotEditorDestroyed(QObject *))); |
2322 connect(ed, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); |
2323 connect(ed, SIGNAL(pathChanged(const QString &)), this, SLOT(slotIconChanged(const QString &))); |
2323 connect(ed, SIGNAL(pathChanged(QString)), this, SLOT(slotIconChanged(QString))); |
2324 editor = ed; |
2324 editor = ed; |
2325 } else if (type == DesignerPropertyManager::designerStringTypeId()) { |
2325 } else if (type == DesignerPropertyManager::designerStringTypeId()) { |
2326 const TextPropertyValidationMode tvm = static_cast<TextPropertyValidationMode>(manager->attributeValue(property, QLatin1String(validationModesAttributeC)).toInt()); |
2326 const TextPropertyValidationMode tvm = static_cast<TextPropertyValidationMode>(manager->attributeValue(property, QLatin1String(validationModesAttributeC)).toInt()); |
2327 TextEditor *ed = createTextEditor(parent, tvm, qVariantValue<PropertySheetStringValue>(manager->value(property)).value()); |
2327 TextEditor *ed = createTextEditor(parent, tvm, qVariantValue<PropertySheetStringValue>(manager->value(property)).value()); |
2328 const QVariant richTextDefaultFont = manager->attributeValue(property, QLatin1String(fontAttributeC)); |
2328 const QVariant richTextDefaultFont = manager->attributeValue(property, QLatin1String(fontAttributeC)); |
2329 if (richTextDefaultFont.type() == QVariant::Font) |
2329 if (richTextDefaultFont.type() == QVariant::Font) |
2330 ed->setRichTextDefaultFont(qvariant_cast<QFont>(richTextDefaultFont)); |
2330 ed->setRichTextDefaultFont(qvariant_cast<QFont>(richTextDefaultFont)); |
2331 m_stringPropertyToEditors[property].append(ed); |
2331 m_stringPropertyToEditors[property].append(ed); |
2332 m_editorToStringProperty[ed] = property; |
2332 m_editorToStringProperty[ed] = property; |
2333 connect(ed, SIGNAL(destroyed(QObject *)), this, SLOT(slotEditorDestroyed(QObject *))); |
2333 connect(ed, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); |
2334 connect(ed, SIGNAL(textChanged(QString)), this, SLOT(slotStringTextChanged(QString))); |
2334 connect(ed, SIGNAL(textChanged(QString)), this, SLOT(slotStringTextChanged(QString))); |
2335 editor = ed; |
2335 editor = ed; |
2336 } else if (type == DesignerPropertyManager::designerKeySequenceTypeId()) { |
2336 } else if (type == DesignerPropertyManager::designerKeySequenceTypeId()) { |
2337 QtKeySequenceEdit *ed = new QtKeySequenceEdit(parent); |
2337 QtKeySequenceEdit *ed = new QtKeySequenceEdit(parent); |
2338 ed->setKeySequence(qVariantValue<PropertySheetKeySequenceValue>(manager->value(property)).value()); |
2338 ed->setKeySequence(qVariantValue<PropertySheetKeySequenceValue>(manager->value(property)).value()); |
2339 m_keySequencePropertyToEditors[property].append(ed); |
2339 m_keySequencePropertyToEditors[property].append(ed); |
2340 m_editorToKeySequenceProperty[ed] = property; |
2340 m_editorToKeySequenceProperty[ed] = property; |
2341 connect(ed, SIGNAL(destroyed(QObject *)), this, SLOT(slotEditorDestroyed(QObject *))); |
2341 connect(ed, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); |
2342 connect(ed, SIGNAL(keySequenceChanged(QKeySequence)), this, SLOT(slotKeySequenceChanged(QKeySequence))); |
2342 connect(ed, SIGNAL(keySequenceChanged(QKeySequence)), this, SLOT(slotKeySequenceChanged(QKeySequence))); |
2343 editor = ed; |
2343 editor = ed; |
2344 } else { |
2344 } else { |
2345 editor = QtVariantEditorFactory::createEditor(manager, property, parent); |
2345 editor = QtVariantEditorFactory::createEditor(manager, property, parent); |
2346 } |
2346 } |
2525 delete it.next(); |
2525 delete it.next(); |
2526 } |
2526 } |
2527 |
2527 |
2528 void ResetDecorator::connectPropertyManager(QtAbstractPropertyManager *manager) |
2528 void ResetDecorator::connectPropertyManager(QtAbstractPropertyManager *manager) |
2529 { |
2529 { |
2530 connect(manager, SIGNAL(propertyChanged(QtProperty *)), |
2530 connect(manager, SIGNAL(propertyChanged(QtProperty*)), |
2531 this, SLOT(slotPropertyChanged(QtProperty *))); |
2531 this, SLOT(slotPropertyChanged(QtProperty*))); |
2532 } |
2532 } |
2533 |
2533 |
2534 void ResetDecorator::disconnectPropertyManager(QtAbstractPropertyManager *manager) |
2534 void ResetDecorator::disconnectPropertyManager(QtAbstractPropertyManager *manager) |
2535 { |
2535 { |
2536 disconnect(manager, SIGNAL(propertyChanged(QtProperty *)), |
2536 disconnect(manager, SIGNAL(propertyChanged(QtProperty*)), |
2537 this, SLOT(slotPropertyChanged(QtProperty *))); |
2537 this, SLOT(slotPropertyChanged(QtProperty*))); |
2538 } |
2538 } |
2539 |
2539 |
2540 void ResetDecorator::setSpacing(int spacing) |
2540 void ResetDecorator::setSpacing(int spacing) |
2541 { |
2541 { |
2542 m_spacing = spacing; |
2542 m_spacing = spacing; |
2554 resetWidget->setResetEnabled(property->isModified()); |
2554 resetWidget->setResetEnabled(property->isModified()); |
2555 resetWidget->setValueText(property->valueText()); |
2555 resetWidget->setValueText(property->valueText()); |
2556 resetWidget->setValueIcon(property->valueIcon()); |
2556 resetWidget->setValueIcon(property->valueIcon()); |
2557 resetWidget->setAutoFillBackground(true); |
2557 resetWidget->setAutoFillBackground(true); |
2558 connect(resetWidget, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); |
2558 connect(resetWidget, SIGNAL(destroyed(QObject*)), this, SLOT(slotEditorDestroyed(QObject*))); |
2559 connect(resetWidget, SIGNAL(resetProperty(QtProperty *)), this, SIGNAL(resetProperty(QtProperty *))); |
2559 connect(resetWidget, SIGNAL(resetProperty(QtProperty*)), this, SIGNAL(resetProperty(QtProperty*))); |
2560 m_createdResetWidgets[property].append(resetWidget); |
2560 m_createdResetWidgets[property].append(resetWidget); |
2561 m_resetWidgetToProperty[resetWidget] = property; |
2561 m_resetWidgetToProperty[resetWidget] = property; |
2562 } |
2562 } |
2563 if (subEditor) { |
2563 if (subEditor) { |
2564 if (resetWidget) { |
2564 if (resetWidget) { |