只要动画在任何窗口中运行,qt QML中的多个窗口就会开始闪烁/闪烁

时间:2019-05-25 15:55:37

标签: c++ qt qml window flicker

我正在尝试为我的项目编写原型,该项目涉及基于qml的应用中的多个窗口。一切都按预期工作,但当窗口之间切换焦点并启动动画时(在我的情况下,这是快速控件按钮内的默认动画),它将开始像疯了一样闪烁/闪烁。

注意:我当前正在运行Qt 5.13 beta,但该问题已在Qt 5.12中出现,并且距Qt 5.13发行只有5天了。它在Windows和macOS上都存在

这里以一个简单的示例快速演示了该问题,首先是当恢复窗口焦点并单击按钮(从而启动动画)时闪烁的gif动作:

flickering in multiple window exemple

和代码:

import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.13

Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")
    Rectangle{
        anchors.fill: parent
        color: "red"
        Button{
            height: 50
            width: 30
        }
    }

    Window {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World 2")
        Rectangle{
            anchors.fill: parent
            color: "blue"
            Button{
                height: 50
                width: 30
            }
        }
    }
}

以及更高级的动画,例如我的原型中的动画(这是它应该不会闪烁的样子):

normal animation inside main applicationWindow

但是在子窗口中,它根本无法使用:

animation flickering inside child qml window

感谢您对其来源或解决方案的任何了解!

1 个答案:

答案 0 :(得分:1)

在安装了最终的Qt 5.13版本(不是beta版)之后,问题就消失了。我猜这是Qt内部的问题。