简体   繁体   English

在远程桌面上运行的Qt应用程序外观

[英]Qt Application Appearance Running Over Remote Desktop

I work on a desktop application that we sometimes have to run on a virtual machine using Windows Remote Desktop for access. 我使用的桌面应用程序有时需要在使用Windows Remote Desktop进行访问的虚拟机上运行。 Fonts and gradients are noticeably degraded in appearance when running through Remote Desktop. 通过远程桌面运行时,字体和渐变的外观明显下降。 The fonts are clearly not anti-aliased (and are normally) The gradients degenerate into much larger bands of solid color, losing the smoother look. 字体显然不是抗锯齿的(并且通常是),渐变会退化为更大的纯色带,从而失去了平滑的外观。 Initially, I had assumed Windows was doing this to improve performance, but when I compared application fonts in our produce with those in other applications (Visual Studio specifically), I see that Qt is definitely rendered fonts in dialogs and QGraphicsScene differently. 最初,我以为Windows就是在这样做以提高性能,但是当我将产品中的应用程序字体与其他应用程序(特别是Visual Studio)中的应用程序字体进行比较时,我发现Qt在对话框和QGraphicsScene呈现字体肯定不同。

In the application title bar of my app, I see that the font exactly matches the appearance of other application title bars, and that makes sense because Windows draws that. 在我的应用程序的应用程序标题栏中,我看到该字体与其他应用程序标题栏的外观完全匹配,这很有意义,因为Windows会绘制该字体。 Within my application, all of the top menu items and fonts on dialogs are not anti-aliased and look terrible. 在我的应用程序中,对话框上的所有顶部菜单项和字体都没有消除锯齿,看起来很糟糕。 We use QGraphicsScene extensively, and those fonts are degraded as well. 我们广泛使用QGraphicsScene ,而且这些字体也会降级。

I don't have another application that generates gradients to compare those, but I viewed a high resolution image through the Remote Desktop connection using the Windows image viewer, and it looks just as good as on a local desktop. 我没有其他应用程序可以生成渐变以进行比较,但是我使用Windows图像查看器通过“远程桌面”连接查看了高分辨率图像,它看起来与本地桌面上的效果一样好。

The degraded appearance means that we can't do screen shots for documentation while using the VM. 外观下降意味着使用VM时无法为文档做屏幕截图。 We are also frequently required to do demos using VMs and Remote Desktop, and the appearance is not appealing to show to customers. 我们也经常需要使用VM和远程桌面进行演示,并且外观并不吸引客户。 In our industry and within our company, there's increasing pressure to use VMs instead of local, physical machines, so this is becoming a bigger problem. 在我们行业和公司内部,使用VM代替本地物理计算机的压力越来越大,因此这成为一个更大的问题。

Both symptoms lead me to believe that Qt knows that I'm visualizing through Remote Desktop and that it is choosing to degrade appearance in favor of performance. 这两种症状使我相信Qt知道我正在通过Remote Desktop进行可视化,并且它选择降低外观以提高性能。 I don't want that, or at the very least, I need to control it. 我不想要,或者至少需要控制它。

I suspect this is buried somewhere in Qt's style/theme system, but I haven't had any luck finding clues that would point me to the correct place to do something about this, or at least an answer that indicates whether or not it's even possible. 我怀疑这是埋在Qt的样式/主题系统中的某个地方,但是我没有运气找到线索,可以将我指向正确的位置以进行此操作,或者至少给出一个表明是否可能的答案。 。 Any advice is greatly appreciated. 任何意见是极大的赞赏。

With QGraphicScene we have OpenGL for rendering. 使用QGraphicScene我们可以使用OpenGL进行渲染。 And with some of VMs we mostly rely on software simulating OpenGL via MS DirectX, which is for software and not hardware supported rendering. 对于某些VM,我们主要依赖于通过MS DirectX模拟OpenGL的软件,该软件用于软件而非硬件支持的渲染。 The most popular software OpenGL rendering is based on ANGLE . 最受欢迎的OpenGL渲染软件基于ANGLE

To improve the rendering on VM I would try to build a custom Qt for your app using one of proposed Qt build configurations to configure specific Windows Qt build. 为了改善在VM上的呈现,我将尝试使用建议的Qt构建配置之一为您的应用构建自定义Qt,以配置特定的Windows Qt构建。

With Qt evolving it gets a bit confusing: which configuration is the best. 随着Qt的发展,它变得有些混乱:哪种配置是最佳的。 I was told that since Qt 5.5 -opengl dynamic will be an optimal for most of environments. 有人告诉我,由于Qt 5.5 -opengl dynamic对于大多数环境而言都是最佳的。 I used to configure -opengl es2 configuration with Qt 5.3 and that worked well without degrading the graphics but mind that VMs used are from VMware and not MS Hyper-V that would not even allow the app to load due to OpenGL failing to initialize and I could not make ANGLE to help here with that specific Qt. 我曾经使用Qt 5.3配置-opengl es2配置,并且在不降低图形性能的情况下运行良好,但是请注意,使用的VM是来自VMware而不是MS Hyper-V,由于OpenGL无法初始化,我什至无法加载应用程序,我无法使ANGLE在此帮助该特定的Qt。

I was able to address the issue with fonts in QGraphicsScene. 我能够解决QGraphicsScene中的字体问题。 Because of the nature of our product, the font handling for graphics items was fairly specialized, and very early in development when I was very new to Qt, I had set the style strategy to those fonts to QFont::ForceOutline because I didn't want the font matching to use any bitmapped fonts. 由于我们产品的性质,图形项的字体处理相当专业,并且在我刚接触Qt的开发初期,我就将那些字体的样式策略设置为QFont :: ForceOutline,因为我没有希望字体匹配使用任何位图字体。 Through experimentation, I found that this strategy results in the fonts not being anti-aliased when running through Remote Desktop. 通过实验,我发现这种策略导致在通过远程桌面运行时字体不会被消除锯齿。 Changing to QFont::PreferAntialias addressed the problem for the fonts in the scene, and that's a substantial and welcome improvement. 更改为QFont :: PreferAntialias解决了场景中字体的问题,这是一项重大且令人欢迎的改进。

Unfortunately, I haven't been able to find a solution for the general application fonts, nor for the gradient degradation, but at least with the fonts, I have something more to go on. 不幸的是,我无法找到通用应用程序字体的解决方案,也无法找到渐变效果的解决方案,但是至少对于字体,我还有很多工作要做。 My next step will be to start inspecting the fonts that Qt is using by default on some of the widgets and seeing what their attributes are. 我的下一步将是开始检查Qt在某些小部件上默认使用的字体,并查看它们的属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM