title: Qt QPrinter setPaperSize does not work properly
body: <p>I am trying to create a Windows application (but will eventually port it to linux also, so cross-compatibility is important if possible) that will take a picture from a webcam and can print without using a printDialog box, but I am having an issue selecting a paper size.  I would like the paper size to be set to 4" x 6" which is the A6 format, but when I use setPaperSize(QtPrinter::A6) it seems to default to the letter format.  It does not always default to letter with all printers though, it looks like each printer handles the command differently, but most default to letter.  I believe this may be an issue with Qt and printer compatibility with the drivers.</p>
  
  <p><strong>My question is:</strong>  Does anyone know a way to set the printer to 4" by 6" in Qt that should work with all printers?</p>
  
  <p>My code is shown below.</p>
  
  <pre><code>void MainWindow::Print() {
  
      QPainter painter;
      QPrinter *printer = new QPrinter(QPrinter::HighResolution);
      printer-&gt;setPaperSize(QPrinter::A6);
       if (!painter.begin(printer)) {
           qWarning("Failed to open file");
           return;
       }
  
       painter.fillRect(QRectF(QPointF(108,118),QPointF(110+352, 120+352)), Qt::black);
       painter.fillRect(QRectF(QPointF(109,119),QPointF(109+352, 119+352)), Qt::white);
       ui-&gt;graphicsView-&gt;scene()-&gt;render(&amp;painter, QRectF(110,120, 350, 350), QRectF(0,0, ui-&gt;graphicsView-&gt;scene()-&gt;width(), ui-&gt;graphicsView-&gt;scene()-&gt;height()), Qt::IgnoreAspectRatio);
       painter.drawText(110, 110, "Test");
       painter.end();
  }
  </code></pre>
  
  <p>I have tried the following for resizing the paper</p>
  
  <pre><code>printer-&gt;setPaperSize(QPrinter::A6)
  printer-&gt;setPageSize(QPrinter::A6)
  printer-&gt;setPaperSize(QSizeF(4.0, 6.0), QPrinter::Inch)
  </code></pre>
  
  <p>none of those seemed to work.  If anyone could help me with this issue I would be very greateful</p>