Linux Qt快速窗口/具有内部阴影的帧在调整大小时闪烁
当我调整Qt QuickLinux Qt快速窗口/具有内部阴影的帧在调整大小时闪烁,linux,qt,qml,qtquick2,qtquickcontrols2,Linux,Qt,Qml,Qtquick2,Qtquickcontrols2,当我调整Qt Quick应用程序窗口的大小时,我会看到闪烁和视觉伪影,该窗口包含一个带有内部阴影的框架。如果不替换默认边框,或者为帧使用简单的矩形,则情况并非如此 我在运行64位Arch-Linux的笔记本电脑上进行了测试。它有一个Nvidia GTX 1060 Max Q图形卡和一个集成Intel图形卡。我运行了有和没有bumblebee的代码 有没有办法解决或消除这种闪烁现象?这很糟糕。我的代码和一些屏幕抓图如下 编辑:我尝试设置AA_ShareOpenGLContexts和AA_UseOp
应用程序窗口的大小时,我会看到闪烁和视觉伪影,该窗口包含一个带有内部阴影的框架。如果不替换默认边框,或者为帧使用简单的矩形,则情况并非如此
我在运行64位Arch-Linux
的笔记本电脑上进行了测试。它有一个Nvidia GTX 1060 Max Q图形卡和一个集成Intel图形卡。我运行了有和没有bumblebee
的代码
有没有办法解决或消除这种闪烁现象?这很糟糕。我的代码和一些屏幕抓图如下
编辑:我尝试设置AA_ShareOpenGLContexts
和AA_UseOpenGLES
(及其软件/桌面变体)属性,但运气不佳
更新:我在这里提出了一个问题:,但我仍然希望有人能想出一个解决办法
测试.qml
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtGraphicalEffects 1.14
ApplicationWindow{
id: main
width: 2*screen.width/3
height: 2*screen.height/3
title: "Test ApplicationWindow"
color: activeColorPalette.window
visible:true
SystemPalette {
id: activeColorPalette
colorGroup: SystemPalette.Active
}
Frame{
anchors.fill: parent
anchors.margins: 10
background: Item{
id: root
anchors.fill: parent
Rectangle{
anchors.fill: parent
anchors.margins: 1
radius: 16
color: activeColorPalette.window
}
InnerShadow {
anchors.fill: root
horizontalOffset: 0
verticalOffset: 0
source: root
radius: 16
color: activeColorPalette.shadow
spread: 0.6
samples: 32
cached: true
fast:true
}
}
}
}
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtGraphicalEffects 1.14
ApplicationWindow{
id: main
width: 2*screen.width/3
height: 2*screen.height/3
title: "Test ApplicationWindow"
color: activeColorPalette.window
visible:true
SystemPalette {
id: activeColorPalette
colorGroup: SystemPalette.Active
}
Frame{
anchors.fill: parent
anchors.margins: 10
background: Item{
id: root
anchors.fill: parent
Rectangle{
id: middleRect
anchors.fill: parent
color: "transparent"
Rectangle{
id: innerRect
anchors.fill: parent
anchors.margins: 1
radius: 16
color: activeColorPalette.window
}
}
InnerShadow {
anchors.fill: root
horizontalOffset: 0
verticalOffset: 0
source: middleRect
radius: 16
color: activeColorPalette.shadow
spread: 0.6
samples: 32
cached: true
fast:true
smooth:true
}
}
}
}
没有闪烁或瑕疵的窗口
调整大小时出现闪烁/视觉瑕疵的窗口
我找到了一种解决方法,可以在调整大小时消除视觉瑕疵
在我的问题代码中,InnerShadow
使用一个项
QML类型作为源,默认情况下它是透明的,并且包含一个灰色的矩形
,我在其中添加了该矩形。透明源项
与其内部较小的子矩形
之间的视觉区别是InnerShadow
用来计算内部阴影渐变的。最终的结果是一个装饰性的阴影边界。然而,调整应用程序的大小会导致丑陋的视觉瑕疵,有时会留下来。注意:将外部项目
更改为透明的矩形
没有明显效果
但是当我将灰色最里面的矩形封装到另一个透明组件中时
项
{透明的矩形
{灰色的内部矩形
}
或者
矩形
{透明的矩形
{灰色内部矩形
}
除了将中间透明的矩形
设置为内部阴影
的源之外,视觉伪影也被消除。下面是test\u workaround.qml的工作代码,您可以将其与上面的test.qml
进行比较
测试解决方案。qml
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtGraphicalEffects 1.14
ApplicationWindow{
id: main
width: 2*screen.width/3
height: 2*screen.height/3
title: "Test ApplicationWindow"
color: activeColorPalette.window
visible:true
SystemPalette {
id: activeColorPalette
colorGroup: SystemPalette.Active
}
Frame{
anchors.fill: parent
anchors.margins: 10
background: Item{
id: root
anchors.fill: parent
Rectangle{
anchors.fill: parent
anchors.margins: 1
radius: 16
color: activeColorPalette.window
}
InnerShadow {
anchors.fill: root
horizontalOffset: 0
verticalOffset: 0
source: root
radius: 16
color: activeColorPalette.shadow
spread: 0.6
samples: 32
cached: true
fast:true
}
}
}
}
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtGraphicalEffects 1.14
ApplicationWindow{
id: main
width: 2*screen.width/3
height: 2*screen.height/3
title: "Test ApplicationWindow"
color: activeColorPalette.window
visible:true
SystemPalette {
id: activeColorPalette
colorGroup: SystemPalette.Active
}
Frame{
anchors.fill: parent
anchors.margins: 10
background: Item{
id: root
anchors.fill: parent
Rectangle{
id: middleRect
anchors.fill: parent
color: "transparent"
Rectangle{
id: innerRect
anchors.fill: parent
anchors.margins: 1
radius: 16
color: activeColorPalette.window
}
}
InnerShadow {
anchors.fill: root
horizontalOffset: 0
verticalOffset: 0
source: middleRect
radius: 16
color: activeColorPalette.shadow
spread: 0.6
samples: 32
cached: true
fast:true
smooth:true
}
}
}
}