Trolltech Home | Qt4-preview-feedback Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt4-preview-feedback Archive, April 2008
Qt4.4-rc1 Print Margins under Linux


Message 1 in thread

Hello,

I'm not sure if this is a bug, or expected behavior... I'm trying to setup 
the print margins to a default setting before executing the print dialog 
and also the print preview dialog. Everything works as expected for the 
print preview dialog (my print margins are filled in when the dialog comes 
up). But for the print dialog, the numbers are *not* filled in. Here is 
the code to bring up the dialogs (more or less ripped off of the textedit 
example):

For the print dialog-

   QPrinter printer(QPrinter::HighResolution);
   printer.setPaperSize(QPrinter::Letter);
   printer.setPageMargins(0.6,0.5,0.5,0.5,QPrinter::Inch);
   QPrintDialog *dlg = new QPrintDialog(&printer, this);
   if (textEdit1->textCursor().hasSelection())
     dlg->addEnabledOption(QAbstractPrintDialog::PrintSelection);
   dlg->setWindowTitle(tr("Print Document"));
   if (dlg->exec() == QDialog::Accepted)
   {
     textEdit1->print(&printer);
   }
   delete dlg;

For the print preview dialog-

   QPrinter printer(QPrinter::HighResolution);
   printer.setPaperSize(QPrinter::Letter);
   printer.setPageMargins(0.6,0.5,0.5,0.5,QPrinter::Inch);
   QPrintPreviewDialog preview(&printer, this);
   connect(&preview, SIGNAL(paintRequested(QPrinter *)), SLOT(printPreview(QPrinter *)));
   preview.exec();

When the print dialog comes up, you have to click the properties button 
for the printer to get to the margins. I suspect this has something to do 
with CUPS having margins as a property of the printer?

When the print preview dialog comes up, there is a separate button to pull 
up the margins, and these are fine.

Thoughts? Thanks.

If you don't mind, please forward answers to my email, as I don't check 
the list very regularly anymore...

To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx