When creating a sub-interface in the main interface, we usually create a pointer to the sub-window in the header file beforehand, and then initialize it where needed, which is not very convenient. So I tried to create a static pointer and it felt better. As shown in the figure below, the address of the pointer remains unchanged every time you click show to display the child window. Prove that this is feasible.
void Network::slotSetIp()
{
qDebug()<<__FUNCTION__;
static NetworkConfig* networkConfig = new NetworkConfig();
qDebug("%p\n",networkConfig);
networkConfig->setWindowModality(Qt::ApplicationModal);
networkConfig->show();
}