[英]Get hold of the module that imported us in QML/Qbs
As a beginner in Qbs/QML I want to get information about what instance that imported our module .作为Qbs/QML的初学者,我想获得有关导入我们模块的实例的信息。 For example, given this project:例如,给定这个项目:
.
├── a
│ └── imported.qbs
└── b
└── main.qbs
with a/imported.qbs like this:使用a/imported.qbs这样的:
Product{
name:{
console.info("I was imported from" + XXX);
return "imported"
}
}
and b/main.qbs like this:和b/main.qbs是这样的:
import "../a/imported.qbs" as Imported
Imported {}
When I run main.qbs
, how could I get the instance that imported imported.qbs
( main.qbs
)?当我运行main.qbs
时,如何获取导入imported.qbs
( main.qbs
) 的实例?
Or in other words, what should I susbstitute for XXX to print main.qbs .或者换句话说,我应该用什么来代替 XXX 来打印main.qbs 。
I don't think you can get the file name of the instantiating item, nor should it be relevant.我认为您无法获取实例化项的文件名,也不应该相关。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.