Qt World Summit: Submit your Presentation

CascadeSubWindow QMdiArea

  • I have a lot of files that opens up in a cascade pattern if set (qMdiArea->cascadeSubWindows()).
    But when I move them away from each other and try to open a new file it gathers all the file together in a cascade pattern, but I want the files which were moved by the user to be in their places. And start cascading the new file from the left corner, and if there's any widget(qMdiArea or dialog) is available there then open the file right after that in cascade pattern, if there's any way to do that then please help me. Thanks in advance.

  • @Kita
    I am doing a QMdiArea with cascade() and tile() at the moment. They have their limitations, especially with a large number of sub windows they don't always do what you would like.

    I do not believe you can influence them to only do some, or "restart" from somewhere. It's not hard to intercept them and do your own (especially for cascade) to implement what you want instead, that is what I do.

    Here is mine (just as an example):

    void MainWindow::cascadeSubWindows()
        int xOffset = 0, yOffset = 0;
        for (QMdiSubWindow *subWindow: ui->mdiArea->subWindowList())
            subWindow->move(xOffset, yOffset);
            xOffset += 50;
            yOffset += 50;
            if (yOffset >= 500)
                yOffset = 0;
    connect(ui->actionCascade, &QAction::triggered, this, &MainWindow::cascadeSubWindows);

Log in to reply