diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-03-21 14:54:49 (GMT) |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-03-21 14:54:49 (GMT) |
commit | 8a9dd3f463a312963dc420ee83ca75fd52e24463 (patch) | |
tree | a333c84a41aa87a8bd4f01b805c67c7014c63b36 /tools/designer | |
parent | 3d91f9a971990324ef1d785c9c0b8bbed1175711 (diff) | |
download | Qt-8a9dd3f463a312963dc420ee83ca75fd52e24463.zip Qt-8a9dd3f463a312963dc420ee83ca75fd52e24463.tar.gz Qt-8a9dd3f463a312963dc420ee83ca75fd52e24463.tar.bz2 |
Designer: Remember default of main container's object name.
as a default property value. Users can then safely reset it
to its original value. The default-generated name previously
led to the uic-generated file names to be different,
causing build errors in IDE's.
Task-number: QTBUG-18256
Diffstat (limited to 'tools/designer')
-rw-r--r-- | tools/designer/src/components/formeditor/qdesigner_resource.cpp | 5 | ||||
-rw-r--r-- | tools/designer/src/lib/shared/qdesigner_propertysheet.cpp | 13 |
2 files changed, 15 insertions, 3 deletions
diff --git a/tools/designer/src/components/formeditor/qdesigner_resource.cpp b/tools/designer/src/components/formeditor/qdesigner_resource.cpp index 714a556..005459b 100644 --- a/tools/designer/src/components/formeditor/qdesigner_resource.cpp +++ b/tools/designer/src/components/formeditor/qdesigner_resource.cpp @@ -741,7 +741,10 @@ QWidget *QDesignerResource::load(QIODevice *dev, QWidget *parentWidget) case LoadPreCheckOk: break; } - return QEditorFormBuilder::load(dev, parentWidget); + QWidget *w = QEditorFormBuilder::load(dev, parentWidget); + if (w) // Store the class name as 'reset' value for the main container's object name. + w->setProperty("_q_classname", w->objectName()); + return w; } bool QDesignerResource::saveRelative() const diff --git a/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp b/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp index babe20e..27527da 100644 --- a/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp +++ b/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp @@ -1195,8 +1195,17 @@ bool QDesignerPropertySheet::reset(int index) { if (d->invalidIndex(Q_FUNC_INFO, index)) return false; - if (d->isStringProperty(index)) - setProperty(index, QVariant::fromValue(qdesigner_internal::PropertySheetStringValue())); + if (d->isStringProperty(index)) { + qdesigner_internal::PropertySheetStringValue value; + // Main container: Reset to stored class name as not to change the file names generated by uic. + if (propertyName(index) == QLatin1String("objectName")) { + const QVariant classNameDefaultV = d->m_object->property("_q_classname"); + if (classNameDefaultV.isValid()) + value.setValue(classNameDefaultV.toString()); + } + setProperty(index, QVariant::fromValue(value)); + return true; + } if (d->isKeySequenceProperty(index)) setProperty(index, QVariant::fromValue(qdesigner_internal::PropertySheetKeySequenceValue())); if (d->isResourceProperty(index)) { |