diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-05-09 12:36:48 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-05-09 12:36:48 +0200 |
commit | 4f3b1a4ec8bb9c3a086469f397c9cafee36b5b8f (patch) | |
tree | 8dd495a89ace486627139bb89f3fc9acc1b9120e /src/designer/src/lib/sdk/abstractintegration.cpp | |
parent | 0b78b646c4c3a9a1296574a754e898ce42e4e806 (diff) |
Qt Designer: BC cleanup
Introduce private classes instead of static hacks
for QDesignerFormWindowManagerInterface and
Integration. Make WidgetBox::Widget a shared data class.
Diffstat (limited to 'src/designer/src/lib/sdk/abstractintegration.cpp')
-rw-r--r-- | src/designer/src/lib/sdk/abstractintegration.cpp | 49 |
1 files changed, 19 insertions, 30 deletions
diff --git a/src/designer/src/lib/sdk/abstractintegration.cpp b/src/designer/src/lib/sdk/abstractintegration.cpp index 0c888f651..feb68a924 100644 --- a/src/designer/src/lib/sdk/abstractintegration.cpp +++ b/src/designer/src/lib/sdk/abstractintegration.cpp @@ -42,64 +42,53 @@ #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 |