I currently have 3 classes that are public QWidgets. -> x, y ,z are all qwidgets.
In my mainwindow I have pointers to x, y, z.
So the members:
X* m_x;
Y* m_y;
Z* m_z;
A member function:
void MainWindow::deleteScreen(QWidget** widget)
{
if(widget != NULL)
{
delete widget;
widget = NULL;
}
}
called as:
deleteScreen(&m_x);
-> causes invalid conversion.
If I changed the deleteScreen
param to QWidget* widget
and call as deleteScreen(m_x)
it will delete the memory but it won't set m_x
to NULL. (only the local variable, widget)
-> Is there any way to make the deleteScreen
function delete the given widget AND put the value of the member variable on NULL?
Thank you!