QML App stops refreshing after screen sleep
-
Hi,
I came across a problem with my QML Application while trying to make it run on a tablet with Windows 10 Iot 2019.
I am using Qt 5.5.1, and also tested it with Qt 5.12.6 behavior is the same.
When the application starts, all works fine. The tablet power saving parameter is "Turn off monitor after x minutes".
When the monitor is turned off, and if I touch the screen, the monitor wake up, the app is still here, but the screen remains black.
I cannot click anywhere as the app seems to still have focus, but displays nothing.
Sometimes I still see the app, but nothing moves (animations are stopped, nothing is clickable).
If I open the task manager (via Ctrl+Alt+Suppr) It unblocks the app, and it works again.I tested it on other computers (Desktop, Windows 10 Pro / Laptop, Windows 10 Pro) and no problem.
It is possible to reproduce this problem with the "dashboard" example, I just modified "dashboard.qml" to add :
flags: Qt.Window | Qt.FramelessWindowHint visibility: Window.FullScreen
In my original QML Application I found an ugly workaround :
The QML UI is loaded via a QQuickView and added to the QMainWindow using a layout and QWidget::createWindowContainer().
If I add a QPushButton to the layout the problem does not appear anymore. This fix works only if the button is visible, so a 1 pixel height black button is my only fix for now...This seems to be related to how QML is managing focus and rendering and there is maybe an incompatibility with Windows 10 Iot ? An other tablet with Windows 10 Not Iot works fine.
Any ideas ?
Thanks -
If I understood correctly what you suggested, I added this to the MainWindow:
bool MainWindow::event(QEvent *event) { bool ret = QMainWindow::event(event); if(event->type() == QEvent::TouchUpdate) { event->accept(); QApplication::processEvents(); return true; } return ret; }
but no difference.
Before finding my workaround, I also tried to use the "Qt::ApplicationActive" event from QApplication::applicationStateChanged
to force activation and/or update of the Window / QQuickView, but nothing worked.void TestStateChange::applicationStateChanged(Qt::ApplicationState state) { if(state == Qt::ApplicationActive) { m_mainWindow->activateWindow(); m_mainWindow->raise(); m_mainWindow->setFocus(); m_view->requestActivate(); m_view->raise(); m_view->update(); } }
-
If I understood correctly what you suggested, I added this to the MainWindow:
bool MainWindow::event(QEvent *event) { bool ret = QMainWindow::event(event); if(event->type() == QEvent::TouchUpdate) { event->accept(); QApplication::processEvents(); return true; } return ret; }
but no difference.
Before finding my workaround, I also tried to use the "Qt::ApplicationActive" event from QApplication::applicationStateChanged
to force activation and/or update of the Window / QQuickView, but nothing worked.void TestStateChange::applicationStateChanged(Qt::ApplicationState state) { if(state == Qt::ApplicationActive) { m_mainWindow->activateWindow(); m_mainWindow->raise(); m_mainWindow->setFocus(); m_view->requestActivate(); m_view->raise(); m_view->update(); } }
@QMarc said in QML App stops refreshing after screen sleep:
if(event->type() == QEvent::TouchUpdate) { event->accept(); QApplication::processEvents(); return true; }
Are you sure the following is executed?
if(event->type() == QEvent::TouchUpdate) { event->accept(); QApplication::processEvents(); return true; }
-
Actually I tried it fast and after setting some qDebug it seems I never received the touch events.
I did what is suggested in this answer : https://stackoverflow.com/a/34740261
And now I am able to get the touch events and add "QApplication::processEvents();"
But there is no difference the problem is still here.
With this debugging, I saw that touch event are received even when the application is in the buggued state (black screen). They seem processed as usual, because when I hit Ctrl+Alt+Suppr, and my Window reappears, I see the result of the touch event in the GUI.Some more investigation on the Windows side showed some incompatibility with the Intel Graphics Driver. The tablet is equipped with an Intel HD Graphics 620.
- The app works with the driver Intel Graphics Driver 23.20.16.4973, which is a "DC" driver, now called "Legacy"
- The bug appears with the Intel Graphics Driver 26.20.100.7637 which is a "DCH" driver introduced with the "Universal Window Platform"
https://www.intel.com/content/www/us/en/support/articles/000031572/programs/intel-corporation.html
Installing the "Legacy" driver on the Windows 10 Iot Tablet fixes the problem. But this is not a really good fix, at it implies to keep this driver version and does not permit updates.
Are they specific known issues with QML and Intel Graphics Driver DCH ?