PDA

View Full Version : mdi area and subwindow



sajis997
5th February 2012, 11:22
Hello forum,

I am trying to insert the elastic node example inside the window structure as follows:



ElasticMainWindow::ElasticMainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::ElasticMainWindow),
m_graph(0),
m_mdiArea(0),
m_subWindow(0)
{
ui->setupUi(this);

//create a mdi area
m_mdiArea = new QMdiArea(this);
m_mdiArea->setOption(QMdiArea::DontMaximizeSubWindowOnActivat ion,false);

createToolWindows();

//!set the mdi area as the central widget
//!and this is how it is used in the main window
setCentralWidget(m_mdiArea);

}


void ElasticMainWindow::createToolWindows()
{


m_graph = new GraphWidget();
m_graph->setWindowTitle(tr("Elastic Graph"));


m_subWindow = new QMdiSubWindow(m_graph,Qt::FramelessWindowHint);


m_mdiArea->addSubWindow(m_subWindow)->setWindowState(Qt::WindowMaximized);



}

ElasticMainWindow::~ElasticMainWindow()
{
delete ui;
}



But i do see anything when the program launches. It should be showing the nodes and edges connected to each other as in the main example.


Please point out if i miss anything.


Regards
Sajjad

norobro
5th February 2012, 14:51
Hi Sajjad;


Please point out if i miss anything.

See: QMdiSubWindow::setWidget ( QWidget * widget )