Qt QApplication framerate drop when maximizing window

让人想犯罪 __ 提交于 2019-12-22 14:54:08

问题


We are using Qt for a visualization engine viewer, and we are having issues with the QApplication::processEvents() method. Since we needed to control the framerate (in a game loop fashion), we overrided the QApplication to define our own and our game loop that looks like

MainApplication app;
// Some code here
while (true) {
    app.processEvents();
    app.doFrame();
    // sync code, nothing for now
}

This works fine, timing are about 0.001s for the processEvents() call, while, for an empty scene, the doFrame() takes about 0.0001s. Now, we have a problem when we double click on title bar (to maximize the window). Indeed, after doing that, processEvents() call, goes from about 0.001s to about 0.01s (*10). Most of the time seems to be taken in QPlatformBackingStore::composeAndFlush()

The viewer used is based on QOpenGLWidget, and all the rendering is done outside of Qt (we are writing in the Qt FBO).

Please note that we are not overriding QApplication::processEvents().

Thanks

来源:https://stackoverflow.com/questions/36181532/qt-qapplication-framerate-drop-when-maximizing-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!