Thanks Wysota,
I agree, it is a strange design - one that I inherited.
However, I timed this whole paint() routine as I was worried about the conversions and they are not significant compared to the delay I experience. This whole routine only takes a few ms.
I do cache the images - but only load them as and when needed. . The routine normally returns from the first return statement. However the paintEvent in QGraphicsView takes a long time - even when the pixmaps are cached?? The paint routines for the items within the view are very quick.
This section takes around 1ms on either platform, so I dont think the delay is here:
{
// We've already loaded the image to display.
// Is there anything to clean up? See below.
if (m_graphicsItemToDelete) {
delete m_graphicsItemToDelete;
m_graphicsItemToDelete = 0;
}
return;
}
if (m_graphicsItem->type() == QGraphicsPixmapItem::Type)
{
// We've already loaded the image to display.
QGraphicsItemGroup::paint(painter, option, widget);
// Is there anything to clean up? See below.
if (m_graphicsItemToDelete) {
delete m_graphicsItemToDelete;
m_graphicsItemToDelete = 0;
}
return;
}
To copy to clipboard, switch view to plain text mode
The actual painting on the screen seems to be slow, as opposed to the conversions/calculations etc.
Bookmarks