Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] QMdiArea simple question
QtWS25 Last Chance

[Solved] QMdiArea simple question

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 3.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    amban
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • W Offline
      W Offline
      wecing
      wrote on last edited by
      #2

      Try subWindow->show().

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved