Qt:强制QGraphicsItem更新

问题描述 投票:3回答:1

根据Qt Documentation,“void QGraphicsItem :: update(const QRectF&rect = QRectF())”不会立即引起油漆;相反,它会在控制到达事件循环后调度由QGraphicsView处理的绘制请求。这是我的代码:

this->item->setPixmap( QPixmap::fromImage(*coloration->image) );// QGraphicsPixmapItem 
this->item->update();
this->scene->update(); // QGraphicsScene
this->view->update(); // QGraphicsView

并且代码在一个方法中,该方法将每100毫秒调用一次(并且其中着色 - >图像将改变),但是Qt拒绝每100毫秒更新一次图像,并且它只渲染最终图像。那么,我怎么能立刻画出这个项目呢?

qt qgraphicsitem
1个回答
0
投票

你必须阻止你的事件循环,否则你的项目实现是不好的。我无法重现你的问题。

© www.soinside.com 2019 - 2024. All rights reserved.