@AnneRanch said:
// QMdiArea is a container of subwindows // Get a list of pointers to those subwindows and assign it to a local list variable named "windows" QList<QMdiSubWindow *> windows = mdiArea->subWindowList(); // Assign i-th element of that list to a local variable "mdiSubWindow" QMdiSubWindow *mdiSubWindow = windows.at(i); // QMdiSubWindow is a container that hosts a widget. // Retrieve a pointer to that widget // Try to cast that pointer to a pointer to type MdiChild and assign the result to local variable "child" // If the cast succeeds then the variable "child" points to the widget hosted by QMdiSubWindow // If the cast fails (widget is not a MdiChild class) then the variable "child" is a nullptr MdiChild *child = qobject_cast<MdiChild *>(mdiSubWindow->widget());As usual , I like to get plain English description of the following pointer usage
somebody comes up with a way to memorize what is definition and what is a declaration
You can try to remember it by imagining a herald on a town square. He's declaring, or in other words announcing that something exists e.g. "Hello good people. The function x exists! Let's be happy!".
Then someone from the crowd asks "ok, but what is it?" and a local scientist defines it, or in other words explains/describes it in detail, saying that "x is this and that my friends and it does this in that way".
Herald is your header declaration guy.
Scientist is your cpp definition guy.