summaryrefslogtreecommitdiffstats
path: root/tools/designer/src/lib/uilib/formbuilder.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2009-05-29 12:52:44 (GMT)
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>2009-05-29 12:52:44 (GMT)
commit4b00e265388ed09017702489437c79e0b1a19a44 (patch)
treee9349498caa5d11ee32d3f250f06ab5ffb026eae /tools/designer/src/lib/uilib/formbuilder.cpp
parent7fc1d12ebd103539168be590b1cde91d49a3d75b (diff)
downloadQt-4b00e265388ed09017702489437c79e0b1a19a44.zip
Qt-4b00e265388ed09017702489437c79e0b1a19a44.tar.gz
Qt-4b00e265388ed09017702489437c79e0b1a19a44.tar.bz2
Enable overriding of the factory functions of QUiLoader.
Move initialization of QAction/QActionGroups elsewhere. Detect the root widget by checking its parent against the parent widget passed in and apply only the size part of the geometry property to it. Task-number: 254824 Initial-patch-by: joao <joao@abecasis.name>
Diffstat (limited to 'tools/designer/src/lib/uilib/formbuilder.cpp')
-rw-r--r--tools/designer/src/lib/uilib/formbuilder.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/tools/designer/src/lib/uilib/formbuilder.cpp b/tools/designer/src/lib/uilib/formbuilder.cpp
index 5a771b7..53d1e9d 100644
--- a/tools/designer/src/lib/uilib/formbuilder.cpp
+++ b/tools/designer/src/lib/uilib/formbuilder.cpp
@@ -121,6 +121,8 @@ QFormBuilder::~QFormBuilder()
QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget)
{
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
@@ -229,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;
}
@@ -527,6 +526,7 @@ QList<QDesignerCustomWidgetInterface*> QFormBuilder::customWidgets() const
/*!
\internal
*/
+
void QFormBuilder::applyProperties(QObject *o, const QList<DomProperty*> &properties)
{
typedef QList<DomProperty*> DomPropertyList;
@@ -544,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 {