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

qt - How to import qml file - Stack Overflow

programmeradmin7浏览0评论

I'm trying to import a qml file inside the program's resource file but i dont know what i'm doing wrong because it doesn't works. My program's structure is

The file in question is a simple QML rectangle for now:

Headers.qml:

import QtQuick
Rectangle{
    color: "red"
    width: 400
    height: 600
}

In main.qml i've tried to import in multiple ways for example import "qrc:///Components/Headers.qml" as Rect and use it like

Item{
   Rect{}
}

but without success, in all cases the message i got is: QQmlComponent: Component is not ready

What i'm doing wrong ?

i've tried multiple import tag and implementation but in all cases it returned QQmlComponent: Component is not ready

发布评论

评论列表(0)

  1. 暂无评论