I have a Qt Designer Class called MainWindow which is a QMainWindow. This class creates an MDI Area and has children windows, as MDI should.
One of these MDI children, we'll call wndChild which is also a QMainWindow, needs to spawn a "sibling" (that is, an MDI child of its parent, not an MDI child of its own). I figured the best way to do that would be to create a public function in the parent (MainWindow) which then creates the new MDI child.
The problem is, I'm not sure how to call this function from the child. I tried something like:
MainWindow *mdiparent=this->parentWidget();
mdiparent->spawnOtherChild();
But QMainWindow::parentWidget returns a pointer to a QWidget, not a QMainWindow, so I of course get an error.
How might I go about doing this?