From 5148fc56f03504671ee2fa54411b8129c8c49c8e Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 5 Aug 2009 17:39:00 +1000 Subject: Only register the QFxAnchorLine metatype once I initially assumed that qRegisterMetaType would do something clever to avoid this cost, but it doesn't. --- src/declarative/fx/qfxitem.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index b081edc..2ff02f0 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -361,6 +361,14 @@ void QFxContents::setItem(QFxItem *item) \sa QFxItem::setFocus() */ +static inline void qfxitem_registerAnchorLine() { + static bool registered = false; + if (!registered) { + qRegisterMetaType("QFxAnchorLine"); + registered = true; + } +} + /*! \fn QFxItem::QFxItem(QFxItem *parent) @@ -370,7 +378,7 @@ QFxItem::QFxItem(QFxItem* parent) : QGraphicsObject(*(new QFxItemPrivate), parent, 0) { Q_D(QFxItem); - qRegisterMetaType("QFxAnchorLine"); + qfxitem_registerAnchorLine(); d->init(parent); } @@ -380,7 +388,7 @@ QFxItem::QFxItem(QFxItemPrivate &dd, QFxItem *parent) : QGraphicsObject(dd, parent, 0) { Q_D(QFxItem); - qRegisterMetaType("QFxAnchorLine"); + qfxitem_registerAnchorLine(); d->init(parent); } -- cgit v0.12