gal
5th August 2015, 15:45
Hi!
I have a QGraphicsScene set in a QGraphicsView
In the scene I put a pixmap which is movable.
If the user drags and drops the pixmap inside the QGraphicsScene, on the drop action, I want to do some things in my program.
_scene = std::make_shared<QGraphicsScene>();
ui->graphicsView->setScene(_scene.get());
QGraphicsPixmapItem* pixmap = _scene->addPixmap(QPixmap::fromImage(some_QImage);
pixmap->setFlag(QGraphicsItem::ItemIsMovable);
Does anyone know how to do such a thing? Is it possible with reimplementation of dragEnterEvent, dragMoveEvent, dropEvent? I tried it in the GraphicsScene and the GraphicsView but it didn't reach my reimplemented event methods.
Thank you
Gal
I have a QGraphicsScene set in a QGraphicsView
In the scene I put a pixmap which is movable.
If the user drags and drops the pixmap inside the QGraphicsScene, on the drop action, I want to do some things in my program.
_scene = std::make_shared<QGraphicsScene>();
ui->graphicsView->setScene(_scene.get());
QGraphicsPixmapItem* pixmap = _scene->addPixmap(QPixmap::fromImage(some_QImage);
pixmap->setFlag(QGraphicsItem::ItemIsMovable);
Does anyone know how to do such a thing? Is it possible with reimplementation of dragEnterEvent, dragMoveEvent, dropEvent? I tried it in the GraphicsScene and the GraphicsView but it didn't reach my reimplemented event methods.
Thank you
Gal