V
V
VerNika2016-03-20 23:29:37
Programming
VerNika, 2016-03-20 23:29:37

How to connect QGraphicsScene signal and QMainWindow slot?

There is a QMainWindow, on it is a QGraphicsView, which, in turn, is attached to a slightly overridden QGraphicsScene.
Code snippet:

class sectionPlane : public QMainWindow
{
    ...
public slots:
    void draw();
    ...
};

void sectionPlane::draw()
{
    ...
}

class GraphicsScene: public QGraphicsScene
{
    ...
signals:
    void move();
    ...
};

void GraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent *me)
{
    ...
    emit move();
}

How and where can they be connected?
connect(???, SIGNAL(move()), ???, SLOT(draw()));

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Jacob E, 2016-03-21
@Zifix

We make an object of the GraphicsScene class a field of MainWindow and we calmly bind everything in the constructor of the main window.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question