问题
I'm developing a qml UI using Qt Quick 2D Renderer on an ARM embedded device which runs linux. The device has a LCD screen and some standby mode when it is inactive.
For some reasons (network needs to stay active), suspend to RAM is not an option. However, to lower the power consumption in standby mode it would be good to stop the UI rendering. Can this be achieved with some Qt API?
回答1:
Connect directly (Qt::DirectConnection
) to the QQuickWindow::beforeRendering()
signal. That will be in the render thread, the program can wait there on your mutex/condition_variable. GUI thread is unlocked during this step so the application logic will continue working.
http://doc.qt.io/qt-5/qtquick-visualcanvas-scenegraph.html
Can probably also override the whole sequence by using QQuickRenderControl
.
来源:https://stackoverflow.com/questions/48766582/is-there-a-way-to-stop-qt-rendering-temporarily