From 74464120794c2f41c5c6d8d9b34b4de2d1c3635c Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 30 Jul 2009 11:18:06 +1000 Subject: More QFxItem cleanup. --- src/declarative/extra/qfxflowview.cpp | 1 - src/declarative/extra/qfxparticles.cpp | 6 +++--- src/declarative/fx/qfxflickable.cpp | 2 +- src/declarative/fx/qfximage.cpp | 6 ++---- src/declarative/fx/qfxitem.cpp | 29 ----------------------------- src/declarative/fx/qfxitem.h | 10 +--------- src/declarative/fx/qfxkeyproxy.cpp | 6 +++--- src/declarative/fx/qfxlineedit.cpp | 4 ++-- src/declarative/fx/qfxmouseregion_p.h | 2 +- src/declarative/fx/qfxpathview_p.h | 2 +- src/declarative/fx/qfxrect.cpp | 4 ++-- src/declarative/fx/qfxtext.cpp | 4 ++-- src/declarative/fx/qfxtextedit.cpp | 4 ++-- src/declarative/fx/qfxwebview.cpp | 2 +- 14 files changed, 21 insertions(+), 61 deletions(-) diff --git a/src/declarative/extra/qfxflowview.cpp b/src/declarative/extra/qfxflowview.cpp index 1757c5a..e9b836d 100644 --- a/src/declarative/extra/qfxflowview.cpp +++ b/src/declarative/extra/qfxflowview.cpp @@ -71,7 +71,6 @@ QFxFlowView::QFxFlowView() : m_columns(0), m_model(0), m_vertical(false), m_dragItem(0), m_dragIdx(-1) { setAcceptedMouseButtons(Qt::LeftButton); - setOptions(MouseEvents); } QFxVisualItemModel *QFxFlowView::model() const diff --git a/src/declarative/extra/qfxparticles.cpp b/src/declarative/extra/qfxparticles.cpp index 13c14b0..0f22165 100644 --- a/src/declarative/extra/qfxparticles.cpp +++ b/src/declarative/extra/qfxparticles.cpp @@ -343,7 +343,7 @@ public: QFxParticlesPainter(QFxParticlesPrivate *p, QFxItem* parent) : QFxItem(parent), d(p) { - setOptions(HasContents); + setFlag(QGraphicsItem::ItemHasNoContents, false); maxX = minX = maxY = minY = 0; } @@ -600,7 +600,7 @@ QFxParticles::QFxParticles(QFxItem *parent) { Q_D(QFxParticles); d->init(); - setOptions(HasContents); + setFlag(QGraphicsItem::ItemHasNoContents, false); } QFxParticles::QFxParticles(QFxParticlesPrivate &dd, QFxItem *parent) @@ -608,7 +608,7 @@ QFxParticles::QFxParticles(QFxParticlesPrivate &dd, QFxItem *parent) { Q_D(QFxParticles); d->init(); - setOptions(HasContents); + setFlag(QGraphicsItem::ItemHasNoContents, false); } QFxParticles::~QFxParticles() diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp index e73c8a4..bd0c1be 100644 --- a/src/declarative/fx/qfxflickable.cpp +++ b/src/declarative/fx/qfxflickable.cpp @@ -111,7 +111,7 @@ void QFxFlickablePrivate::init() QObject::connect(&_tl, SIGNAL(updated()), q, SLOT(ticked())); QObject::connect(&_tl, SIGNAL(completed()), q, SLOT(movementEnding())); q->setAcceptedMouseButtons(Qt::LeftButton); - q->setOptions(QFxItem::ChildMouseFilter | QFxItem::MouseEvents); + q->setOptions(QFxItem::ChildMouseFilter); QObject::connect(_flick, SIGNAL(xChanged()), q, SIGNAL(positionChanged())); QObject::connect(_flick, SIGNAL(yChanged()), q, SIGNAL(positionChanged())); QObject::connect(&elasticX, SIGNAL(updated()), q, SLOT(ticked())); diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index e54dd9b..f1be4a4 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -113,13 +113,13 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Image,QFxImage) QFxImage::QFxImage(QFxItem *parent) : QFxItem(*(new QFxImagePrivate), parent) { - setOptions(SimpleItem | HasContents, true); + setFlag(QGraphicsItem::ItemHasNoContents, false); } QFxImage::QFxImage(QFxImagePrivate &dd, QFxItem *parent) : QFxItem(dd, parent) { - setOptions(SimpleItem | HasContents, true); + setFlag(QGraphicsItem::ItemHasNoContents, false); } QFxImage::~QFxImage() @@ -561,7 +561,6 @@ void QFxImage::requestFinished() d->status = Error; } d->pix = QFxPixmap(d->url); - setOptions(QFxImage::SimpleItem, true); } setImplicitWidth(d->pix.width()); setImplicitHeight(d->pix.height()); @@ -612,7 +611,6 @@ void QFxImage::setGridScaledImage(const QFxGridScaledImage& sci) sg->setBottom(sci.gridBottom()); sg->setLeft(sci.gridLeft()); sg->setRight(sci.gridRight()); - setOptions(QFxImage::SimpleItem, false); d->sciurl = d->url.resolved(QUrl(sci.pixmapUrl())); d->reply = QFxPixmap::get(qmlEngine(this), d->sciurl, this, SLOT(requestFinished())); diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index cc86b03..bb001c5 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -1689,31 +1689,6 @@ QmlList* QFxItem::transform() } /*! - Creates a new child of the given component \a type. The - newChildCreated() signal will be emitted when and if the child is - successfully created. - - \preliminary -*/ -void QFxItem::newChild(const QString &type) -{ - Q_D(QFxItem); - - QUrl url = qmlContext(this)->resolvedUrl(QUrl(type)); - if (url.isEmpty()) - return; - - d->_qmlnewloading.append(url); - d->_qmlnewcomp.append(new QmlComponent(qmlEngine(this), url, this)); - - if (!d->_qmlnewcomp.last()->isLoading()) - qmlLoaded(); - else - connect(d->_qmlnewcomp.last(), SIGNAL(statusChanged(QmlComponent::Status)), - this, SLOT(qmlLoaded())); -} - -/*! classBegin() is called when the item is constructed, but its properties have not yet been set. @@ -2119,11 +2094,7 @@ void QFxItem::setOptions(Options options, bool set) else d->options &= ~options; - setFlag(QGraphicsItem::ItemHasNoContents, !(d->options & HasContents)); setFiltersChildEvents(d->options & ChildMouseFilter); - setFlag(QGraphicsItem::ItemAcceptsInputMethod, (d->options & AcceptsInputMethods)); - setAcceptHoverEvents(d->options & HoverEvents); - setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy, d->options & IsFocusRealm); if ((old & MouseFilter) != (d->options & MouseFilter)) { diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index 0ce2a11..221f057 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -156,12 +156,7 @@ public: enum Option { NoOption = 0x00000000, MouseFilter = 0x00000001, ChildMouseFilter = 0x00000002, - HoverEvents = 0x00000004, - MouseEvents = 0x00000008, - HasContents = 0x00000010, - SimpleItem = 0x00000020, - IsFocusRealm = 0x00000080, - AcceptsInputMethods = 0x00000100 }; + IsFocusRealm = 0x00000080 }; Q_DECLARE_FLAGS(Options, Option) enum TransformOrigin { @@ -234,9 +229,6 @@ public: QVariant inputMethodQuery(Qt::InputMethodQuery query) const; //### for KeyProxy -public Q_SLOTS: - void newChild(const QString &url); - Q_SIGNALS: void xChanged(); void yChanged(); diff --git a/src/declarative/fx/qfxkeyproxy.cpp b/src/declarative/fx/qfxkeyproxy.cpp index 13f4bfb..0a9a151 100644 --- a/src/declarative/fx/qfxkeyproxy.cpp +++ b/src/declarative/fx/qfxkeyproxy.cpp @@ -96,7 +96,7 @@ public: QFxKeyProxy::QFxKeyProxy(QFxItem *parent) : QFxItem(parent), d(new QFxKeyProxyPrivate) { - setOptions(AcceptsInputMethods); + setFlag(QGraphicsItem::ItemAcceptsInputMethod); } QFxKeyProxy::~QFxKeyProxy() @@ -166,7 +166,7 @@ void QFxKeyProxy::inputMethodEvent(QInputMethodEvent *e) d->inIM = true; for (int ii = 0; ii < d->targets.count(); ++ii) { QFxItem *i = qobject_cast(scene()->focusItem(d->targets.at(ii))); - if (i && (i->options() & AcceptsInputMethods)) { + if (i && (i->flags() & ItemAcceptsInputMethod)) { scene()->sendEvent(i, e); if (e->isAccepted()) { d->imeItem = i; @@ -183,7 +183,7 @@ QVariant QFxKeyProxy::inputMethodQuery(Qt::InputMethodQuery query) const { for (int ii = 0; ii < d->targets.count(); ++ii) { QFxItem *i = qobject_cast(scene()->focusItem(d->targets.at(ii))); - if (i && (i->options() & AcceptsInputMethods) && i == d->imeItem) { //### how robust is i == d->imeItem check? + if (i && (i->flags() & ItemAcceptsInputMethod) && i == d->imeItem) { //### how robust is i == d->imeItem check? QVariant v = i->inputMethodQuery(query); if (v.type() == QVariant::RectF) v = mapRectFromItem(i, v.toRectF()); //### cost? diff --git a/src/declarative/fx/qfxlineedit.cpp b/src/declarative/fx/qfxlineedit.cpp index a185383..bef77e7 100644 --- a/src/declarative/fx/qfxlineedit.cpp +++ b/src/declarative/fx/qfxlineedit.cpp @@ -475,8 +475,8 @@ void QFxLineEditPrivate::init() control->setLayoutDirection(Qt::LeftToRight); q->setSmooth(true); q->setAcceptedMouseButtons(Qt::LeftButton); - q->setOptions(QFxLineEdit::AcceptsInputMethods | QFxLineEdit::SimpleItem - | QFxLineEdit::HasContents | QFxLineEdit::MouseEvents); + q->setFlag(QGraphicsItem::ItemHasNoContents, false); + q->setFlag(QGraphicsItem::ItemAcceptsInputMethod); q->connect(control, SIGNAL(cursorPositionChanged(int,int)), q, SLOT(cursorPosChanged())); q->connect(control, SIGNAL(selectionChanged()), diff --git a/src/declarative/fx/qfxmouseregion_p.h b/src/declarative/fx/qfxmouseregion_p.h index 70d78f3..f03c334 100644 --- a/src/declarative/fx/qfxmouseregion_p.h +++ b/src/declarative/fx/qfxmouseregion_p.h @@ -74,7 +74,7 @@ public: { Q_Q(QFxMouseRegion); q->setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton); - q->setOptions(QFxItem::HoverEvents | QFxItem::MouseEvents); + q->setAcceptHoverEvents(true); } void saveEvent(QGraphicsSceneMouseEvent *event) { diff --git a/src/declarative/fx/qfxpathview_p.h b/src/declarative/fx/qfxpathview_p.h index be9509f..eeccc87 100644 --- a/src/declarative/fx/qfxpathview_p.h +++ b/src/declarative/fx/qfxpathview_p.h @@ -87,7 +87,7 @@ public: Q_Q(QFxPathView); _offset = 0; q->setAcceptedMouseButtons(Qt::NoButton); - q->setOptions(QFxItem::ChildMouseFilter | QFxItem::MouseEvents | QFxItem::IsFocusRealm); + q->setOptions(QFxItem::ChildMouseFilter | QFxItem::IsFocusRealm); q->connect(&tl, SIGNAL(updated()), q, SLOT(ticked())); } diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index 7010ba1..58bd50c 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -239,7 +239,7 @@ QFxRect::QFxRect(QFxItem *parent) { Q_D(QFxRect); d->init(); - setOptions(HasContents, true); + setFlag(QGraphicsItem::ItemHasNoContents, false); } QFxRect::QFxRect(QFxRectPrivate &dd, QFxItem *parent) @@ -247,7 +247,7 @@ QFxRect::QFxRect(QFxRectPrivate &dd, QFxItem *parent) { Q_D(QFxRect); d->init(); - setOptions(HasContents, true); + setFlag(QGraphicsItem::ItemHasNoContents, false); } void QFxRect::doUpdate() diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index e0692e9..cb8af40 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -110,7 +110,7 @@ QFxText::QFxText(QFxItem *parent) Q_D(QFxText); d->init(); setAcceptedMouseButtons(Qt::LeftButton); - setOptions(SimpleItem | HasContents | QFxText::MouseEvents); + setFlag(QGraphicsItem::ItemHasNoContents, false); } QFxText::QFxText(QFxTextPrivate &dd, QFxItem *parent) @@ -119,7 +119,7 @@ QFxText::QFxText(QFxTextPrivate &dd, QFxItem *parent) Q_D(QFxText); d->init(); setAcceptedMouseButtons(Qt::LeftButton); - setOptions(SimpleItem | HasContents | QFxText::MouseEvents); + setFlag(QGraphicsItem::ItemHasNoContents, false); } QFxText::~QFxText() diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index abad7fc..b632268 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -1016,8 +1016,8 @@ void QFxTextEditPrivate::init() q->setSmooth(true); q->setAcceptedMouseButtons(Qt::LeftButton); - q->setOptions(QFxTextEdit::AcceptsInputMethods | QFxTextEdit::SimpleItem - | QFxTextEdit::HasContents | QFxTextEdit::MouseEvents); + q->setFlag(QGraphicsItem::ItemHasNoContents, false); + q->setFlag(QGraphicsItem::ItemAcceptsInputMethod); QObject::connect(&font, SIGNAL(updated()), q, SLOT(fontChanged())); diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp index 83f9249..75cb624 100644 --- a/src/declarative/fx/qfxwebview.cpp +++ b/src/declarative/fx/qfxwebview.cpp @@ -236,7 +236,7 @@ void QFxWebView::init() Q_D(QFxWebView); setAcceptedMouseButtons(Qt::LeftButton); - setOptions(HasContents | MouseEvents); + setFlag(QGraphicsItem::ItemHasNoContents, false); d->page = 0; } -- cgit v0.12