Adding events to GraphicsView created with designer
I work with qtcreator to make qt apps.
I want to add mouseReleaseEvent to graphicsView created already with designer.
Here is my subclass
Code:
Q_OBJECT
public:
protected:
private slots:
private:
};
Here is the code for creating scene on view and adding items
Code:
{
scene->setSceneRect(0, 0, 250, 500);
view_skel->setScene(scene);
ImageItem *image;
image
= new ImageItem
(1,
QPixmap("icons/skel2.png"));
image->setData(0, 0);
image->setPos(30, 100);
scene->addItem(image);
}
I call it from
Code:
MainWindow
::MainWindow(QWidget *parent
)
{
ui->setupUi(this);
MyView(ui->graphicsView_skel);
}
Everything is ok but mouse relase event doesnt work
Code:
{
printf("Mouse released\n");
}
Can anyone help me?
Re: Adding events to GraphicsView created with designer
replace the virtual function ..
QGraphicsView:mouseReleaseEvent(QMouseEvent *event)
with ....
QGraphicsView ::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Re: Adding events to GraphicsView created with designer
Quote:
Originally Posted by
wagmare
replace the virtual function ..
QGraphicsView:mouseReleaseEvent(QMouseEvent *event)
with ....
QGraphicsView ::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Didnt worked. I am writing all project again without qtdesigner.
Thanks.