PDA

View Full Version : Optimization from QGraphicsView update/paint/CPU action,problem



patrik08
18th June 2008, 11:00
I download the video from ICSNetwork from QGraphicsView e /Co from a slow... slow server! 3H. time download...

Now i understand to speed QGraphicsView i need to not repaint item that's not in Vieport..
logic ... and not launch event wo is not on view...


I have a text edit QGraphicsItem x 10 many text layer and each layer on edit modus having his blink cursor....

I try to discovery from item the exact area from the view:

QList<QGraphicsView *> QGraphicsScene::views () const
Returns a list of all the views that display this scene.

and the line..
QList<QGraphicsView *> rectolist = scene()->views();

crash the full application... why?

if i call:

const QRect viewRe = viewport()->rect();
on QGraphicsView it display the correct area...
and how i can stop blink cursor/or update event if i can not discovery viewport()?




/* TextLayer = QGraphicsItem update only area from blink cursor */
void TextLayer::updatearea( const QRectF areas )
{
const qreal limits = boundingRect().width();
if (areas.width() > limits) {
return;
}
evesum++;
/* discovery if areas is on viewport or not! */
QList<QGraphicsView *> rectolist = scene()->views(); /* !!crash!! */
QRect simprect = areas.toRect();
qDebug() << "### area " << areas.width() << "x" << areas.height() << "|" << evesum;
qDebug() << "### updatearea " << simprect;
qDebug() << "### size rects " << rectolist.size();
update(areas);
}