Issue with “blanking screen” when running Qt application in fullscreen mode

非 Y 不嫁゛ 提交于 2021-02-11 17:41:49

问题


We have a Qt based browser application which uses QWebEninge under the hood. Currently we are fighting with an issue where the screen goes blank for a moment eacht time the window gets or looses the focus (f.ex. each time the QVirtualKeyboard becomes invoked). Following a Qt's recommendation, we tried to implement QWindowsWindowFunctions::setHasBorderInFullScreen prior to call of QMainWindow::showFullScreen(). But this results in an inacceptable reduction of the available window area, e.g. 1918x1078 instead of 1920x1080 (this fix adds WS_BORDER to the window flags).

During some experiments if found out that the problem also - and only - occours, if I use QMainWindow::show() while setting the window's size in a way that it exactly matches the screen's resolution. With other words: Going beyond the screen's bounds isn't a problem. Therefore, my idea was to get such a WS_BORDER around my QMainWinow and size/place it in a way so that the availabe area covers the screen.

My questions are:

  • Is there a better solution to get rid of this?
  • If not: How can I get a WS_BORDER for a "normal" QMainWinodw? I tried to use Get/SetWindowLongPtr(QMainWindow::winId(), GWL_STYLE/GWL_EXSTYLE) both before and after call of QMainWinodw::show(), but this didn't help.

Thanks in advance.


回答1:


As a workaround I tried to placed a hidden (opaque) mini window (0x0px) using Qt::WindowStaysOnTopHint - that worked. If anyone knows a better solution please let us know. Thanks.



来源:https://stackoverflow.com/questions/60854878/issue-with-blanking-screen-when-running-qt-application-in-fullscreen-mode

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