Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我实现了一个自定义标注类,就像在这个示例标注示例中一样
QPolarChart *chart = new QPolarChart(); Callout *callout = new Callout(chart);
如果我只能访问图表(标注超出范围),我如何重新获得对标注的访问权限。我想过使用
QObjectList children = chart->children();
但标注不在这里。我怎样才能再次访问标注?
您必须使用childItems(),这将返回QGraphicsItems 孩子。
childItems()
QGraphicsItem
for(QGraphicsItem *childItem: chart->childItems()){ if(Callout *c = dynamic_cast<Callout *>(childItem)){ //use c } }