title: Printing complex widgets in Qt
body: <p>I have a complex widget with tons of different subwidgets, e.g. subclasses of QLabel. I want to print this widget, but obviously I do not want to print the background, I want to print with differing text colors or have the style of frames slightly modified.</p>
  
  <p>As I do not really want to iterate through all subwidgets with a special "print" function, which I would need to attach to all widgets (how to add "print" to a QLabel?), I would like to use paintEvent.</p>
  
  <p>If I have a hierarchy MyWidget -> derived from -> some QWidget, I would like to insert a sublayer MyWidget -> MyPrintWidget -> some QWidget, where myPrintWidget::paintEvent would check, if the current print is going to the screen (thus call QWidget::paintEvent), else if we are printing to the printer, call some function MyPrintWidget::drawWidget instead. </p>
  
  <ol>
  <li>Is this the right way to
  print-enable a widget?   </li>
  <li>How can I figure out in
  paintEvent, that I'm printing to a
  printer instead of the screen?</li>
  <li>Is there a good example of
  printing complex widgets?</li>
  </ol>