出现“空白屏幕"问题在全屏模式下运行Qt应用程序时 [英] Issue with "blanking screen" when running Qt application in fullscreen mode

查看:172
本文介绍了出现“空白屏幕"问题在全屏模式下运行Qt应用程序时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个基于Qt的浏览器应用程序,该应用程序在后台使用了QWebEninge.当前,我们正在解决一个问题,即每当窗口获取或释放焦点时(例如,每次调用QVirtualKeyboard时),屏幕都会暂时变黑.按照 Qt的建议,我们尝试实施在调用 QMainWindow :: showFullScreen()之前,请先使用QWindowsWindowFunctions :: setHasBorderInFullScreen .但是,这导致可用窗口面积的减小,例如,减小.1918x1078而不是1920x1080(此修复程序将WS_BORDER添加到窗口标志中).

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).

在一些实验中,如果发现问题也是(并且仅)发生,如果我使用 QMainWindow :: show()设置窗口的大小,使其与屏幕分辨率完全匹配,.换句话说:超越屏幕范围不是问题.因此,我的想法是在QMainWinow周围获得这样的 WS_BORDER 并对其进行大小/放置,以使可用区域覆盖屏幕.

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.

我的问题是:

  • 是否有更好的解决方案来摆脱这种情况?
  • 如果没有:如何获得正常" QmainWinodw 的 WS_BORDER ?我尝试在调用 QMainWinodw :: show()之前和之后都使用 Get/SetWindowLongPtr(QMainWindow :: winId(),GWL_STYLE/GWL_EXSTYLE),但这没有帮忙.
  • 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.

谢谢.

推荐答案

作为一种解决方法,我尝试使用Qt :: WindowStaysOnTopHint放置一个隐藏的(不透明的)迷你窗口(0x0px)-可行.如果有人知道更好的解决方案,请告诉我们.谢谢.

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.

编辑这是一个偶然的发现:由于某些原因,Windows的放大镜工具处于活动状态,我注意到当放大镜在我的应用程序Windows前面时,不会发生此问题.作为结论,我试图将始终放在顶部"窗口,可以看到它正常工作.最后,我想隐藏此覆盖",这是通过将其width/height设置为0px/0px来完成的.但是,似乎存在一些有关Qt和范围内系统的Intel HD Graphics适配器的一般性问题.据我所知,这个问题仅在(全屏)窗口的尺寸计算出显示器的几何形状时才会发生-至少通过在显示器的几何形状之外的像素上调整它的大小是有帮助的,但是在我们的情况下,这是没有选择的.

EDIT It was a accidental finding: The magnifier tool from Windows was active for some reason and i noticed that the problem does not occurr when the magnifier is in front of my applications Windows. As a conclusion of that, I tried to place an "always on top" window and could see that it worked. In the end I wanted to hide this "overlay", which was done by setting it's width/height to 0px/0px. However, it seems there are some generic issues regarding Qt and the Intel HD Graphics adapter of the system in scope. As far as I remember, the issue only occurs whe the (fullscreen) window's size mathces the geometry of the display - resizing it by at least on pixel beyond the display's geometry helped, but this was no option in our case.

这篇关于出现“空白屏幕"问题在全屏模式下运行Qt应用程序时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆