[英]qt get child (Callout) from QChart
I implemented a custom Callout class like in this example Callout Example我实现了一个自定义 Callout 类,如本例Callout Example
QPolarChart *chart = new QPolarChart();
Callout *callout = new Callout(chart);
If I have only access to chart (callout went out of scope), how can I regain access to callout.如果我只能访问图表(标注超出范围),我如何重新获得对标注的访问权限。 I thought about using我想过使用
QObjectList children = chart->children();
but callout is not here.但标注不在这里。 How can I get access to callout again?我如何才能再次访问标注?
you have to use childItems()
, this returns the QGraphicsItem
s children.你必须使用childItems()
,这会返回QGraphicsItem
的孩子。
for(QGraphicsItem *childItem: chart->childItems()){
if(Callout *c = dynamic_cast<Callout *>(childItem)){
//use c
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.