diff options
-rw-r--r-- | src/declarative/fx/qfxcomponentinstance.cpp | 4 | ||||
-rw-r--r-- | src/declarative/fx/qfxflickable.cpp | 10 | ||||
-rw-r--r-- | src/declarative/fx/qfxflickable.h | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxfocusrealm.cpp | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxgridview.cpp | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxitem.cpp | 49 | ||||
-rw-r--r-- | src/declarative/fx/qfxitem.h | 12 | ||||
-rw-r--r-- | src/declarative/fx/qfxitem_p.h | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxlistview.cpp | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxpathview.cpp | 8 | ||||
-rw-r--r-- | src/declarative/fx/qfxpathview.h | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxpathview_p.h | 3 |
12 files changed, 18 insertions, 80 deletions
diff --git a/src/declarative/fx/qfxcomponentinstance.cpp b/src/declarative/fx/qfxcomponentinstance.cpp index a85b25d..f38d170 100644 --- a/src/declarative/fx/qfxcomponentinstance.cpp +++ b/src/declarative/fx/qfxcomponentinstance.cpp @@ -73,13 +73,13 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,ComponentInstance,QFxComponentIn QFxComponentInstance::QFxComponentInstance(QFxItem *parent) : QFxItem(*(new QFxComponentInstancePrivate), parent) { - setOptions(IsFocusRealm); + setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy); } QFxComponentInstance::QFxComponentInstance(QFxComponentInstancePrivate &dd, QFxItem *parent) : QFxItem(dd, parent) { - setOptions(IsFocusRealm); + setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy); } /*! diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp index 4b504cb..d413e42 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); + q->setFiltersChildEvents(true); QObject::connect(_flick, SIGNAL(xChanged()), q, SIGNAL(positionChanged())); QObject::connect(_flick, SIGNAL(yChanged()), q, SIGNAL(positionChanged())); QObject::connect(&elasticX, SIGNAL(updated()), q, SLOT(ticked())); @@ -1062,20 +1062,20 @@ bool QFxFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) return false; } -bool QFxFlickable::mouseFilter(QGraphicsSceneMouseEvent *e) +bool QFxFlickable::sceneEventFilter(QGraphicsItem *i, QEvent *e) { if (!isVisible()) - return false; + return QFxItem::sceneEventFilter(i, e); switch (e->type()) { case QEvent::GraphicsSceneMousePress: case QEvent::GraphicsSceneMouseMove: case QEvent::GraphicsSceneMouseRelease: - return sendMouseEvent(e); + return sendMouseEvent(static_cast<QGraphicsSceneMouseEvent *>(e)); default: break; } - return false; + return QFxItem::sceneEventFilter(i, e); } /*! diff --git a/src/declarative/fx/qfxflickable.h b/src/declarative/fx/qfxflickable.h index a6c2a6c..4fcaf44 100644 --- a/src/declarative/fx/qfxflickable.h +++ b/src/declarative/fx/qfxflickable.h @@ -151,7 +151,7 @@ Q_SIGNALS: void pageChanged(); protected: - virtual bool mouseFilter(QGraphicsSceneMouseEvent *); + virtual bool sceneEventFilter(QGraphicsItem *, QEvent *); void mousePressEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); diff --git a/src/declarative/fx/qfxfocusrealm.cpp b/src/declarative/fx/qfxfocusrealm.cpp index e22d721..4484378 100644 --- a/src/declarative/fx/qfxfocusrealm.cpp +++ b/src/declarative/fx/qfxfocusrealm.cpp @@ -63,7 +63,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,FocusRealm,QFxFocusRealm) QFxFocusRealm::QFxFocusRealm(QFxItem *parent) : QFxItem(parent) { - setOptions(IsFocusRealm); + setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy); } QFxFocusRealm::~QFxFocusRealm() diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index 8df6f2a..eb85c20 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -325,7 +325,7 @@ public: void QFxGridViewPrivate::init() { Q_Q(QFxGridView); - q->setOptions(QFxGridView::IsFocusRealm); + q->setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy); QObject::connect(q, SIGNAL(widthChanged()), q, SLOT(sizeChange())); QObject::connect(q, SIGNAL(heightChanged()), q, SLOT(sizeChange())); } diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 5eb2516..b658563 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -1622,17 +1622,6 @@ QPointF QFxItemPrivate::computeTransformOrigin() const } } -QFxItem::Options QFxItem::options() const -{ - Q_D(const QFxItem); - return (QFxItem::Options)d->options; -} - -bool QFxItem::mouseFilter(QGraphicsSceneMouseEvent *) -{ - return false; -} - bool QFxItem::sceneEvent(QEvent *event) { bool rv = QGraphicsItem::sceneEvent(event); @@ -1851,44 +1840,6 @@ bool QFxItem::hasActiveFocus() const return QGraphicsItem::hasFocus(); } -bool QFxItem::sceneEventFilter(QGraphicsItem *w, QEvent *e) -{ - switch(e->type()) { - case QEvent::GraphicsSceneMouseDoubleClick: - case QEvent::GraphicsSceneMouseMove: - case QEvent::GraphicsSceneMousePress: - case QEvent::GraphicsSceneMouseRelease: - if (mouseFilter(static_cast<QGraphicsSceneMouseEvent *>(e))) - return true; - break; - default: - break; - } - - return QGraphicsItem::sceneEventFilter(w, e); -} - -void QFxItem::setOptions(Options options, bool set) -{ - Q_D(QFxItem); - Options old = (Options)d->options; - - if (options & IsFocusRealm) { - if (!set) { - qWarning("QFxItem::setOptions: Cannot unset IsFocusRealm"); - return; - } - } - - if (set) - d->options |= options; - else - d->options &= ~options; - - setFiltersChildEvents(d->options & ChildMouseFilter); - setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy, d->options & IsFocusRealm); -} - void QFxItem::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) { } diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index d9a7621..e832a67 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -151,11 +151,6 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta Q_CLASSINFO("DefaultProperty", "data") public: - enum Option { NoOption = 0x00000000, - ChildMouseFilter = 0x00000002, - IsFocusRealm = 0x00000080 }; - Q_DECLARE_FLAGS(Options, Option) - enum TransformOrigin { TopLeft, Top, TopRight, Left, Center, Right, @@ -193,9 +188,6 @@ public: bool keepMouseGrab() const; void setKeepMouseGrab(bool); - Options options() const; - void setOptions(Options, bool set = true); - qreal width() const; void setWidth(qreal); @@ -227,11 +219,9 @@ Q_SIGNALS: protected: bool isComponentComplete() const; - virtual bool sceneEventFilter(QGraphicsItem *, QEvent *); virtual bool sceneEvent(QEvent *); virtual bool event(QEvent *); virtual QVariant itemChange(GraphicsItemChange, const QVariant &); - virtual bool mouseFilter(QGraphicsSceneMouseEvent *); virtual void mouseUngrabEvent(); void setImplicitWidth(qreal); @@ -272,8 +262,6 @@ private: Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxItem) }; -Q_DECLARE_OPERATORS_FOR_FLAGS(QFxItem::Options) - // ### move to QGO template<typename T> T qobject_cast(QGraphicsItem *item) diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h index ae95fb5..674eada 100644 --- a/src/declarative/fx/qfxitem_p.h +++ b/src/declarative/fx/qfxitem_p.h @@ -78,7 +78,6 @@ public: _componentComplete(true), _keepMouse(false), _anchorLines(0), _stateGroup(0), origin(QFxItem::TopLeft), - options(QFxItem::NoOption), widthValid(false), heightValid(false), width(0), height(0) {} ~QFxItemPrivate() @@ -177,7 +176,6 @@ public: QmlStateGroup *_stateGroup; QFxItem::TransformOrigin origin:4; - int options:10; bool widthValid:1; bool heightValid:1; diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index a78fed5..f976aec 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -392,7 +392,7 @@ public: void QFxListViewPrivate::init() { Q_Q(QFxListView); - q->setOptions(QFxListView::IsFocusRealm); + q->setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy); QObject::connect(q, SIGNAL(heightChanged()), q, SLOT(refill())); QObject::connect(q, SIGNAL(widthChanged()), q, SLOT(refill())); } diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp index ee3ad2b..17f6dd3 100644 --- a/src/declarative/fx/qfxpathview.cpp +++ b/src/declarative/fx/qfxpathview.cpp @@ -535,17 +535,17 @@ bool QFxPathView::sendMouseEvent(QGraphicsSceneMouseEvent *event) return false; } -bool QFxPathView::mouseFilter(QGraphicsSceneMouseEvent *e) +bool QFxPathView::sceneEventFilter(QGraphicsItem *i, QEvent *e) { if (!isVisible()) - return false; + return QFxItem::sceneEventFilter(i, e); switch (e->type()) { case QEvent::GraphicsSceneMousePress: case QEvent::GraphicsSceneMouseMove: case QEvent::GraphicsSceneMouseRelease: { - bool ret = sendMouseEvent(e); + bool ret = sendMouseEvent(static_cast<QGraphicsSceneMouseEvent *>(e)); if (e->type() == QEvent::GraphicsSceneMouseRelease) return ret; break; @@ -554,7 +554,7 @@ bool QFxPathView::mouseFilter(QGraphicsSceneMouseEvent *e) break; } - return false; + return QFxItem::sceneEventFilter(i, e); } void QFxPathViewPrivate::regenerate() diff --git a/src/declarative/fx/qfxpathview.h b/src/declarative/fx/qfxpathview.h index 9d91006..4b8f12d 100644 --- a/src/declarative/fx/qfxpathview.h +++ b/src/declarative/fx/qfxpathview.h @@ -108,7 +108,7 @@ protected: void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *); bool sendMouseEvent(QGraphicsSceneMouseEvent *event); - bool mouseFilter(QGraphicsSceneMouseEvent *e); + bool sceneEventFilter(QGraphicsItem *, QEvent *); private Q_SLOTS: void refill(); diff --git a/src/declarative/fx/qfxpathview_p.h b/src/declarative/fx/qfxpathview_p.h index eeccc87..eb5a1b1 100644 --- a/src/declarative/fx/qfxpathview_p.h +++ b/src/declarative/fx/qfxpathview_p.h @@ -87,7 +87,8 @@ public: Q_Q(QFxPathView); _offset = 0; q->setAcceptedMouseButtons(Qt::NoButton); - q->setOptions(QFxItem::ChildMouseFilter | QFxItem::IsFocusRealm); + q->setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy); + q->setFiltersChildEvents(true); q->connect(&tl, SIGNAL(updated()), q, SLOT(ticked())); } |