QML有趣的问题。创建默认的Qt Quick应用程序并运行它时,出现黑屏。窗口和其他项目根本不渲染。但是,当我最小化它并再次将其返回到以前的状态时,将呈现项目。那么有人知道这种问题吗?
Before minimizing
After minimizing
import QtQuick 2.5
import QtQuick.Window 2.2
Window {
visible: true
width: 500
height: 500
Rectangle {
id: test
width: 300
height: 200
color: "red"
border.color: "black"
border.width: 4
}
Rectangle {
width: test.width / 2
height: test.height / 2
color: "red"
border.color: "black"
border.width: 4
anchors.centerIn: parent
Rectangle {
width: parent.width / 2
height: parent.height / 2
radius: width * 0.5
//x: 200
//y: 200
color: "green"
border.color: "darkgreen"
border.width: 4
anchors.left: parent.left
anchors.bottom: parent.bottom
}
}
}
最佳答案
今天,我发现了一个可能是您遇到的错误。如果我在Windows中启用了高对比度,则该应用程序根本不会刷新。我需要将其最小化并重新打开以查看更改。如果启用了高对比度,请尝试将其禁用。
关于c++ - 不呈现QML项,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37502533/