Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

Drag and Drop Using QGraphicsView/QGraphicsScene and QGraphicsItem

$
0
0
Hi, I am trying to implement and test a simple drag and drop scenario using drag and drop within the context of QGraphicsView/QGraphicsScene. I am using the 40000 Chips example from Qt as a starting point. I am simply trying to implement drag on drop when a chip is dragged in one of the views. I added the following to GraphicsView (implementation of QDragMoveEvent): class GraphicsView : public QGraphicsView { Q_OBJECT public: GraphicsView(View *v) : QGraphicsView(), view(v) { } protected: #ifndef QT_NO_WHEELEVENT void wheelEvent(QWheelEvent *); #endif private: View *view; protected: virtual void dragMoveEvent(QDragMoveEvent * event); }; void View::dragMoveEvent(QGraphicsSceneDragDropEvent *event) { qDebug() << “In dragMoveEvent”; } However, when I drag a chip around inside a view, I am not seeing that dragMoveEvent is being called. What am I doing wrong here? Shouldn’t this method be called when chips are dragged within a view? Thanks. -Jon

Viewing all articles
Browse latest Browse all 13965

Latest Images

Trending Articles



Latest Images