Resizing MDI subwindow?



  • Hi guys.

    Here is my code:
    @gameWindow = new GameWindow();
    mainWindow->mdiArea->addSubWindow(gameWindow);
    gameWindow->show();
    gameWindow->openVideoFile(projectPath->absoluteFilePath(map->videoName);.toUtf8().data());
    gameWindow->resize(gameWindow->videoWidth, gameWindow->videoHeight);@

    It worked, but size of the subwindow is incorrect. It's very small. But I can resize it manually.

    UPDATE: For my problem, this works well, but I don't know why:
    @gameWindow->parentWidget()->resize(gameWindow->videoWidth, gameWindow->videoHeight);@



  • mdiArea->addSubWindow returns a QMdiSubwindow instance, so that's why you need to call resize on the parent (which is the sub window itself). You can keep the returned pointer and call resize on it directly.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.