diff options
-rw-r--r-- | tools/designer/src/lib/shared/qdesigner_propertysheet.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp b/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp index 4a93673..bf2f47f 100644 --- a/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp +++ b/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp @@ -719,10 +719,11 @@ int QDesignerPropertySheet::addDynamicProperty(const QString &propName, const QV else if (value.type() == QVariant::Pixmap) v = qVariantFromValue(qdesigner_internal::PropertySheetPixmapValue()); else if (value.type() == QVariant::String) - v = qVariantFromValue(qdesigner_internal::PropertySheetStringValue()); - else if (value.type() == QVariant::KeySequence) - v = qVariantFromValue(qdesigner_internal::PropertySheetKeySequenceValue()); - + v = qVariantFromValue(qdesigner_internal::PropertySheetStringValue(value.toString())); + else if (value.type() == QVariant::KeySequence) { + const QKeySequence keySequence = qVariantValue<QKeySequence>(value); + v = qVariantFromValue(qdesigner_internal::PropertySheetKeySequenceValue(keySequence)); + } if (d->m_addIndex.contains(propName)) { const int idx = d->m_addIndex.value(propName); @@ -1127,7 +1128,7 @@ void QDesignerPropertySheet::setProperty(int index, const QVariant &value) } } - if (isDynamicProperty(index)) { + if (isDynamicProperty(index) || isDefaultDynamicProperty(index)) { if (d->isResourceProperty(index)) d->setResourceProperty(index, value); if (d->isStringProperty(index)) @@ -1197,10 +1198,17 @@ bool QDesignerPropertySheet::reset(int index) } else if (isDynamic(index)) { const QString propName = propertyName(index); const QVariant oldValue = d->m_addProperties.value(index); - const QVariant newValue = d->m_info.value(index).defaultValue; + const QVariant defaultValue = d->m_info.value(index).defaultValue; + QVariant newValue = defaultValue; + if (d->isStringProperty(index)) { + newValue = qVariantFromValue(qdesigner_internal::PropertySheetStringValue(newValue.toString())); + } else if (d->isKeySequenceProperty(index)) { + const QKeySequence keySequence = qVariantValue<QKeySequence>(newValue); + newValue = qVariantFromValue(qdesigner_internal::PropertySheetKeySequenceValue(keySequence)); + } if (oldValue == newValue) return true; - d->m_object->setProperty(propName.toUtf8(), newValue); + d->m_object->setProperty(propName.toUtf8(), defaultValue); d->m_addProperties[index] = newValue; return true; } else if (!d->m_info.value(index).defaultValue.isNull()) { |