Solved.
MainWindowImpl
::MainWindowImpl( QWidget * parent, Qt
::WFlags f
) { // on constructor
setupUi(this); // required so menues appear
mdiArea = new QMdiArea;
mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
setCentralWidget(mdiArea);
setWindowTitle(tr("Spreadsheet"))
}
void MainWindowImpl
::createMdiWindow(const QString &fileName
) {
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;
}
MainWindowImpl::MainWindowImpl( QWidget * parent, Qt::WFlags f)
: QMainWindow(parent, f)
{ // on constructor
setupUi(this); // required so menues appear
mdiArea = new QMdiArea;
mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
setCentralWidget(mdiArea);
setWindowTitle(tr("Spreadsheet"))
}
void MainWindowImpl::createMdiWindow(const QString &fileName)
{
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;
}
To copy to clipboard, switch view to plain text mode
Bookmarks