Thank you Uwe!

d) I found it (Stroustrup, page 223)

As work arround I get the pixmap now from the canvas cache. That works fine and I get a lot faster plot. May be there are better ways as you suggested in d) as we could disable the canvas cache. I will check that later.

Qt Code:
  1. void Plot::drawItems(QPainter *pPainter, const QRect &pRect, const QwtScaleMap pMap[QwtPlot::axisCnt], const QwtPlotPrintFilter &pFilter) const
  2. {
  3. QwtPlotItemList lAlwaysDrawnItems;
  4. // null pixmap means cache not valid
  5. bool lCacheValid = !mPixmapCache->isNull();
  6.  
  7. const QwtPlotItemList& lItemList = itemList();
  8. for (QwtPlotItemIterator lItemIter = lItemList.begin(); lItemIter != lItemList.end(); ++lItemIter)
  9. {
  10. QwtPlotItem *lItem = *lItemIter;
  11. if (lItem && lItem->isVisible() )
  12. {
  13. if ( !(pFilter.options() & QwtPlotPrintFilter::PrintGrid) && lItem->rtti() == QwtPlotItem::Rtti_PlotGrid)
  14. {
  15. continue;
  16. }
  17. // render items below z-index 1000
  18. // when cache is invalid only
  19. if(lItem->z() < 1000)
  20. {
  21. if(!lCacheValid)
  22. {
  23. pPainter->save();
  24. pPainter->setRenderHint(QPainter::Antialiasing, lItem->testRenderHint(QwtPlotItem::RenderAntialiased));
  25. lItem->draw(pPainter, pMap[lItem->xAxis()], pMap[lItem->yAxis()], pRect);
  26. pPainter->restore();
  27. }
  28. }
  29. else
  30. {
  31. // all items above z-index 1000 are added to a list in order to draw after cache content
  32. lAlwaysDrawnItems.append(lItem);
  33. }
  34. }
  35. }
  36.  
  37. if(lCacheValid)
  38. {
  39. // if cache has been valid then paint from pixmap cache
  40. pPainter->drawPixmap(pRect.topLeft(), *mPixmapCache);
  41. }
  42. else
  43. {
  44. mPixmapCache = new QPixmap(*canvas()->paintCache());
  45. }
  46.  
  47. // finally draw the rest to be rendered each time (z-index > 1000)
  48. for (QwtPlotItemIterator lItemIter = lAlwaysDrawnItems.begin(); lItemIter != lAlwaysDrawnItems.end(); ++lItemIter)
  49. {
  50. QwtPlotItem *lItem = *lItemIter;
  51. pPainter->save();
  52. pPainter->setRenderHint(QPainter::Antialiasing, lItem->testRenderHint(QwtPlotItem::RenderAntialiased));
  53. lItem->draw(pPainter, pMap[lItem->xAxis()], pMap[lItem->yAxis()], pRect);
  54. pPainter->restore();
  55. }
  56. }
To copy to clipboard, switch view to plain text mode 

Best Regards
Stefan