Hello!
I have a class which inherits from QGraphicsScene.
QGraphicsScene has some private slots and i want to you use them.
Is there any way to connect these slots to signals?
For example - if i double click on the scene, i want a signal to be send.
i tried writing it but it looked like QGraphicsScene has no signals.
here is the code:
class Myscene : public QGraphicsScene
{
Q_OBJECT
public:
Myscene();
~Myscene();
private slots:
void keyPressEvent(QKeyEvent *);
void mouseMoveEvent(QGraphicsSceneMouseEvent *);
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *);
void mousePressEvent(QGraphicsSceneMouseEvent *);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *);
private:
QGraphicsScene * m_scene;
};
Myscene::Myscene()
{
m_scene = new QGraphicsScene(this);
connect(m_scene, SIGNAL(KeyPressEvent(QKeyEvent *)), SLOT(KeyPressEvent(QKeyEvent *)));
connect(m_scene, SIGNAL(mouseMoveEvent(QGraphicsSceneMouseEvent *)), SLOT(mouseMoveEvent(QGraphicsSceneMouseEvent *)));
connect(m_scene, SIGNAL(mouseDoubleClickEvent(QGraphicsSceneMouseEv ent *)), SLOT(mouseDoubleClickEvent(QGraphicsSceneMouseEven t *)));
connect(m_scene, SIGNAL(mousePressEvent(QGraphicsSceneMouseEvent *)), SLOT(mousePressEvent(QGraphicsSceneMouseEvent *)));
connect(m_scene, SIGNAL(mouseReleaseEvent(QGraphicsSceneMouseEvent *)), SLOT(mouseReleaseEvent(QGraphicsSceneMouseEvent *)));
}
Bookmarks