问题
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 useGet/SetWindowLongPtr(QMainWindow::winId(), GWL_STYLE/GWL_EXSTYLE)
both before and after call ofQMainWinodw::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