PDA

View Full Version : QGraphicsItem Jerky Movement?



steadi
10th November 2012, 00:44
Hello there,

I am trying to make a qgraphicspixmapitem move with the arrow keys. It works to some degree, however, there is a minor delay when switching keys and it becomes slightly jerky. Is there a way to fix this?

Here is the code for moving (You can simply ignore the lua parts):

QList<QGraphicsItem*> temp = luascene->items();
foreach(QGraphicsItem *itm,temp)
{
if( Sprite * node = dynamic_cast<Sprite*>( itm ) )
{
if (node->name == tempname)
{
node->setPos(node->x() + dir, node->y());
}
}
}

Thanks in advance guys,
Matt