首页 文章

QML项目不会呈现

提问于
浏览
0

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
        }
    }
}

1 回答

  • 1

    今天我发现了一个可能是你遇到的错误 . 如果我在Windows中启用了高对比度,则应用程序根本不会刷新 . 我需要将其最小化并重新打开以查看更改 . 如果启用了高对比度,请尝试禁用高对比度 .

相关问题