summaryrefslogtreecommitdiffstats
path: root/examples/widgets/mainwindows/application
diff options
context:
space:
mode:
authorJoni Poikelin <joni.poikelin@theqtcompany.com>2016-04-07 08:02:52 +0300
committerJoni Poikelin <joni.poikelin@theqtcompany.com>2016-04-07 08:39:37 +0000
commit684ae5f7fecf005b4086e512332028eea737fa64 (patch)
treee4d5620d989136a235c2bc1001af1057f1c0a1cc /examples/widgets/mainwindows/application
parent7d1e6ca1998f6fd26795b1f9e408ccd7c7c0b558 (diff)
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>
Diffstat (limited to 'examples/widgets/mainwindows/application')
-rw-r--r--examples/widgets/mainwindows/application/mainwindow.cpp5
-rw-r--r--examples/widgets/mainwindows/application/mainwindow.h2
2 files changed, 6 insertions, 1 deletions
diff --git a/examples/widgets/mainwindows/application/mainwindow.cpp b/examples/widgets/mainwindows/application/mainwindow.cpp
index 861b908189..7d97cfd7f0 100644
--- a/examples/widgets/mainwindows/application/mainwindow.cpp
+++ b/examples/widgets/mainwindows/application/mainwindow.cpp
@@ -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
diff --git a/examples/widgets/mainwindows/application/mainwindow.h b/examples/widgets/mainwindows/application/mainwindow.h
index 9712604125..690e8ebc32 100644
--- a/examples/widgets/mainwindows/application/mainwindow.h
+++ b/examples/widgets/mainwindows/application/mainwindow.h
@@ -70,7 +70,9 @@ private slots:
bool saveAs();
void about();
void documentWasModified();
+#ifndef QT_NO_SESSIONMANAGER
void commitData(QSessionManager &);
+#endif
private:
void createActions();