Thanks for your post JD2000. I sort of understand but don't know how to implement it.... Are you sure you are a beginner?
Printable View
Thanks for your post JD2000. I sort of understand but don't know how to implement it.... Are you sure you are a beginner?
Very good JD200, I totally missed that one.Quote:
Well there you have it, each call to addSpreadSheet() creates a new subwindow with
You can use a QVector to manage your subWindows.Quote:
I sort of understand but don't know how to implement it....
Thanks but I haven't a clue how to implement this.
Solved.
Code:
{ // on constructor setupUi(this); // required so menues appear mdiArea = new QMdiArea; mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); setCentralWidget(mdiArea); setWindowTitle(tr("Spreadsheet")) } { Spreadsheet *spreadsheet = new Spreadsheet; QMdiSubWindow *subWindow = mdiArea->addSubWindow(spreadsheet); subWindow->show(); if (!fileName.isEmpty()) { // spreadsheet->load(fileName); statusBar()->showMessage(tr("File loaded"), 2000); } } void MainWindowImpl::newFile() { createMdiWindow(); } Spreadsheet *MainWindowImpl::activeSpreadsheet() { QMdiSubWindow *subWindow = mdiArea->activeSubWindow(); if (subWindow) return qobject_cast<Spreadsheet*>(subWindow->widget()); return 0; }