Details
-
Bug
-
Resolution: Done
-
P2: Important
-
None
-
5.3.1
-
None
-
Windows 7 64Bit
Ubuntu 14.04 (Unity desktop) 64Bit
Description
I want my application to prevent a systen shutdown in some cases.
QSessionManager should do the trick, when calling it's cancel() function.
So I have a code like this from the documentation:
MyMainWidget::MyMainWidget(QWidget *parent) :QWidget(parent) { connect(qApp, SIGNAL(commitDataRequest(QSessionManager&)), this, SLOT(commitData(QSessionManager&))); } void MyMainWidget::commitData(QSessionManager& manager) { if (m_prevent_shutdown) { qDebug() << Q_FUNC_INFO << "cancel the shutdown"; manager.cancel(); } }
This neither works in Windows 7, nor in Ubuntu 14.04.
But from the debug output I can see that the cancel() is called right in front of the Windows/Ubuntu shutdown, after pressing the systems shutdown button.
In Windows, handling WM_QUERYENDSESSION "manually" in a custom QAbstractNativeEventFilter does work.
Attachments
Issue Links
- relates to
-
QTBUG-28228 Regression: QSessionManager lost all the X11 code
- Closed