admin管理员组

文章数量:1356943

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

本文标签: qtQML quotCannot override FINAL propertyquot issueStack Overflow