[Development] FW: how to improve GraphicsView performance
song.7.liu at nokia.com
song.7.liu at nokia.com
Tue Aug 21 10:24:36 CEST 2012
Hi,
FYI. Can someone help us here ? thanks very much ;)
Thanks,
Song
From: Jiang Wenjun (Nokia-MP/Beijing)
Sent: Tuesday, August 21, 2012 4:21 PM
To: Liu Song.7 (Nokia-MP/Beijing)
Subject: FW: how to improve GraphicsView performance
Importance: High
Hi, all
I'm using QGraphicsView to implement google weather in a low-end(CPU: 300MHz) hardware. All are nice except the performance.
When I set the position of the GraphicsItems, the refresh rate is quite slow. Code about item moving is here.
void GraphicsView::mouseMoveEvent(QMouseEvent *event)
{
QPoint current_pos = event->pos();
int deltaY = current_pos.y() - m_lastPos.y();
int current_weatherY = m_currentweatherwidget->pos().y();
if ((current_weatherY + deltaY > -320) && (current_weatherY + deltaY <= 0))
{
m_currentweatherwidget->setY(current_weatherY + deltaY);
int forecast_weatherY = m_forecastweatherwidget->pos().y();
m_forecastweatherwidget->setY(forecast_weatherY+deltaY);
}
m_lastPos = event->pos();
event->accept();
}
I tried many methods to optimize the performance, all seem no effect, including:
1. setCacheMode(QGraphicsView::CacheBackground)
2. scene->setItemIndexMethod(QGraphicsScene::NoIndex)
3. setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
4. setOptimizationFlags(QGraphicsView::DontAdjustForAntialiasing | QGraphicsView::DontSavePainterState | QGraphicsView::DontClipPainter);
5. QGraphicsItem::setCacheMode(QGraphicsItem::DeviceCoordinateCache) ...
Is there any other idea? Thanks!
Best regards!
-Jiang wenjun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120821/de12721c/attachment.html>
More information about the Development
mailing list