Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux Qt快速窗口/具有内部阴影的帧在调整大小时闪烁_Linux_Qt_Qml_Qtquick2_Qtquickcontrols2 - Fatal编程技术网

Linux Qt快速窗口/具有内部阴影的帧在调整大小时闪烁

Linux 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

当我调整Qt Quick
应用程序窗口的大小时,我会看到闪烁和视觉伪影,该窗口包含一个带有
内部阴影的
框架。如果不替换默认边框,或者为
帧使用简单的矩形,则情况并非如此

我在运行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
            }  
        } 
    }
}