// ------------- QDesignerFormWindowManagerInterfacePrivate
-struct QDesignerFormWindowManagerInterfacePrivate {
+class QDesignerFormWindowManagerInterfacePrivate
+{
+public:
QDesignerFormWindowManagerInterfacePrivate();
QAction *m_simplifyLayoutAction;
QAction *m_formLayoutAction;
{
}
-typedef QMap<const QDesignerFormWindowManagerInterface *, QDesignerFormWindowManagerInterfacePrivate *> FormWindowManagerPrivateMap;
-
-Q_GLOBAL_STATIC(FormWindowManagerPrivateMap, g_FormWindowManagerPrivateMap)
-
/*!
Constructs an interface with the given \a parent for the form window
manager.
*/
QDesignerFormWindowManagerInterface::QDesignerFormWindowManagerInterface(QObject *parent)
- : QObject(parent)
+ : QObject(parent), d(new QDesignerFormWindowManagerInterfacePrivate)
+
{
- g_FormWindowManagerPrivateMap()->insert(this, new QDesignerFormWindowManagerInterfacePrivate);
}
/*!
*/
QDesignerFormWindowManagerInterface::~QDesignerFormWindowManagerInterface()
{
- FormWindowManagerPrivateMap *fwmpm = g_FormWindowManagerPrivateMap();
- const FormWindowManagerPrivateMap::iterator it = fwmpm->find(this);
- Q_ASSERT(it != fwmpm->end());
- delete it.value();
- fwmpm->erase(it);
}
/*!
QAction *QDesignerFormWindowManagerInterface::actionFormLayout() const
{
- const QDesignerFormWindowManagerInterfacePrivate *d = g_FormWindowManagerPrivateMap()->value(this);
- Q_ASSERT(d);
return d->m_formLayoutAction;
}
void QDesignerFormWindowManagerInterface::setActionFormLayout(QAction *action)
{
- QDesignerFormWindowManagerInterfacePrivate *d = g_FormWindowManagerPrivateMap()->value(this);
- Q_ASSERT(d);
d->m_formLayoutAction = action;
}
QAction *QDesignerFormWindowManagerInterface::actionSimplifyLayout() const
{
- const QDesignerFormWindowManagerInterfacePrivate *d = g_FormWindowManagerPrivateMap()->value(this);
- Q_ASSERT(d);
return d->m_simplifyLayoutAction;
}
void QDesignerFormWindowManagerInterface::setActionSimplifyLayout(QAction *action)
{
- QDesignerFormWindowManagerInterfacePrivate *d = g_FormWindowManagerPrivateMap()->value(this);
- Q_ASSERT(d);
d->m_simplifyLayoutAction = action;
}
#include <QtDesigner/abstractformwindow.h>
#include <QtCore/QObject>
+#include <QtCore/QScopedPointer>
QT_BEGIN_HEADER
class QWidget;
class QDesignerDnDItemInterface;
+class QDesignerFormWindowManagerInterfacePrivate;
+
class QDESIGNER_SDK_EXPORT QDesignerFormWindowManagerInterface: public QObject
{
Q_OBJECT
void setActionSimplifyLayout(QAction *action);
private:
- QDesignerFormWindowManagerInterface(const QDesignerFormWindowManagerInterface &other);
- QDesignerFormWindowManagerInterface &operator = (const QDesignerFormWindowManagerInterface &other);
+ QScopedPointer<QDesignerFormWindowManagerInterfacePrivate> d;
};
QT_END_NAMESPACE
#include "abstractintegration.h"
#include "abstractformeditor.h"
-#include <QtCore/QVariant>
-#include <QtCore/QSharedPointer>
-
QT_BEGIN_NAMESPACE
-// Add 'private' struct as a dynamic property.
-
-static const char privatePropertyC[] = "_q_integrationprivate";
-
-struct QDesignerIntegrationInterfacePrivate {
- QDesignerIntegrationInterfacePrivate() :
+class QDesignerIntegrationInterfacePrivate
+{
+public:
+ QDesignerIntegrationInterfacePrivate(QDesignerFormEditorInterface *core) :
headerSuffix(QLatin1String(".h")),
- headerLowercase(true) {}
+ headerLowercase(true), m_core(core) {}
QString headerSuffix;
bool headerLowercase;
+ QDesignerFormEditorInterface *m_core;
};
-typedef QSharedPointer<QDesignerIntegrationInterfacePrivate> QDesignerIntegrationInterfacePrivatePtr;
-
-QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QDesignerIntegrationInterfacePrivatePtr))
-QT_BEGIN_NAMESPACE
-
-static QDesignerIntegrationInterfacePrivatePtr integrationD(const QObject *o)
+QDesignerIntegrationInterface::QDesignerIntegrationInterface(QDesignerFormEditorInterface *core, QObject *parent)
+ : QObject(parent), d(new QDesignerIntegrationInterfacePrivate(core))
{
- const QVariant property = o->property(privatePropertyC);
- Q_ASSERT(qVariantCanConvert<QDesignerIntegrationInterfacePrivatePtr>(property));
- return qvariant_cast<QDesignerIntegrationInterfacePrivatePtr>(property);
+ core->setIntegration(this);
}
-QDesignerIntegrationInterface::QDesignerIntegrationInterface(QDesignerFormEditorInterface *core, QObject *parent)
- : QObject(parent),
- m_core(core)
+QDesignerIntegrationInterface::~QDesignerIntegrationInterface()
{
- core->setIntegration(this);
- const QDesignerIntegrationInterfacePrivatePtr d(new QDesignerIntegrationInterfacePrivate);
- setProperty(privatePropertyC, qVariantFromValue<QDesignerIntegrationInterfacePrivatePtr>(d));
}
QString QDesignerIntegrationInterface::headerSuffix() const
{
- return integrationD(this)->headerSuffix;
+ return d->headerSuffix;
}
void QDesignerIntegrationInterface::setHeaderSuffix(const QString &headerSuffix)
{
- integrationD(this)->headerSuffix = headerSuffix;
+ d->headerSuffix = headerSuffix;
}
bool QDesignerIntegrationInterface::isHeaderLowercase() const
{
- return integrationD(this)->headerLowercase;
+ return d->headerLowercase;
}
void QDesignerIntegrationInterface::setHeaderLowercase(bool headerLowercase)
{
- integrationD(this)->headerLowercase = headerLowercase;
+ d->headerLowercase = headerLowercase;
+}
+
+QDesignerFormEditorInterface *QDesignerIntegrationInterface::QDesignerIntegrationInterface::core() const
+{
+ return d->m_core;
}
QT_END_NAMESPACE
#include <QtDesigner/sdk_global.h>
#include <QtCore/QObject>
+#include <QtCore/QScopedPointer>
#include <QtCore/QString>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QDesignerFormEditorInterface;
+class QDesignerIntegrationInterfacePrivate;
class QDESIGNER_SDK_EXPORT QDesignerIntegrationInterface: public QObject
{
public:
QDesignerIntegrationInterface(QDesignerFormEditorInterface *core, QObject *parent = 0);
+ virtual ~QDesignerIntegrationInterface();
- inline QDesignerFormEditorInterface *core() const;
+ QDesignerFormEditorInterface *core() const;
virtual QWidget *containerWindow(QWidget *widget) const = 0;
void setHeaderLowercase(bool headerLowerCase);
private:
- QDesignerFormEditorInterface *m_core;
+ QScopedPointer<QDesignerIntegrationInterfacePrivate> d;
};
-inline QDesignerFormEditorInterface *QDesignerIntegrationInterface::core() const
-{ return m_core; }
-
QT_END_NAMESPACE
QT_END_HEADER
#include <QtDesigner/sdk_global.h>
+#include <QtCore/QSharedDataPointer>
#include <QtCore/QMetaType>
#include <QtGui/QWidget>
#include <QtGui/QIcon>
class DomUI;
class QDesignerDnDItemInterface;
+class QDesignerWidgetBoxWidgetData;
+
class QDESIGNER_SDK_EXPORT QDesignerWidgetBoxInterface : public QWidget
{
Q_OBJECT
public:
enum Type { Default, Custom };
Widget(const QString &aname = QString(), const QString &xml = QString(),
- const QString &icon_name = QString(), Type atype = Default)
- : m_name(aname), m_xml(xml), m_icon_name(icon_name), m_type(atype) {}
- QString name() const { return m_name; }
- void setName(const QString &aname) { m_name = aname; }
- QString domXml() const { return m_xml; }
- void setDomXml(const QString &xml) { m_xml = xml; }
- QString iconName() const { return m_icon_name; }
- void setIconName(const QString &icon_name) { m_icon_name = icon_name; }
- Type type() const { return m_type; }
- void setType(Type atype) { m_type = atype; }
-
- bool isNull() const { return m_name.isEmpty(); }
+ const QString &icon_name = QString(), Type atype = Default);
+ ~Widget();
+ Widget(const Widget &w);
+ Widget &operator=(const Widget &w);
+
+ QString name() const;
+ void setName(const QString &aname);
+ QString domXml() const;
+ void setDomXml(const QString &xml);
+ QString iconName() const;
+ void setIconName(const QString &icon_name);
+ Type type() const;
+ void setType(Type atype);
+
+ bool isNull() const;
private:
- QString m_name;
- QString m_xml;
- QString m_icon_name;
- Type m_type;
+ QSharedDataPointer<QDesignerWidgetBoxWidgetData> m_data;
};
+
typedef QList<Widget> WidgetList;
class Category {
#include <QtCore/QRegExp>
#include <QtCore/QDebug>
#include <QtCore/QXmlStreamReader>
+#include <QtCore/QSharedData>
QT_BEGIN_NAMESPACE
+class QDesignerWidgetBoxWidgetData : public QSharedData
+{
+public:
+ QDesignerWidgetBoxWidgetData(const QString &aname, const QString &xml,
+ const QString &icon_name,
+ QDesignerWidgetBoxInterface::Widget::Type atype);
+ QString m_name;
+ QString m_xml;
+ QString m_icon_name;
+ QDesignerWidgetBoxInterface::Widget::Type m_type;
+};
+
+QDesignerWidgetBoxWidgetData::QDesignerWidgetBoxWidgetData(const QString &aname,
+ const QString &xml,
+ const QString &icon_name,
+ QDesignerWidgetBoxInterface::Widget::Type atype) :
+ m_name(aname), m_xml(xml), m_icon_name(icon_name), m_type(atype)
+{
+}
+
+QDesignerWidgetBoxInterface::Widget::Widget(const QString &aname, const QString &xml,
+ const QString &icon_name, Type atype) :
+ m_data(new QDesignerWidgetBoxWidgetData(aname, xml, icon_name, atype))
+{
+}
+
+QDesignerWidgetBoxInterface::Widget::~Widget()
+{
+}
+
+QDesignerWidgetBoxInterface::Widget::Widget(const Widget &w) :
+ m_data(w.m_data)
+{
+}
+
+QDesignerWidgetBoxInterface::Widget &QDesignerWidgetBoxInterface::Widget::operator=(const Widget &rhs)
+{
+ if (this != &rhs) {
+ m_data = rhs.m_data;
+ }
+ return *this;
+}
+
+QString QDesignerWidgetBoxInterface::Widget::name() const
+{
+ return m_data->m_name;
+}
+
+void QDesignerWidgetBoxInterface::Widget::setName(const QString &aname)
+{
+ m_data->m_name = aname;
+}
+
+QString QDesignerWidgetBoxInterface::Widget::domXml() const
+{
+ return m_data->m_xml;
+}
+
+void QDesignerWidgetBoxInterface::Widget::setDomXml(const QString &xml)
+{
+ m_data->m_xml = xml;
+}
+
+QString QDesignerWidgetBoxInterface::Widget::iconName() const
+{
+ return m_data->m_icon_name;
+}
+
+void QDesignerWidgetBoxInterface::Widget::setIconName(const QString &icon_name)
+{
+ m_data->m_icon_name = icon_name;
+}
+
+QDesignerWidgetBoxInterface::Widget::Type QDesignerWidgetBoxInterface::Widget::type() const
+{
+ return m_data->m_type;
+}
+
+void QDesignerWidgetBoxInterface::Widget::setType(Type atype)
+{
+ m_data->m_type = atype;
+}
+
+bool QDesignerWidgetBoxInterface::Widget::isNull() const
+{
+ return m_data->m_name.isEmpty();
+}
+
namespace qdesigner_internal {
QDesignerWidgetBox::QDesignerWidgetBox(QWidget *parent, Qt::WindowFlags flags)
: QDesignerWidgetBoxInterface(parent, flags),