Changeset 561 for trunk/tools/designer/src/lib/uilib/formbuilder.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/tools/designer/src/lib/uilib/formbuilder.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the Qt Designer of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 58 58 59 59 \brief The QFormBuilder class is used to dynamically construct 60 user interfaces from .uifiles at run-time.60 user interfaces from files at run-time. 61 61 62 62 \inmodule QtDesigner 63 63 64 64 The QFormBuilder class provides a mechanism for dynamically 65 creating user interfaces at run-time, based on \c{.ui}files65 creating user interfaces at run-time, based on files 66 66 created with \QD. For example: 67 67 … … 121 121 QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget) 122 122 { 123 QFormBuilderExtra::instance(this)->setProcessingLayoutWidget(false); 123 QFormBuilderExtra *fb = QFormBuilderExtra::instance(this); 124 if (!fb->parentWidgetIsSet()) 125 fb->setParentWidget(parentWidget); 126 // Is this a QLayoutWidget with a margin of 0: Not a known page-based 127 // container and no method for adding pages registered. 128 fb->setProcessingLayoutWidget(false); 124 129 if (ui_widget->attributeClass() == QFormBuilderStrings::instance().qWidgetClass && !ui_widget->hasAttributeNative() 125 130 && parentWidget … … 145 150 && !qobject_cast<QDockWidget *>(parentWidget) 146 151 #endif 147 ) 148 QFormBuilderExtra::instance(this)->setProcessingLayoutWidget(true); 152 ) { 153 const QString parentClassName = QLatin1String(parentWidget->metaObject()->className()); 154 if (!fb->isCustomWidgetContainer(parentClassName)) 155 fb->setProcessingLayoutWidget(true); 156 } 149 157 return QAbstractFormBuilder::create(ui_widget, parentWidget); 150 158 } … … 228 236 if (qobject_cast<QDialog *>(w)) 229 237 w->setParent(parentWidget); 230 231 if (!fb->rootWidget())232 fb->setRootWidget(w);233 238 234 239 return w; … … 370 375 QLayout *QFormBuilder::create(DomLayout *ui_layout, QLayout *layout, QWidget *parentWidget) 371 376 { 377 372 378 // Is this a temporary layout widget used to represent QLayout hierarchies in Designer? 373 379 // Set its margins to 0. 374 bool layoutWidget = QFormBuilderExtra::instance(this)->processingLayoutWidget();380 bool layoutWidget = ->processingLayoutWidget(); 375 381 QLayout *l = QAbstractFormBuilder::create(ui_layout, layout, parentWidget); 376 382 if (layoutWidget) { … … 393 399 394 400 l->setContentsMargins(left, top, right, bottom); 395 QFormBuilderExtra::instance(this)->setProcessingLayoutWidget(false);401 ->setProcessingLayoutWidget(false); 396 402 } 397 403 return l; … … 526 532 \internal 527 533 */ 534 528 535 void QFormBuilder::applyProperties(QObject *o, const QList<DomProperty*> &properties) 529 536 { … … 543 550 544 551 const QString attributeName = (*it)->attributeName(); 545 if (o == fb->rootWidget() && attributeName == strings.geometryProperty) { 546 // apply only the size for the rootWidget 547 fb->rootWidget()->resize(qvariant_cast<QRect>(v).size()); 552 const bool isWidget = o->isWidgetType(); 553 if (isWidget && o->parent() == fb->parentWidget() && attributeName == strings.geometryProperty) { 554 // apply only the size part of a geometry for the root widget 555 static_cast<QWidget*>(o)->resize(qvariant_cast<QRect>(v).size()); 548 556 } else if (fb->applyPropertyInternally(o, attributeName, v)) { 549 } else if ( !qstrcmp("QFrame", o->metaObject()->className ()) && attributeName == strings.orientationProperty) {557 } else if (!qstrcmp("QFrame", o->metaObject()->className ()) && attributeName == strings.orientationProperty) { 550 558 // ### special-casing for Line (QFrame) -- try to fix me 551 559 o->setProperty("frameShape", v); // v is of QFrame::Shape enum
Note:
See TracChangeset
for help on using the changeset viewer.