Fix compiling examples with -no-sm

There is access to session manager functions which are not present when
building with -no-sm.

Change-Id: I1c92b4a70f7adb56816877930fb9f55b04ff8940
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
This commit is contained in:
Joni Poikelin 2016-04-07 08:02:52 +03:00
parent 7d1e6ca199
commit 684ae5f7fe
2 changed files with 6 additions and 1 deletions

View File

@ -59,9 +59,11 @@ MainWindow::MainWindow()
connect(textEdit->document(), &QTextDocument::contentsChanged,
this, &MainWindow::documentWasModified);
#ifndef QT_NO_SESSIONMANAGER
QGuiApplication::setFallbackSessionManagementEnabled(false);
connect(qApp, &QGuiApplication::commitDataRequest,
this, &MainWindow::commitData);
#endif
setCurrentFile(QString());
setUnifiedTitleAndToolBarOnMac(true);
@ -387,7 +389,7 @@ QString MainWindow::strippedName(const QString &fullFileName)
return QFileInfo(fullFileName).fileName();
}
//! [49]
#ifndef QT_NO_SESSIONMANAGER
void MainWindow::commitData(QSessionManager &manager)
{
if (manager.allowsInteraction()) {
@ -399,3 +401,4 @@ void MainWindow::commitData(QSessionManager &manager)
save();
}
}
#endif

View File

@ -70,7 +70,9 @@ private slots:
bool saveAs();
void about();
void documentWasModified();
#ifndef QT_NO_SESSIONMANAGER
void commitData(QSessionManager &);
#endif
private:
void createActions();