[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kde-runtime] plasma/declarativeimports/draganddrop: manage also
From:       Marco Martin <notmart () gmail ! com>
Date:       2011-12-15 17:45:54
Message-ID: 20111215174554.448C7A60B9 () git ! kde ! org
[Download RAW message or body]

Git commit a4184f3e3feadc370e7c9c2add9a49fa68c1e8c7 by Marco Martin.
Committed on 15/12/2011 at 18:45.
Pushed by mart into branch 'master'.

manage also mouse moves of children

M  +16   -0    plasma/declarativeimports/draganddrop/DeclarativeDragArea.cpp
M  +1    -0    plasma/declarativeimports/draganddrop/DeclarativeDragArea.h

http://commits.kde.org/kde-runtime/a4184f3e3feadc370e7c9c2add9a49fa68c1e8c7

diff --git a/plasma/declarativeimports/draganddrop/DeclarativeDragArea.cpp \
b/plasma/declarativeimports/draganddrop/DeclarativeDragArea.cpp index \
                0c7006a..7af7441 100644
--- a/plasma/declarativeimports/draganddrop/DeclarativeDragArea.cpp
+++ b/plasma/declarativeimports/draganddrop/DeclarativeDragArea.cpp
@@ -46,6 +46,7 @@ DeclarativeDragArea::DeclarativeDragArea(QDeclarativeItem *parent)
 	m_data(new DeclarativeMimeData())	// m_data is owned by us, and we shouldn't pass \
it to Qt directly as it will automatically delete it after the drag and drop.  {
 	setAcceptedMouseButtons(Qt::LeftButton);
+    setFiltersChildEvents(true);
 }
 
 DeclarativeDragArea::~DeclarativeDragArea()
@@ -184,3 +185,18 @@ void \
DeclarativeDragArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event)  Qt::DropAction \
action = drag->exec(m_supportedActions, m_defaultAction);  emit drop(action);
 }
+
+
+bool DeclarativeDragArea::sceneEventFilter(QGraphicsItem *item, QEvent *event)
+{
+    if (!isEnabled()) {
+        return false;
+    }
+
+    if (event->type() == QEvent::GraphicsSceneMouseMove) {
+        QGraphicsSceneMouseEvent *me = static_cast<QGraphicsSceneMouseEvent \
*>(event); +        mouseMoveEvent(me);
+    }
+
+    return QDeclarativeItem::sceneEventFilter(item, event);
+}
\ No newline at end of file
diff --git a/plasma/declarativeimports/draganddrop/DeclarativeDragArea.h \
b/plasma/declarativeimports/draganddrop/DeclarativeDragArea.h index 7edfa5b..c25b96a \
                100644
--- a/plasma/declarativeimports/draganddrop/DeclarativeDragArea.h
+++ b/plasma/declarativeimports/draganddrop/DeclarativeDragArea.h
@@ -81,6 +81,7 @@ protected:
 	void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
 	void mousePressEvent(QGraphicsSceneMouseEvent *) {}
 	void mouseReleaseEvent(QGraphicsSceneMouseEvent *) {}
+	bool sceneEventFilter(QGraphicsItem *item, QEvent *event);
 
 private:
 	QDeclarativeComponent* m_delegate;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic