C++98 compatibility.

This commit is contained in:
mfreiholz
2016-02-12 07:15:10 +01:00
parent c74204d5b7
commit 08f1968b31
17 changed files with 77 additions and 67 deletions

View File

@@ -88,14 +88,17 @@ MainWindow::MainWindow(QWidget *parent) :
section->addContent(createCalendarSC());
_container->addSection(section);
QByteArray ba;
QFile f("test.dat");
if (f.open(QFile::ReadOnly))
if (true)
{
ba = f.readAll();
f.close();
QByteArray ba;
QFile f("test.dat");
if (f.open(QFile::ReadOnly))
{
ba = f.readAll();
f.close();
}
_container->restoreGeometry(ba);
}
_container->restoreGeometry(ba);
}
MainWindow::~MainWindow()
@@ -118,6 +121,7 @@ void MainWindow::onActionAddSectionContentTriggered()
void MainWindow::contextMenuEvent(QContextMenuEvent* e)
{
Q_UNUSED(e);
QMenu* m = _container->createContextMenu();
m->exec(QCursor::pos());
delete m;
@@ -125,11 +129,15 @@ void MainWindow::contextMenuEvent(QContextMenuEvent* e)
void MainWindow::closeEvent(QCloseEvent* e)
{
QByteArray ba = _container->saveGeometry();
QFile f("test.dat");
if (f.open(QFile::WriteOnly))
Q_UNUSED(e);
if (true)
{
f.write(ba);
f.close();
QByteArray ba = _container->saveGeometry();
QFile f("test.dat");
if (f.open(QFile::WriteOnly))
{
f.write(ba);
f.close();
}
}
}