K
K
Kirill H2017-01-31 15:26:16
Qt
Kirill H, 2017-01-31 15:26:16

How to handle closing a QT form?

The survey does not accurately convey the essence of what I need. Everything is simple in principle, and I assume that it is solved with the help of slots, but it is not clear yet. I am already familiar with slots, but only how to use them when interacting with form elements.
In the main function, a dialog box is launched and displayed, after which there is code that needs to be processed after it is closed.

int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime()));

    PlayDialog *myPlayDialog = new PlayDialog();
    myPlayDialog->show();

    //Дальнейшая часть кода должна выполнятся после закрытия диалогового окна.

    QGraphicsScene scene;
    scene.setSceneRect(-300, -300, 600, 600);

    scene.setItemIndexMethod(QGraphicsScene::NoIndex);

    TAquarium myAquarium;

    QGraphicsView view(&scene);
    myAquarium.Init(&scene, &view);
    myAquarium.Run(&scene);
    
    return app.exec();
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
Jacob E, 2017-01-31
@KirillHelm

dialog.exec();

L
leremin, 2017-01-31
@leremin

The closeEvent() signal should be something like this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question