QPainter:Paint设备返回引擎0

时间:2014-03-03 06:55:29

标签: qt qgraphicstextitem

当我在QGraphicsItem中键入文本时,我的程序会生成运行时警告。这些项目的创建方式如下:

QGraphicsTextItem* item = new QGraphicsTextItem(this)
item ->setTextInteractionFlags(Qt::TextEditorInteraction);
item ->setCacheMode(ItemCoordinateCache);

一旦我开始输入,就会显示以下警告:

QPainter::begin: Paint device returned engine 0, type: 2 

这也会导致更多警告,如下所示,都表明画家不活跃:

QPainter::translate: Painter not active 
QPainter::setClipRegion: Painter not active 
QPainter::setRenderHint: Painter must be active to set rendering hints 
QPainter::setWorldTransform: Painter not active 
QPainter::end: Painter not active, aborted

但是,如果我将缓存模式设置为NoCache,一切都会正常。

我该如何解决这个问题?

0 个答案:

没有答案