Qt QGraphicsScene::drawItems 替代品?
对于QGraphicsScene::drawItems
,参考文献说:
重新实现此功能以提供场景中所有项目的自定义绘制;完全控制每个项目的绘制方式。
但该功能已被标记为已过时。 有没有新的等效方法?
For QGraphicsScene::drawItems
the reference says:
Reimplement this function to provide custom painting of all items for the scene; gaining complete control over how each item is drawn.
But this function is marked as obsolete.
Is there any new equivalent method?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
QGraphicsView::paintEvent()
现在调用,这意味着该方法是类
QGraphicsScenePrivate
的一部分,据我所知,您无法覆盖它。如果您需要更改项目的绘制方式,请首先尝试考虑另一种方式(即不需要单步执行
drawItems()
方法的解决方案)。如果您找不到任何类似的解决方案,您唯一的机会是通过设置重新激活 4.6 之前的行为QGraphicsView::paintEvent()
now callswhich means the method is part of class
QGraphicsScenePrivate
which you cannot override afaik.If you need to change the way your items are drawn, first try to think of another way (i.e. a solution which does not require stepping into the
drawItems()
method). If you can't find any solution like that, your only chance is reactivating the pre-4.6-behaviour by setting