Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.2k views
in Technique[技术] by (71.8m points)

qt - Howto resolve qml module not found (qml designer)

As per https://doc.qt.io/qtcreator/qtquick-placeholder-data.html#creating-dummy-context I want to add a dummy context to my QT 5.15.2 project. The webpage mentioned creating a qml file with the following content:

import QtQuick 2.0
import QmlDesigner 2.0 // this is where the error is indicated: qml module not found (qml designer)

DummyContextObject {
     parent: Item {
         width: 640
         height: 300
     }
 }

Apparently the QmlDesigner module is unknown. I don't know how to solve this.

question from:https://stackoverflow.com/questions/65862757/howto-resolve-qml-module-not-found-qml-designer

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The qml code model does not know anything about the existence of that type. So it is correct if it shows that to you.

In detail, that object only exists if the backend process (qmlpuppet or in documentation called emulation layer) renders stuff for the form view in the designer.

But in the current implementation, the qml code model does not know anything about added objects when the emulation layer is running.

I would create a bug report at https://bugreports.qt.io/ about that issue. So the qml code model needs to know about that type somehow.

To make sure that the feature works in the design mode please make sure you are following the help for example there is no qmldesigner 2.0 version only 1.0 exists.

Explanation in the puppet the object is registered with: qmlRegisterType("QmlDesigner", 1, 0, "DummyContextObject"); see https://code.qt.io/cgit/qt-creator/qt-creator.git/tree/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp#n184

Also, the file and folder structure is importent.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...