diff options
-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)) { |