PDA

View Full Version : Moving a QMdiSubWindow



philwinder
31st October 2008, 23:13
Hi,
I'm having troubles moving the position of a sub window in a QMdiArea. When I am in the class that manages the QMdiSubWindow I attempt to move it via:

this->move(200,100);
However it doesnt work.

For an example, look at the Mdi example in the Qt Folder\examples\mainwindows\mdi. In the file mdichild.cpp, add the above code to line 55.

pastor
2nd November 2008, 11:12
Hello!

You should call move(...) for QMdiSubWindow, not for the widget (QTextEdit) inside it.
Please modify createMdiChild method in Qt Folder\examples\mainwindows\mdi\mainwindow.cpp, ln199:


MdiChild *MainWindow::createMdiChild()
{
MdiChild *child = new MdiChild;
QMdiSubWindow *sub = mdiArea->addSubWindow(child); // modified
sub->move(200,100); // added

connect(child, SIGNAL(copyAvailable(bool)),
cutAct, SLOT(setEnabled(bool)));
connect(child, SIGNAL(copyAvailable(bool)),
copyAct, SLOT(setEnabled(bool)));

return child;
}