title: How can I tell QGraphicsItem::paint() is being called for printing?
body: <p>I have a custom <code>QGraphicsItem</code> that display large (100s of MB compressed, mutli-channel) images. It's working pretty well right now.</p>
  
  <p>The idea is only load scanlines that are needed for current view scale and graphics view port. And divide the display into tiles that are built in separate threads. The <a href="http://doc.trolltech.com/latest/qgraphicsitem.html#paint" rel="nofollow"><code>paint()</code></a> function only constructs the tiles and feed them to QThreadPool. It also checks for and draw any tiles that are done. There are more code handling the events between the threads/runnables and the item. But this is the basic part.</p>
  
  <p>The goal is to provide a responsive UI. When the item is updating itself, UI is not blocked. It all work well until I tried to figure how to print it.</p>
  
  <p>The problem is I need to know a particular call to my paint function is resulted from a print instead of on screen update. This is needed to block the main thread until all my tiles are done and plotted to the painter (or the printed page will be blank since paint() returns right away)</p>
  
  <p>It also helps to adjust the sample rate since the printer has higher resolution than screen.</p>
  
  <p>So my question comes down to this: <strong>How can I find out if the <code>QPainter</code> passed to my <code>paint()</code> is a screen or a printer. Better yet, can I tell if the invocation is for print preview or actual print?</strong></p>
  
  <p>Thanks.</p>