本文整理汇总了C++中ORPrintRender::setupPrinter方法的典型用法代码示例。如果您正苦于以下问题:C++ ORPrintRender::setupPrinter方法的具体用法?C++ ORPrintRender::setupPrinter怎么用?C++ ORPrintRender::setupPrinter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ORPrintRender
的用法示例。
在下文中一共展示了ORPrintRender::setupPrinter方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: print
void RenderWindow::print(bool showPreview)
{
ORPreRender pre;
pre.setDom(_doc);
pre.setParamList(getParameterList());
ORODocument * doc = pre.generate();
if(doc)
{
QPrinter printer(QPrinter::HighResolution);
if(!_printerName.isEmpty())
{
printer.setPrinterName(_printerName);
_printerName = QString::null;
}
if(showPreview)
{
PreviewDialog preview (doc, &printer, this);
if (preview.exec() == QDialog::Rejected)
return;
}
ORPrintRender render;
render.setupPrinter(doc, &printer);
QPrintDialog pd(&printer);
pd.setMinMax(1, doc->pages());
if(pd.exec() == QDialog::Accepted)
{
render.setPrinter(&printer);
render.render(doc);
}
}
}
示例2: exportToPDF
bool orReport::exportToPDF( const QString& fileName )
{
if ( !isValid() )
return false;
ORODocument * doc = _internal->_prerenderer.generate();
if(doc)
{
QString localFileName = fileName;
QPrinter printer( QPrinter::HighResolution );
if (! localFileName.endsWith(".pdf", Qt::CaseInsensitive))
localFileName.append(".pdf");
printer.setOutputFileName( localFileName );
#ifdef Q_WS_MAC
printer.setOutputFormat( QPrinter::NativeFormat );
#else
printer.setOutputFormat( QPrinter::PdfFormat );
#endif
ORPrintRender render;
render.setupPrinter(doc, &printer);
render.setPrinter(&printer);
return render.render(doc);
}
return false;
}
示例3: print
void RenderWindow::print(bool showPreview, int numCopies )
{
ORPreRender pre;
pre.setDom(_doc);
pre.setParamList(getParameterList());
ORODocument * doc = pre.generate();
if(doc)
{
QPrinter printer(QPrinter::HighResolution);
#if QT_VERSION < 0x040700 // if qt < 4.7.0 then use the old function call.
printer.setNumCopies( numCopies );
#else
printer.setCopyCount( numCopies );
#endif
if(!_printerName.isEmpty())
{
printer.setPrinterName(_printerName);
_printerName = QString::null;
}
ORPrintRender render;
render.setupPrinter(doc, &printer);
if(showPreview)
{
if(printer.printerName().isEmpty())
{
QPrintDialog pd(&printer);
if(pd.exec() != QDialog::Accepted)
{
return; // no printer, can't preview
}
}
PreviewDialog preview (doc, &printer, this);
if (preview.exec() == QDialog::Rejected)
return;
}
if(_autoPrint)
{
render.setPrinter(&printer);
render.render(doc);
}
else
{
QPrintDialog pd(&printer);
pd.setMinMax(1, doc->pages());
if(pd.exec() == QDialog::Accepted)
{
render.setPrinter(&printer);
render.render(doc);
}
}
delete doc;
}
}
示例4: slotPrintReport
void KexiReportView::slotPrintReport()
{
QPrinter printer;
ORPrintRender pr;
// do some printer initialization
pr.setPrinter(&printer);
pr.setupPrinter(m_reportDocument, &printer);
QPrintDialog *dialog = new QPrintDialog(&printer, this);
if (dialog->exec() != QDialog::Accepted)
return;
pr.render(m_reportDocument);
}
示例5: exportToPDF
bool ORPrintRender::exportToPDF(ORODocument * pDocument, QString pdfFileName)
{
if(!pDocument)
return false;
QPrinter printer(QPrinter::HighResolution);
#ifdef Q_WS_MAC
printer.setOutputFormat( QPrinter::NativeFormat );
#else
printer.setOutputFormat( QPrinter::PdfFormat );
#endif
printer.setOutputFileName( pdfFileName );
ORPrintRender render;
render.setupPrinter(pDocument, &printer);
render.setPrinter(&printer);
return render.render(pDocument);
}
示例6: print
bool orReport::print(QPrinter *prtThis, bool boolSetupPrinter)
{
// TODO: Figure out how all this is supposed to be with the new engine
bool retval = false;
bool localPrinter = false;
if (multiPainter)
{
if(_internal->_prerenderer.isValid())
{
ORODocument * doc = _internal->_prerenderer.generate();
if(doc)
{
_internal->_genDoc = doc;
ORPrintRender prender;
prender.setupPrinter(doc, prtThis);
if (boolSetupPrinter) // 1st call
{
retval = multiPainter->begin(multiPrinter);
if (retval == false)
{
delete multiPainter;
multiPrinter = 0;
multiPainter = 0;
}
}
else // 2nd or later print call
retval = multiPrinter->newPage();
if (retval)
retval = render(multiPainter, multiPrinter);
_internal->_genDoc = 0;
}
}
}
else
{
if(_internal != 0)
{
if (prtThis == 0)
{
prtThis = new QPrinter(QPrinter::HighResolution);
localPrinter = true;
}
if(_internal->_prerenderer.isValid())
{
ORODocument * doc = _internal->_prerenderer.generate();
if(doc)
{
_internal->_genDoc = doc;
retval = true;
ORPrintRender prender;
prender.setupPrinter(doc, prtThis);
QPrintDialog pd(prtThis);
if (boolSetupPrinter)
{
pd.setMinMax(1, doc->pages());
retval = (pd.exec() == QDialog::Accepted);
}
if(retval == true)
retval = render(0, prtThis);
_internal->_genDoc = 0;
}
}
if (localPrinter && prtThis != 0)
delete prtThis;
}
}
return retval;
}
示例7: print
void displayPrivate::print(ParameterList pParams, bool showPreview, bool forceSetParams)
{
int numCopies = 1;
ParameterList params = pParams;
if (forceSetParams || !params.count())
{
if(!_parent->setParams(params))
return;
}
params.append("isReport", true);
XSqlQuery report;
report.prepare("SELECT report_grade, report_source "
" FROM report "
" WHERE (report_name=:report_name)"
" ORDER BY report_grade DESC LIMIT 1");
report.bindValue(":report_name", reportName);
report.exec();
QDomDocument _doc;
if (report.first())
{
QString errorMessage;
int errorLine;
if (!_doc.setContent(report.value("report_source").toString(), &errorMessage, &errorLine))
{
QMessageBox::critical(_parent, ::display::tr("Error Parsing Report"),
::display::tr("There was an error Parsing the report definition. %1 %2").arg(errorMessage).arg(errorLine));
return;
}
}
else
{
QMessageBox::critical(_parent, ::display::tr("Report Not Found"),
::display::tr("The report %1 does not exist.").arg(reportName));
return;
}
ORPreRender pre;
pre.setDom(_doc);
pre.setParamList(params);
ORODocument * doc = pre.generate();
if(doc)
{
ReportPrinter printer(QPrinter::HighResolution);
printer.setNumCopies( numCopies );
ORPrintRender render;
render.setupPrinter(doc, &printer);
if(showPreview)
{
QPrinter * tPrinter = &printer;
QPrinter pdfPrinter(QPrinter::HighResolution);
if(!printer.isValid())
{
render.setupPrinter(doc, &pdfPrinter);
pdfPrinter.setOutputFormat(QPrinter::PdfFormat);
tPrinter = &pdfPrinter;
}
PreviewDialog preview (doc, tPrinter, _parent);
if (preview.exec() == QDialog::Rejected)
return;
}
QPrintDialog pd(&printer);
pd.setMinMax(1, doc->pages());
if(pd.exec() == QDialog::Accepted)
{
render.render(doc, &printer);
}
delete doc;
}
}