最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

qt - QML "Cannot override FINAL property" issue - Stack Overflow

programmeradmin1浏览0评论

I'm the one trying to make program with Qt for Python. I made a component named "Light.qml". When I import this component and build the project, It works without error. But when I execute the program, It makes error said "Cannot override FINAL property". I think there's no FINAL property in my component "Light". The most thing I can't understand is, when I make Light.qml file empty and execute the program, it still prints same error message. Even though there's nothing in my "Light.qml" file! Is this project refer something other Light.qml file?

QQmlApplicationEngine failed to load component
file:///C:/my/projet/main.qml:93:13: Type Light unavailable
qrc:/devices/Light/Light.qml:4:5: Cannot override FINAL property

At first, the component "Light.qml" has two properties, width and height. I realized these properties can't override, so I removed them. But it still prints error message about FINAL property overriding. Is my component code something wrong?

import QtQuick 2.15

Item {
    id: light
    property int brightness: 100
    property alias img: area_light

    Image {
        id: area_light
        fillMode: Image.PreserveAspectFit

        source: "qrc:/images/light.png"
        visible: false
    }
}

发布评论

评论列表(0)

  1. 暂无评论