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:
parent
7d1e6ca199
commit
684ae5f7fe
@ -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
|
||||
|
@ -70,7 +70,9 @@ private slots:
|
||||
bool saveAs();
|
||||
void about();
|
||||
void documentWasModified();
|
||||
#ifndef QT_NO_SESSIONMANAGER
|
||||
void commitData(QSessionManager &);
|
||||
#endif
|
||||
|
||||
private:
|
||||
void createActions();
|
||||
|
Loading…
x
Reference in New Issue
Block a user