title: Qt PrintPreviewDialog , When click Print button, program crashes Why?
body: <p>I've got the following code:</p>
  
  <pre><code>void Test1::on_pushButton_1_clicked() // print the information
  {
  QPrinter printer(QPrinter::HighResolution);
  printer.setCreator("Me");
  printer.setDocName("Print");
  printer.setPaperSize(QPrinter::A4);
  
  QPrintPreviewDialog *pd = new QPrintPreviewDialog(&amp;printer);
  
  connect(pd,SIGNAL(paintRequested(QPrinter*)),this,SLOT(print(QPrinter*)));
  
  pd-&gt;exec();
  }
  
  
  
  void Test1::print(QPrinter *p)
  {
  QPainter painter(p);
  painter.setPen(Qt::blue);
  
  painter.setRenderHints(QPainter::Antialiasing |
                         QPainter::TextAntialiasing |
                         QPainter::SmoothPixmapTransform, true);
  
  painter.drawText(100, 100, "Name: ");
  painter.drawText(300, 100, "SuperMan");
  }
  </code></pre>
  
  <p>It works in my experimental projects, which are with 1 class [ 1 dialog ] only, but in my main project, when i press the button, the preview starts successfully, but then when i do press the "Print" button, my program just crash. It says "Your program stopped working, windows will search for solution" or something like that.
  I need to say that my program has a lot of classes and dialogs.
  I am almost sure that there is a problem with the pointers.
  I don't have lot of experience, so i just can't find where my mistake is.
  Please look my code and tell me what should i do because i've got only 2 more days to finish that project.
  Thank you a lot in advance.</p>