diff options
author | Jarek Kobus <jkobus@trolltech.com> | 2010-04-13 13:25:16 (GMT) |
---|---|---|
committer | Jarek Kobus <jkobus@trolltech.com> | 2010-04-13 13:25:16 (GMT) |
commit | 2ff6df50fac75af2d1b9d49101d9b1d8af28535d (patch) | |
tree | cdcf1ad38316ccf1488509b174a8c0a1beb2215e /tools/designer/src/lib | |
parent | 24eec1960e0dc3594bd8ff77a8f329207a669056 (diff) | |
download | Qt-2ff6df50fac75af2d1b9d49101d9b1d8af28535d.zip Qt-2ff6df50fac75af2d1b9d49101d9b1d8af28535d.tar.gz Qt-2ff6df50fac75af2d1b9d49101d9b1d8af28535d.tar.bz2 |
Fix dealing with the default dynamic properties of string type.
Fixed showing, changing and resetting of default dynamic properties
of string and keysequence type.
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Task-number: QTBUG-9603
Diffstat (limited to 'tools/designer/src/lib')
-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 77ab2a6..08fedd2 100644 --- a/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp +++ b/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp @@ -722,10 +722,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); @@ -1130,7 +1131,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)) @@ -1200,10 +1201,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()) { |