diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-07-10 05:47:09 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-07-10 05:47:09 (GMT) |
commit | 2f67ba6d618228946ce35364c32d89a49385166a (patch) | |
tree | b400dfd9c4fa17abd3ba65f2544989af6c71e657 /src/declarative | |
parent | 2c037146daedb7ac0a2f8176ca9ce9b3751d5ced (diff) | |
download | Qt-2f67ba6d618228946ce35364c32d89a49385166a.zip Qt-2f67ba6d618228946ce35364c32d89a49385166a.tar.gz Qt-2f67ba6d618228946ce35364c32d89a49385166a.tar.bz2 |
Fix ChildMouseFilter
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/fx/qfxflickable.cpp | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxitem.cpp | 15 | ||||
-rw-r--r-- | src/declarative/fx/qfxitem.h | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxpathview_p.h | 2 |
4 files changed, 10 insertions, 11 deletions
diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp index 59191c9..47b7aa1 100644 --- a/src/declarative/fx/qfxflickable.cpp +++ b/src/declarative/fx/qfxflickable.cpp @@ -1047,7 +1047,7 @@ bool QFxFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) break; } grabber = static_cast<QFxItem*>(mouseGrabberItem()); - if (grabber && d->stealMouse && !grabber->keepMouseGrab()) + if (grabber && d->stealMouse && !grabber->keepMouseGrab() && grabber != this) grabMouse(); return d->stealMouse; diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index da4f1b3..686ec8d 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -2428,7 +2428,7 @@ bool QFxItem::hasFocus() const return false; } -bool QFxItem::eventFilter(QObject *o, QEvent *e) +bool QFxItem::sceneEventFilter(QGraphicsItem *w, QEvent *e) { switch(e->type()) { case QEvent::GraphicsSceneMouseDoubleClick: @@ -2442,7 +2442,7 @@ bool QFxItem::eventFilter(QObject *o, QEvent *e) break; } - return QObject::eventFilter(o, e); + return QGraphicsItem::sceneEventFilter(w, e); } void QFxItem::setOptions(Options options, bool set) @@ -2461,6 +2461,7 @@ void QFxItem::setOptions(Options options, bool set) } setFlag(QGraphicsItem::ItemHasNoContents, !(d->options & HasContents)); + setFiltersChildEvents(d->options & ChildMouseFilter); if ((old & MouseFilter) != (d->options & MouseFilter)) { if (d->options & MouseFilter) @@ -2510,17 +2511,15 @@ void QFxItem::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) void QFxItemPrivate::gvRemoveMouseFilter() { Q_Q(QFxItem); - if (!canvas) return; - - canvas->removeEventFilter(q); + if (q->scene()) + q->removeSceneEventFilter(q); } void QFxItemPrivate::gvAddMouseFilter() { Q_Q(QFxItem); - if (!canvas) return; - - canvas->installEventFilter(q); + if (q->scene()) + q->installSceneEventFilter(q); } QPixmap QFxItem::string(const QString &str, const QColor &c, const QFont &f) diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index bb48d16..0203e6e 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -302,7 +302,7 @@ Q_SIGNALS: protected: virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); virtual void childrenChanged(); - virtual bool eventFilter(QObject *, QEvent *); + virtual bool sceneEventFilter(QGraphicsItem *, QEvent *); virtual bool sceneEvent(QEvent *); virtual QVariant itemChange(GraphicsItemChange, const QVariant &); virtual bool mouseFilter(QGraphicsSceneMouseEvent *); diff --git a/src/declarative/fx/qfxpathview_p.h b/src/declarative/fx/qfxpathview_p.h index f996d1d..63c8224 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::MouseFilter | QFxItem::MouseEvents | QFxItem::IsFocusRealm); + q->setOptions(QFxItem::ChildMouseFilter | QFxItem::MouseEvents | QFxItem::IsFocusRealm); q->connect(&tl, SIGNAL(updated()), q, SLOT(ticked())); } |