[Solved] QMdiArea simple question



  • Hi,
    I have a QMdiArea defined in a QMainWindow. I have several QWidgets defined and i want to add these widgets to my QMdiArea.I am unable to figure out how to create a layout and add the widgets to my QMdiArea.

    @

    void MainWindow::createDockWindows()
    {
    QDockWidget *dock = new QDockWidget(tr("Graphs"), this);
    dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);

    mdiArea = new QMdiArea;
    mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    dock->setWidget(mdiArea);
    addDockWidget(Qt::RightDockWidgetArea, dock);
    viewMenu->addAction(dock->toggleViewAction());
    

    }

    void MainWindow::addGraph()
    {
    QMdiSubWindow* subWindow = new QMdiSubWindow();
    internalCgWidget = new CallgraphWidget;
    subWindow->setWidget(internalCgWidget);
    mdiArea->addSubWindow(subWindow);
    qDebug() << "Added";
    }
    @

    I get the message "Added" but it does not show up in my QMdiArea. Where am i going wrong can someone give a simple code snippet to help.

    I appreciate your help.



  • Try subWindow->show().


Log in to reply
 

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