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,
|
connect(textEdit->document(), &QTextDocument::contentsChanged,
|
||||||
this, &MainWindow::documentWasModified);
|
this, &MainWindow::documentWasModified);
|
||||||
|
|
||||||
|
#ifndef QT_NO_SESSIONMANAGER
|
||||||
QGuiApplication::setFallbackSessionManagementEnabled(false);
|
QGuiApplication::setFallbackSessionManagementEnabled(false);
|
||||||
connect(qApp, &QGuiApplication::commitDataRequest,
|
connect(qApp, &QGuiApplication::commitDataRequest,
|
||||||
this, &MainWindow::commitData);
|
this, &MainWindow::commitData);
|
||||||
|
#endif
|
||||||
|
|
||||||
setCurrentFile(QString());
|
setCurrentFile(QString());
|
||||||
setUnifiedTitleAndToolBarOnMac(true);
|
setUnifiedTitleAndToolBarOnMac(true);
|
||||||
@ -387,7 +389,7 @@ QString MainWindow::strippedName(const QString &fullFileName)
|
|||||||
return QFileInfo(fullFileName).fileName();
|
return QFileInfo(fullFileName).fileName();
|
||||||
}
|
}
|
||||||
//! [49]
|
//! [49]
|
||||||
|
#ifndef QT_NO_SESSIONMANAGER
|
||||||
void MainWindow::commitData(QSessionManager &manager)
|
void MainWindow::commitData(QSessionManager &manager)
|
||||||
{
|
{
|
||||||
if (manager.allowsInteraction()) {
|
if (manager.allowsInteraction()) {
|
||||||
@ -399,3 +401,4 @@ void MainWindow::commitData(QSessionManager &manager)
|
|||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@ -70,7 +70,9 @@ private slots:
|
|||||||
bool saveAs();
|
bool saveAs();
|
||||||
void about();
|
void about();
|
||||||
void documentWasModified();
|
void documentWasModified();
|
||||||
|
#ifndef QT_NO_SESSIONMANAGER
|
||||||
void commitData(QSessionManager &);
|
void commitData(QSessionManager &);
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createActions();
|
void createActions();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user