Hello,
I'm trying to add quit confirmation message at OS shutdown according to
this example:
https://doc.qt.io/qt-5/qsessionmanager.html#allowsInteraction
I interact with the user via QML interface. It is asynchronous, so I use
slots/signals. And I use additional QEventLoop to stay inside of
QGuiApplication::commitDataRequest call while interacting with the user.
The trouble is that after I shutdown OS - my app prevents OS to shutdown
and it's good, but its screen is just white, or contains old state
without the confirmation dialog. I need to hide/restore window or change
its size, or do some mouse clicks inside of it to force it repaint. When
it repaint all is OK and my confirmation dialog is there.
Is this a bug? Is there a workaround?
This is the code I use:
voidAppQuitConfirmationAtOsShutdownManager::onCommitDataRequest(
QSessionManager&m)
{
Q_ASSERT_SAME_THREAD;
if(!m_ui->isConfirmationRequired())
return;
if(!m.allowsInteraction())
return;
boolisConfirmed=true;
QEventLooploop;
qtconnect(m_ui.data(),&AppQuitConfirmationUiManager::confirmationResult,
&loop,[&](boolconfirmed)
{
isConfirmed=confirmed;
loop.quit();
},
Qt::QueuedConnection);
m_ui->requestConfirmation();
loop.exec();
m.release();
if(!isConfirmed)
m.cancel();
}
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest