I have a Qt application that uses QPointers to create new user interface dialogs (widgets). The main application can have many identical widgets loaded with different data. The problem I am facing is deleting and freeing memory for each widget. If I track the use of RAM in the program, every time I press a button to open one of these new widgets, it increases the plunger, and when I close the widget, it does not seem to free the ram. I tried using deleteLaterother solutions, but I continue to get crashes in the program.
Sample code example:
QPointer<ListReservations> listResWindow = new ListReservations(resID);
listResWindow->setNum(numpeople);
listResWindow->show();
This will call the "ListReservations" widget, which is declared as QDialog(NOT modal). In this dialog box, I have a button to close the window that calls the slot QWidget::close().
I think the question is how my main program (c QPointer) knows when the dialog is closed, then free the dialog and (if possible) delete the pointer to save even more memory ...
I thought you could do QConnect()for the object QPointer, but I can’t find any signals or slots that would allow the pointer to be transmitted, much less send a signal after the dialogue is really closed and ready to be deleted.
, - , -, QDialog, ? ? , , ....
, , ListReservations.