开发者

Problem with embedding QML into resource Qt application

开发者 https://www.devze.com 2023-02-13 16:33 出处:网络
I have some problem with embedding my QML component into resource of my application. I have some gui.qml

I have some problem with embedding my QML component into resource of my application.

I have some gui.qml

import QtQuick 1.0

Rectangle {
 开发者_如何学编程   width: 480
    height: 525
    color: "#ffff00"
}

My dirs

\main.cpp
\gui.qml

I tried run it:

view = new QDeclarativeView(m_GUI);
view->setSource(QUrl("qrc:/gui.qml"));

But i catch:

qrc:/gui.qml: File not found 

What's wrong?


Thank all ) I solved it.

In resource i have "Prefix" for the root path.

view->setSource(QUrl("qrc:/MyPrefix/gui.qml"));
0

精彩评论

暂无评论...
验证码 换一张
取 消