diff --git a/src/uitools/quiloader.cpp b/src/uitools/quiloader.cpp index 13ee48aa45..7f39b557ea 100644 --- a/src/uitools/quiloader.cpp +++ b/src/uitools/quiloader.cpp @@ -505,7 +505,7 @@ bool FormBuilderPrivate::addItem(DomWidget *ui_widget, QWidget *widget, QWidget // Check special cases. First: Custom container const QString className = QLatin1String(parentWidget->metaObject()->className()); - if (!QFormBuilderExtra::instance(this)->customWidgetAddPageMethod(className).isEmpty()) + if (!d->customWidgetAddPageMethod(className).isEmpty()) return true; const QFormBuilderStrings &strings = QFormBuilderStrings::instance(); diff --git a/tools/uilib/abstractformbuilder.cpp b/tools/uilib/abstractformbuilder.cpp index ecb43db89f..e850df8f37 100644 --- a/tools/uilib/abstractformbuilder.cpp +++ b/tools/uilib/abstractformbuilder.cpp @@ -165,9 +165,7 @@ public: /*! Constructs a new form builder.*/ -QAbstractFormBuilder::QAbstractFormBuilder() : - m_defaultMargin(INT_MIN), - m_defaultSpacing(INT_MIN) +QAbstractFormBuilder::QAbstractFormBuilder() : d(new QFormBuilderExtra) { setResourceBuilder(new QResourceBuilder()); setTextBuilder(new QTextBuilder()); @@ -177,10 +175,8 @@ QAbstractFormBuilder::QAbstractFormBuilder() : Destroys the form builder.*/ QAbstractFormBuilder::~QAbstractFormBuilder() { - QFormBuilderExtra::removeInstance(this); } - /*! \fn QWidget *QAbstractFormBuilder::load(QIODevice *device, QWidget *parent) @@ -229,11 +225,10 @@ QWidget *QAbstractFormBuilder::create(DomUI *ui, QWidget *parentWidget) { typedef QFormBuilderExtra::ButtonGroupHash ButtonGroupHash; - QFormBuilderExtra *formBuilderPrivate = QFormBuilderExtra::instance(this); - formBuilderPrivate->clear(); + d->clear(); if (const DomLayoutDefault *def = ui->elementLayoutDefault()) { - m_defaultMargin = def->hasAttributeMargin() ? def->attributeMargin() : INT_MIN; - m_defaultSpacing = def->hasAttributeSpacing() ? def->attributeSpacing() : INT_MIN; + d->m_defaultMargin = def->hasAttributeMargin() ? def->attributeMargin() : INT_MIN; + d->m_defaultSpacing = def->hasAttributeSpacing() ? def->attributeSpacing() : INT_MIN; } DomWidget *ui_widget = ui->elementWidget(); @@ -243,11 +238,11 @@ QWidget *QAbstractFormBuilder::create(DomUI *ui, QWidget *parentWidget) initialize(ui); if (const DomButtonGroups *domButtonGroups = ui->elementButtonGroups()) - formBuilderPrivate->registerButtonGroups(domButtonGroups); + d->registerButtonGroups(domButtonGroups); if (QWidget *widget = create(ui_widget, parentWidget)) { // Reparent button groups that were actually created to main container for them to be found in the signal/slot part - const ButtonGroupHash &buttonGroups = formBuilderPrivate->buttonGroups(); + const ButtonGroupHash &buttonGroups = d->buttonGroups(); if (!buttonGroups.empty()) { const ButtonGroupHash::const_iterator cend = buttonGroups.constEnd(); for (ButtonGroupHash::const_iterator it = buttonGroups.constBegin(); it != cend; ++it) @@ -257,12 +252,12 @@ QWidget *QAbstractFormBuilder::create(DomUI *ui, QWidget *parentWidget) createConnections(ui->elementConnections(), widget); createResources(ui->elementResources()); // maybe this should go first, before create()... applyTabStops(widget, ui->elementTabStops()); - formBuilderPrivate->applyInternalProperties(); + d->applyInternalProperties(); reset(); - formBuilderPrivate->clear(); + d->clear(); return widget; } - formBuilderPrivate->clear(); + d->clear(); return 0; } @@ -283,10 +278,9 @@ void QAbstractFormBuilder::initialize(const DomUI *ui) if (domCustomWidgets) { const DomCustomWidgetList customWidgets = domCustomWidgets->elementCustomWidget(); if (!customWidgets.empty()) { - QFormBuilderExtra *formBuilderPrivate = QFormBuilderExtra::instance(this); const DomCustomWidgetList::const_iterator cend = customWidgets.constEnd(); for (DomCustomWidgetList::const_iterator it = customWidgets.constBegin(); it != cend; ++it) - formBuilderPrivate->storeCustomWidgetData((*it)->elementClass(), *it); + d->storeCustomWidgetData((*it)->elementClass(), *it); } } } @@ -337,9 +331,9 @@ QWidget *QAbstractFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidge sep->setSeparator(true); w->addAction(sep); addMenuAction(sep); - } else if (QAction *a = m_actions.value(name)) { + } else if (QAction *a = d->m_actions.value(name)) { w->addAction(a); - } else if (QActionGroup *g = m_actionGroups.value(name)) { + } else if (QActionGroup *g = d->m_actionGroups.value(name)) { w->addActions(g->actions()); } else if (QMenu *menu = w->findChild(name)) { w->addAction(menu->menuAction()); @@ -351,9 +345,8 @@ QWidget *QAbstractFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidge loadExtraInfo(ui_widget, w, parentWidget); #ifndef QT_FORMBUILDER_NO_SCRIPT QString scriptErrorMessage; - QFormBuilderExtra *extra = QFormBuilderExtra::instance(this); - extra->formScriptRunner().run(ui_widget, - extra->customWidgetScript(ui_widget->attributeClass()), + d->formScriptRunner().run(ui_widget, + d->customWidgetScript(ui_widget->attributeClass()), w, children, &scriptErrorMessage); #endif addItem(ui_widget, w, parentWidget); @@ -388,7 +381,7 @@ QAction *QAbstractFormBuilder::create(DomAction *ui_action, QObject *parent) if (!a) return 0; - m_actions.insert(ui_action->attributeName(), a); + d->m_actions.insert(ui_action->attributeName(), a); applyProperties(a, ui_action->elementProperty()); return a; } @@ -401,7 +394,7 @@ QActionGroup *QAbstractFormBuilder::create(DomActionGroup *ui_action_group, QObj QActionGroup *a = createActionGroup(parent, ui_action_group->attributeName()); if (!a) return 0; - m_actionGroups.insert(ui_action_group->attributeName(), a); + d->m_actionGroups.insert(ui_action_group->attributeName(), a); applyProperties(a, ui_action_group->elementProperty()); foreach (DomAction *ui_action, ui_action_group->elementAction()) { @@ -446,7 +439,7 @@ bool QAbstractFormBuilder::addItem(DomWidget *ui_widget, QWidget *widget, QWidge return true; // Check special cases. First: Custom container const QString className = QLatin1String(parentWidget->metaObject()->className()); - const QString addPageMethod = QFormBuilderExtra::instance(this)->customWidgetAddPageMethod(className); + const QString addPageMethod = d->customWidgetAddPageMethod(className); if (!addPageMethod.isEmpty()) { // If this fails ( non-existent or non-slot), use ContainerExtension in Designer, else it can't be helped return QMetaObject::invokeMethod(parentWidget, addPageMethod.toUtf8().constData(), Qt::DirectConnection, Q_ARG(QWidget*, widget)); @@ -968,14 +961,12 @@ void QAbstractFormBuilder::applyProperties(QObject *o, const QList if (properties.empty()) return; - QFormBuilderExtra *fb = QFormBuilderExtra::instance(this); - const DomPropertyList::const_iterator cend = properties.constEnd(); for (DomPropertyList::const_iterator it = properties.constBegin(); it != cend; ++it) { const QVariant v = toVariant(o->metaObject(), *it); if (!v.isNull()) { const QString attributeName = (*it)->attributeName(); - if (!fb->applyPropertyInternally(o, attributeName, v)) + if (!d->applyPropertyInternally(o, attributeName, v)) o->setProperty(attributeName.toUtf8(), v); } } @@ -990,7 +981,7 @@ void QAbstractFormBuilder::applyProperties(QObject *o, const QList bool QAbstractFormBuilder::applyPropertyInternally(QObject *o, const QString &propertyName, const QVariant &value) { - return QFormBuilderExtra::instance(this)->applyPropertyInternally(o,propertyName, value); + return d->applyPropertyInternally(o,propertyName, value); } /*! @@ -1274,7 +1265,7 @@ void QAbstractFormBuilder::save(QIODevice *dev, QWidget *widget) ui->write(writer); writer.writeEndDocument(); - m_laidout.clear(); + d->m_laidout.clear(); delete ui; } @@ -1374,7 +1365,7 @@ DomWidget *QAbstractFormBuilder::createDom(QWidget *widget, DomWidget *ui_parent foreach (QObject *obj, children) { if (QWidget *childWidget = qobject_cast(obj)) { - if (m_laidout.contains(childWidget) || recursive == false) + if (d->m_laidout.contains(childWidget) || recursive == false) continue; if (QMenu *menu = qobject_cast(childWidget)) { @@ -1580,7 +1571,7 @@ DomLayoutItem *QAbstractFormBuilder::createDom(QLayoutItem *item, DomLayout *ui_ if (item->widget()) { ui_item->setElementWidget(createDom(item->widget(), ui_parentWidget)); - m_laidout.insert(item->widget(), true); + d->m_laidout.insert(item->widget(), true); } else if (item->layout()) { ui_item->setElementLayout(createDom(item->layout(), ui_layout, ui_parentWidget)); } else if (item->spacerItem()) { @@ -2369,7 +2360,7 @@ void QAbstractFormBuilder::saveItemViewExtraInfo(const QAbstractItemView *itemVi void QAbstractFormBuilder::setResourceBuilder(QResourceBuilder *builder) { - QFormBuilderExtra::instance(this)->setResourceBuilder(builder); + d->setResourceBuilder(builder); } /*! @@ -2379,7 +2370,7 @@ void QAbstractFormBuilder::setResourceBuilder(QResourceBuilder *builder) QResourceBuilder *QAbstractFormBuilder::resourceBuilder() const { - return QFormBuilderExtra::instance(this)->resourceBuilder(); + return d->resourceBuilder(); } /*! @@ -2389,7 +2380,7 @@ QResourceBuilder *QAbstractFormBuilder::resourceBuilder() const void QAbstractFormBuilder::setTextBuilder(QTextBuilder *builder) { - QFormBuilderExtra::instance(this)->setTextBuilder(builder); + d->setTextBuilder(builder); } /*! @@ -2399,7 +2390,7 @@ void QAbstractFormBuilder::setTextBuilder(QTextBuilder *builder) QTextBuilder *QAbstractFormBuilder::textBuilder() const { - return QFormBuilderExtra::instance(this)->textBuilder(); + return d->textBuilder(); } /*! @@ -2663,8 +2654,7 @@ void QAbstractFormBuilder::loadButtonExtraInfo(const DomWidget *ui_widget, QAbst if (groupName.isEmpty()) return; // Find entry - QFormBuilderExtra *extra = QFormBuilderExtra::instance(this); - ButtonGroupHash &buttonGroups = extra->buttonGroups(); + ButtonGroupHash &buttonGroups = d->buttonGroups(); ButtonGroupHash::iterator it = buttonGroups.find(groupName); if (it == buttonGroups.end()) { #ifdef QFORMINTERNAL_NAMESPACE // Suppress the warning when copying in Designer @@ -2796,75 +2786,13 @@ void QAbstractFormBuilder::loadExtraInfo(DomWidget *ui_widget, QWidget *widget, } } -/*! - \internal -*/ -QIcon QAbstractFormBuilder::nameToIcon(const QString &filePath, const QString &qrcPath) -{ - Q_UNUSED(filePath) - Q_UNUSED(qrcPath) - qWarning() << "QAbstractFormBuilder::nameToIcon() is obsoleted"; - return QIcon(); -} - -/*! - \internal -*/ -QString QAbstractFormBuilder::iconToFilePath(const QIcon &pm) const -{ - Q_UNUSED(pm) - qWarning() << "QAbstractFormBuilder::iconToFilePath() is obsoleted"; - return QString(); -} - -/*! - \internal -*/ -QString QAbstractFormBuilder::iconToQrcPath(const QIcon &pm) const -{ - Q_UNUSED(pm) - qWarning() << "QAbstractFormBuilder::iconToQrcPath() is obsoleted"; - return QString(); -} - -/*! - \internal -*/ -QPixmap QAbstractFormBuilder::nameToPixmap(const QString &filePath, const QString &qrcPath) -{ - Q_UNUSED(filePath) - Q_UNUSED(qrcPath) - qWarning() << "QAbstractFormBuilder::nameToPixmap() is obsoleted"; - return QPixmap(); -} - -/*! - \internal -*/ -QString QAbstractFormBuilder::pixmapToFilePath(const QPixmap &pm) const -{ - Q_UNUSED(pm) - qWarning() << "QAbstractFormBuilder::pixmapToFilePath() is obsoleted"; - return QString(); -} - -/*! - \internal -*/ -QString QAbstractFormBuilder::pixmapToQrcPath(const QPixmap &pm) const -{ - Q_UNUSED(pm) - qWarning() << "QAbstractFormBuilder::pixmapToQrcPath() is obsoleted"; - return QString(); -} - /*! Returns the current working directory of the form builder. \sa setWorkingDirectory() */ QDir QAbstractFormBuilder::workingDirectory() const { - return m_workingDirectory; + return d->m_workingDirectory; } /*! @@ -2874,7 +2802,7 @@ QDir QAbstractFormBuilder::workingDirectory() const \sa workingDirectory()*/ void QAbstractFormBuilder::setWorkingDirectory(const QDir &directory) { - m_workingDirectory = directory; + d->m_workingDirectory = directory; } /*! @@ -2948,11 +2876,11 @@ void QAbstractFormBuilder::addMenuAction(QAction *action) */ void QAbstractFormBuilder::reset() { - m_laidout.clear(); - m_actions.clear(); - m_actionGroups.clear(); - m_defaultMargin = INT_MIN; - m_defaultSpacing = INT_MIN; + d->m_laidout.clear(); + d->m_actions.clear(); + d->m_actionGroups.clear(); + d->m_defaultMargin = INT_MIN; + d->m_defaultSpacing = INT_MIN; } /*! @@ -3165,7 +3093,7 @@ QPixmap QAbstractFormBuilder::domPropertyToPixmap(const DomProperty* p) #ifndef QT_FORMBUILDER_NO_SCRIPT QFormScriptRunner *QAbstractFormBuilder::formScriptRunner() const { - return &(QFormBuilderExtra::instance(this)->formScriptRunner()); + return &(d->formScriptRunner()); } #endif diff --git a/tools/uilib/abstractformbuilder.h b/tools/uilib/abstractformbuilder.h index 2f99b36515..4c22570932 100644 --- a/tools/uilib/abstractformbuilder.h +++ b/tools/uilib/abstractformbuilder.h @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -105,6 +106,7 @@ class DomResourcePixmap; class QResourceBuilder; class QTextBuilder; +class QFormBuilderExtra; #ifndef QT_FORMBUILDER_NO_SCRIPT class QFormScriptRunner; @@ -186,13 +188,6 @@ protected: virtual void layoutInfo(DomLayout *layout, QObject *parent, int *margin, int *spacing); - virtual QIcon nameToIcon(const QString &filePath, const QString &qrcPath); - virtual QString iconToFilePath(const QIcon &pm) const; - virtual QString iconToQrcPath(const QIcon &pm) const; - virtual QPixmap nameToPixmap(const QString &filePath, const QString &qrcPath); - virtual QString pixmapToFilePath(const QPixmap &pm) const; - virtual QString pixmapToQrcPath(const QPixmap &pm) const; - void loadListWidgetExtraInfo(DomWidget *ui_widget, QListWidget *listWidget, QWidget *parentWidget); void loadTreeWidgetExtraInfo(DomWidget *ui_widget, QTreeWidget *treeWidget, QWidget *parentWidget); void loadTableWidgetExtraInfo(DomWidget *ui_widget, QTableWidget *tableWidget, QWidget *parentWidget); @@ -259,13 +254,6 @@ protected: QPixmap domPropertyToPixmap(const DomResourcePixmap* p); QPixmap domPropertyToPixmap(const DomProperty* p); - QHash m_laidout; - QHash m_actions; - QHash m_actionGroups; - int m_defaultMargin; - int m_defaultSpacing; - QDir m_workingDirectory; - private: // // utils @@ -277,6 +265,9 @@ private: friend QDESIGNER_UILIB_EXPORT DomProperty *variantToDomProperty(QAbstractFormBuilder *abstractFormBuilder, const QMetaObject *meta, const QString &propertyName, const QVariant &value); friend QDESIGNER_UILIB_EXPORT QVariant domPropertyToVariant(QAbstractFormBuilder *abstractFormBuilder,const QMetaObject *meta, const DomProperty *property); + +protected: + QScopedPointer d; }; #ifdef QFORMINTERNAL_NAMESPACE diff --git a/tools/uilib/formbuilder.cpp b/tools/uilib/formbuilder.cpp index b997cc9bc0..592b1f15f7 100644 --- a/tools/uilib/formbuilder.cpp +++ b/tools/uilib/formbuilder.cpp @@ -104,7 +104,7 @@ namespace QFormInternal { Constructs a new form builder. */ -QFormBuilder::QFormBuilder() : QAbstractFormBuilder() +QFormBuilder::QFormBuilder() { } @@ -120,12 +120,11 @@ QFormBuilder::~QFormBuilder() */ QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget) { - QFormBuilderExtra *fb = QFormBuilderExtra::instance(this); - if (!fb->parentWidgetIsSet()) - fb->setParentWidget(parentWidget); + if (!d->parentWidgetIsSet()) + d->setParentWidget(parentWidget); // Is this a QLayoutWidget with a margin of 0: Not a known page-based // container and no method for adding pages registered. - fb->setProcessingLayoutWidget(false); + d->setProcessingLayoutWidget(false); if (ui_widget->attributeClass() == QFormBuilderStrings::instance().qWidgetClass && !ui_widget->hasAttributeNative() && parentWidget #ifndef QT_NO_MAINWINDOW @@ -151,8 +150,8 @@ QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget) #endif ) { const QString parentClassName = QLatin1String(parentWidget->metaObject()->className()); - if (!fb->isCustomWidgetContainer(parentClassName)) - fb->setProcessingLayoutWidget(true); + if (!d->isCustomWidgetContainer(parentClassName)) + d->setProcessingLayoutWidget(true); } return QAbstractFormBuilder::create(ui_widget, parentWidget); } @@ -212,14 +211,13 @@ QWidget *QFormBuilder::createWidget(const QString &widgetName, QWidget *parentWi break; // try with a registered custom widget - QDesignerCustomWidgetInterface *factory = m_customWidgets.value(widgetName); + QDesignerCustomWidgetInterface *factory = d->m_customWidgets.value(widgetName); if (factory != 0) w = factory->createWidget(parentWidget); } while(false); - QFormBuilderExtra *fb = QFormBuilderExtra::instance(this); if (w == 0) { // Attempt to instantiate base class of promoted/custom widgets - const QString baseClassName = fb->customWidgetBaseClass(widgetName); + const QString baseClassName = d->customWidgetBaseClass(widgetName); if (!baseClassName.isEmpty()) { qWarning() << QCoreApplication::translate("QFormBuilder", "QFormBuilder was unable to create a custom widget of the class '%1'; defaulting to base class '%2'.").arg(widgetName, baseClassName); return createWidget(baseClassName, parentWidget, name); @@ -374,10 +372,9 @@ 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 = fb->processingLayoutWidget(); + bool layoutWidget = d->processingLayoutWidget(); QLayout *l = QAbstractFormBuilder::create(ui_layout, layout, parentWidget); if (layoutWidget) { const QFormBuilderStrings &strings = QFormBuilderStrings::instance(); @@ -398,7 +395,7 @@ QLayout *QFormBuilder::create(DomLayout *ui_layout, QLayout *layout, QWidget *pa bottom = prop->elementNumber(); l->setContentsMargins(left, top, right, bottom); - fb->setProcessingLayoutWidget(false); + d->setProcessingLayoutWidget(false); } return l; } @@ -434,7 +431,7 @@ QActionGroup *QFormBuilder::create(DomActionGroup *ui_action_group, QObject *par */ QStringList QFormBuilder::pluginPaths() const { - return m_pluginPaths; + return d->m_pluginPaths; } /*! @@ -445,7 +442,7 @@ QStringList QFormBuilder::pluginPaths() const */ void QFormBuilder::clearPluginPaths() { - m_pluginPaths.clear(); + d->m_pluginPaths.clear(); updateCustomWidgets(); } @@ -458,7 +455,7 @@ void QFormBuilder::clearPluginPaths() */ void QFormBuilder::addPluginPath(const QString &pluginPath) { - m_pluginPaths.append(pluginPath); + d->m_pluginPaths.append(pluginPath); updateCustomWidgets(); } @@ -469,7 +466,7 @@ void QFormBuilder::addPluginPath(const QString &pluginPath) */ void QFormBuilder::setPluginPath(const QStringList &pluginPaths) { - m_pluginPaths = pluginPaths; + d->m_pluginPaths = pluginPaths; updateCustomWidgets(); } @@ -492,9 +489,9 @@ static void insertPlugins(QObject *o, QMapm_customWidgets.clear(); - foreach (const QString &path, m_pluginPaths) { + foreach (const QString &path, d->m_pluginPaths) { const QDir dir(path); const QStringList candidates = dir.entryList(QDir::Files); @@ -508,14 +505,14 @@ void QFormBuilder::updateCustomWidgets() QPluginLoader loader(loaderPath); if (loader.load()) - insertPlugins(loader.instance(), &m_customWidgets); + insertPlugins(loader.instance(), &d->m_customWidgets); } } // Check statically linked plugins const QObjectList staticPlugins = QPluginLoader::staticInstances(); if (!staticPlugins.empty()) foreach (QObject *o, staticPlugins) - insertPlugins(o, &m_customWidgets); + insertPlugins(o, &d->m_customWidgets); } /*! @@ -525,7 +522,7 @@ void QFormBuilder::updateCustomWidgets() */ QList QFormBuilder::customWidgets() const { - return m_customWidgets.values(); + return d->m_customWidgets.values(); } /*! @@ -539,7 +536,6 @@ void QFormBuilder::applyProperties(QObject *o, const QList &proper if (properties.empty()) return; - QFormBuilderExtra *fb = QFormBuilderExtra::instance(this); const QFormBuilderStrings &strings = QFormBuilderStrings::instance(); const DomPropertyList::const_iterator cend = properties.constEnd(); @@ -550,10 +546,10 @@ void QFormBuilder::applyProperties(QObject *o, const QList &proper const QString attributeName = (*it)->attributeName(); const bool isWidget = o->isWidgetType(); - if (isWidget && o->parent() == fb->parentWidget() && attributeName == strings.geometryProperty) { + if (isWidget && o->parent() == d->parentWidget() && attributeName == strings.geometryProperty) { // apply only the size part of a geometry for the root widget static_cast(o)->resize(qvariant_cast(v).size()); - } else if (fb->applyPropertyInternally(o, attributeName, v)) { + } else if (d->applyPropertyInternally(o, attributeName, v)) { } 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 diff --git a/tools/uilib/formbuilder.h b/tools/uilib/formbuilder.h index 1d3dc5a395..6c0820c214 100644 --- a/tools/uilib/formbuilder.h +++ b/tools/uilib/formbuilder.h @@ -45,9 +45,6 @@ #include "uilib_global.h" #include "abstractformbuilder.h" -#include -#include - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -100,8 +97,6 @@ protected: static QWidget *widgetByName(QWidget *topLevel, const QString &name); private: - QStringList m_pluginPaths; - QMap m_customWidgets; }; #ifdef QFORMINTERNAL_NAMESPACE diff --git a/tools/uilib/formbuilderextra.cpp b/tools/uilib/formbuilderextra.cpp index ecc62886b9..12e43f1e38 100644 --- a/tools/uilib/formbuilderextra.cpp +++ b/tools/uilib/formbuilderextra.cpp @@ -55,6 +55,8 @@ #include #include +#include + QT_BEGIN_NAMESPACE #ifdef QFORMINTERNAL_NAMESPACE @@ -83,6 +85,8 @@ QFormBuilderExtra::CustomWidgetData::CustomWidgetData(const DomCustomWidget *dcw } QFormBuilderExtra::QFormBuilderExtra() : + m_defaultMargin(INT_MIN), + m_defaultSpacing(INT_MIN), m_layoutWidget(false), m_resourceBuilder(0), m_textBuilder(0) @@ -217,33 +221,6 @@ bool QFormBuilderExtra::isCustomWidgetContainer(const QString &className) const return false; } -namespace { - typedef QHash FormBuilderPrivateHash; -} - -Q_GLOBAL_STATIC(FormBuilderPrivateHash, g_FormBuilderPrivateHash) - -QFormBuilderExtra *QFormBuilderExtra::instance(const QAbstractFormBuilder *afb) -{ - FormBuilderPrivateHash &fbHash = *g_FormBuilderPrivateHash(); - - FormBuilderPrivateHash::iterator it = fbHash.find(afb); - if (it == fbHash.end()) - it = fbHash.insert(afb, new QFormBuilderExtra); - return it.value(); -} - -void QFormBuilderExtra::removeInstance(const QAbstractFormBuilder *afb) -{ - FormBuilderPrivateHash &fbHash = *g_FormBuilderPrivateHash(); - - FormBuilderPrivateHash::iterator it = fbHash.find(afb); - if (it != fbHash.end()) { - delete it.value(); - fbHash.erase(it); - } -} - void QFormBuilderExtra::setProcessingLayoutWidget(bool processing) { m_layoutWidget = processing; diff --git a/tools/uilib/formbuilderextra_p.h b/tools/uilib/formbuilderextra_p.h index cac882b8d8..a5e2029391 100644 --- a/tools/uilib/formbuilderextra_p.h +++ b/tools/uilib/formbuilderextra_p.h @@ -61,19 +61,23 @@ #include #include -#include +#include +#include +#include QT_BEGIN_NAMESPACE +class QDesignerCustomWidgetInterface; class QObject; class QVariant; class QWidget; class QObject; class QLabel; class QButtonGroup; - class QBoxLayout; class QGridLayout; +class QAction; +class QActionGroup; #ifdef QFORMINTERNAL_NAMESPACE namespace QFormInternal @@ -90,9 +94,10 @@ class QTextBuilder; class QDESIGNER_UILIB_EXPORT QFormBuilderExtra { +public: QFormBuilderExtra(); ~QFormBuilderExtra(); -public: + struct CustomWidgetData { CustomWidgetData(); explicit CustomWidgetData(const DomCustomWidget *dc); @@ -130,9 +135,6 @@ public: void setTextBuilder(QTextBuilder *builder); QTextBuilder *textBuilder() const; - static QFormBuilderExtra *instance(const QAbstractFormBuilder *afb); - static void removeInstance(const QAbstractFormBuilder *afb); - void storeCustomWidgetData(const QString &className, const DomCustomWidget *d); QString customWidgetAddPageMethod(const QString &className) const; QString customWidgetBaseClass(const QString &className) const; @@ -169,6 +171,16 @@ public: static bool setGridLayoutColumnMinimumWidth(const QString &, QGridLayout *); static void clearGridLayoutColumnMinimumWidth(QGridLayout *); + QStringList m_pluginPaths; + QMap m_customWidgets; + + QHash m_laidout; + QHash m_actions; + QHash m_actionGroups; + int m_defaultMargin; + int m_defaultSpacing; + QDir m_workingDirectory; + private: void clearResourceBuilder(); void clearTextBuilder();