diff options
author | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-06-04 09:26:33 (GMT) |
---|---|---|
committer | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-06-04 09:26:33 (GMT) |
commit | 95c0a8de7af1e631485117f5764f4e2677ec6d0b (patch) | |
tree | 9f1fd8726b7f33a6958f3cf395c3ea1300c2d580 /tools/designer/src/lib/uilib/formbuilder.cpp | |
parent | a800e1d5e7fa69a3bfa21d74c5db47f5a41ed65c (diff) | |
parent | 397c3bb494e220af5ef1cf6e47cfdfc84b61540b (diff) | |
download | Qt-95c0a8de7af1e631485117f5764f4e2677ec6d0b.zip Qt-95c0a8de7af1e631485117f5764f4e2677ec6d0b.tar.gz Qt-95c0a8de7af1e631485117f5764f4e2677ec6d0b.tar.bz2 |
Merge commit 'mainline/master' into kinetic-declarativeui
Conflicts:
configure.exe
src/gui/math3d/qmatrix4x4.cpp
src/gui/math3d/qmatrix4x4.h
tools/qdoc3/htmlgenerator.cpp
Diffstat (limited to 'tools/designer/src/lib/uilib/formbuilder.cpp')
-rw-r--r-- | tools/designer/src/lib/uilib/formbuilder.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/tools/designer/src/lib/uilib/formbuilder.cpp b/tools/designer/src/lib/uilib/formbuilder.cpp index 414eb14..53d1e9d 100644 --- a/tools/designer/src/lib/uilib/formbuilder.cpp +++ b/tools/designer/src/lib/uilib/formbuilder.cpp @@ -120,7 +120,10 @@ QFormBuilder::~QFormBuilder() */ QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget) { - QFormBuilderExtra::instance(this)->setProcessingLayoutWidget(false); + QFormBuilderExtra *fb = QFormBuilderExtra::instance(this); + if (!fb->parentWidgetIsSet()) + fb->setParentWidget(parentWidget); + fb->setProcessingLayoutWidget(false); if (ui_widget->attributeClass() == QFormBuilderStrings::instance().qWidgetClass && !ui_widget->hasAttributeNative() && parentWidget #ifndef QT_NO_MAINWINDOW @@ -145,7 +148,7 @@ QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget) && !qobject_cast<QDockWidget *>(parentWidget) #endif ) - QFormBuilderExtra::instance(this)->setProcessingLayoutWidget(true); + fb->setProcessingLayoutWidget(true); return QAbstractFormBuilder::create(ui_widget, parentWidget); } @@ -228,9 +231,6 @@ QWidget *QFormBuilder::createWidget(const QString &widgetName, QWidget *parentWi if (qobject_cast<QDialog *>(w)) w->setParent(parentWidget); - if (!fb->rootWidget()) - fb->setRootWidget(w); - return w; } @@ -369,9 +369,10 @@ QWidget *QFormBuilder::create(DomUI *ui, QWidget *parentWidget) */ QLayout *QFormBuilder::create(DomLayout *ui_layout, QLayout *layout, QWidget *parentWidget) { + QFormBuilderExtra *fb = QFormBuilderExtra::instance(this); // Is this a temporary layout widget used to represent QLayout hierarchies in Designer? // Set its margins to 0. - bool layoutWidget = QFormBuilderExtra::instance(this)->processingLayoutWidget(); + bool layoutWidget = fb->processingLayoutWidget(); QLayout *l = QAbstractFormBuilder::create(ui_layout, layout, parentWidget); if (layoutWidget) { const QFormBuilderStrings &strings = QFormBuilderStrings::instance(); @@ -392,7 +393,7 @@ QLayout *QFormBuilder::create(DomLayout *ui_layout, QLayout *layout, QWidget *pa bottom = prop->elementNumber(); l->setContentsMargins(left, top, right, bottom); - QFormBuilderExtra::instance(this)->setProcessingLayoutWidget(false); + fb->setProcessingLayoutWidget(false); } return l; } @@ -525,6 +526,7 @@ QList<QDesignerCustomWidgetInterface*> QFormBuilder::customWidgets() const /*! \internal */ + void QFormBuilder::applyProperties(QObject *o, const QList<DomProperty*> &properties) { typedef QList<DomProperty*> DomPropertyList; @@ -542,11 +544,12 @@ void QFormBuilder::applyProperties(QObject *o, const QList<DomProperty*> &proper continue; const QString attributeName = (*it)->attributeName(); - if (o == fb->rootWidget() && attributeName == strings.geometryProperty) { - // apply only the size for the rootWidget - fb->rootWidget()->resize(qvariant_cast<QRect>(v).size()); + const bool isWidget = o->isWidgetType(); + if (isWidget && o->parent() == fb->parentWidget() && attributeName == strings.geometryProperty) { + // apply only the size part of a geometry for the root widget + static_cast<QWidget*>(o)->resize(qvariant_cast<QRect>(v).size()); } else if (fb->applyPropertyInternally(o, attributeName, v)) { - } else if (!qstrcmp("QFrame", o->metaObject()->className ()) && attributeName == strings.orientationProperty) { + } else if (isWidget && !qstrcmp("QFrame", o->metaObject()->className ()) && attributeName == strings.orientationProperty) { // ### special-casing for Line (QFrame) -- try to fix me o->setProperty("frameShape", v); // v is of QFrame::Shape enum } else { |