diff options
author | Jarek Kobus <jkobus@trolltech.com> | 2010-04-13 13:25:16 (GMT) |
---|---|---|
committer | Samuli Piippo <samuli.piippo@digia.com> | 2011-06-09 10:05:38 (GMT) |
commit | 632b69b6ef1318fede89a0a3fd46a29bd6c27fe5 (patch) | |
tree | a6179485c798642abbf2bfd736e2f894fbcecc4e | |
parent | d8e9405684d340f326dc43ac04a1ad737fd4bfac (diff) | |
download | Qt-632b69b6ef1318fede89a0a3fd46a29bd6c27fe5.zip Qt-632b69b6ef1318fede89a0a3fd46a29bd6c27fe5.tar.gz Qt-632b69b6ef1318fede89a0a3fd46a29bd6c27fe5.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
(cherry picked from commit 2ff6df50fac75af2d1b9d49101d9b1d8af28535d)
-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()) { |