本文整理汇总了C++中QPrinter类的典型用法代码示例。如果您正苦于以下问题:C++ QPrinter类的具体用法?C++ QPrinter怎么用?C++ QPrinter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QPrinter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fullPage
bool QPrinterProto::fullPage() const
{
QPrinter *item = qscriptvalue_cast<QPrinter*>(thisObject());
if (item)
return item->fullPage();
return false;
}
示例2: fontEmbeddingEnabled
bool QPrinterProto::fontEmbeddingEnabled() const
{
QPrinter *item = qscriptvalue_cast<QPrinter*>(thisObject());
if (item)
return item->fontEmbeddingEnabled();
return false;
}
示例3: fromPage
int QPrinterProto::fromPage() const
{
QPrinter *item = qscriptvalue_cast<QPrinter*>(thisObject());
if (item)
return item->fromPage();
return 0;
}
示例4: doubleSidedPrinting
bool QPrinterProto::doubleSidedPrinting() const
{
QPrinter *item = qscriptvalue_cast<QPrinter*>(thisObject());
if (item)
return item->doubleSidedPrinting();
return false;
}
示例5: duplex
QPrinter::DuplexMode QPrinterProto::duplex() const
{
QPrinter *item = qscriptvalue_cast<QPrinter*>(thisObject());
if (item)
return item->duplex();
return QPrinter::DuplexNone;
}
示例6: colorMode
QPrinter::ColorMode QPrinterProto::colorMode() const
{
QPrinter *item = qscriptvalue_cast<QPrinter*>(thisObject());
if (item)
return item->colorMode();
return QPrinter::Color;
}
示例7: docName
QString QPrinterProto::docName() const
{
QPrinter *item = qscriptvalue_cast<QPrinter*>(thisObject());
if (item)
return item->docName();
return QString();
}
示例8: collateCopies
bool QPrinterProto::collateCopies() const
{
QPrinter *item = qscriptvalue_cast<QPrinter*>(thisObject());
if (item)
return item->collateCopies();
return false;
}
示例9: abort
bool QPrinterProto::abort()
{
QPrinter *item = qscriptvalue_cast<QPrinter*>(thisObject());
if (item)
return item->abort();
return false;
}
示例10: tr
void Matrix::exportVector(const QString& fileName, int res, bool color)
{
if ( fileName.isEmpty() ){
QMessageBox::critical(this, tr("QtiPlot - Error"), tr("Please provide a valid file name!"));
return;
}
QPrinter printer;
printer.setCreator("QtiPlot");
printer.setFullPage(true);
if (res)
printer.setResolution(res);
printer.setOutputFileName(fileName);
if (fileName.contains(".eps"))
printer.setOutputFormat(QPrinter::PostScriptFormat);
if (color)
printer.setColorMode(QPrinter::Color);
else
printer.setColorMode(QPrinter::GrayScale);
printer.setOrientation(QPrinter::Portrait);
int cols = numCols();
int rows = numRows();
QRect rect = QRect(0, 0, cols, rows);
printer.setPaperSize(QSizeF(cols, rows), QPrinter::DevicePixel);
QPainter paint(&printer);
paint.drawImage(rect, d_matrix_model->renderImage());
paint.end();
}
示例11: filePrint
void Help::filePrint()
{
QPrinter printer;
printer.setFullPage(TRUE);
if ( printer.setup() ) {
QPainter p( &printer );
QPaintDeviceMetrics metrics(p.device());
int dpix = metrics.logicalDpiX();
int dpiy = metrics.logicalDpiY();
const int margin = 72; // pt
QRect body(margin*dpix/72, margin*dpiy/72,
metrics.width()-margin*dpix/72*2,
metrics.height()-margin*dpiy/72*2 );
QFont font("times", 10);
QSimpleRichText richText( browser->text(), font, browser->context(), browser->styleSheet(),
browser->mimeSourceFactory(), body.height() );
richText.setWidth( &p, body.width() );
QRect view( body );
int page = 1;
do {
richText.draw( &p, body.left(), body.top(), view, colorGroup() );
view.moveBy( 0, body.height() );
p.translate( 0 , -body.height() );
p.setFont( font );
p.drawText( view.right() - p.fontMetrics().width( QString::number(page) ),
view.bottom() + p.fontMetrics().ascent() + 5, QString::number(page) );
if ( view.top() >= richText.height() )
break;
printer.newPage();
page++;
} while (TRUE);
}
}
示例12: printerSelectionOption
int Printer::printerSelectionOption(lua_State * L) // const : QString
{
QPrinter* lhs = ValueBinding<MyQPrinter>::check( L, 1 );
#ifndef _WIN32
*QtValue<QString>::create( L ) = lhs->printerSelectionOption();
#endif
return 1;
}
示例13: setPrinterSelectionOption
int Printer::setPrinterSelectionOption(lua_State * L) // ( const QString & option )
{
QPrinter* lhs = ValueBinding<MyQPrinter>::check( L, 1 );
#ifndef _WIN32
lhs->setPrinterSelectionOption( QtValueBase::toString( L, 2 ));
#endif
return 0;
}
示例14: savePdf
void SchedulePrintDialog::savePdf()
{
QPrinter printer;
setupPdfPrinter(printer);
QString fileName = QFileDialog::getSaveFileName(this, "Choose File Name for Pdf", QString(), "Pdf Documents (*.pdf)" );
printer.setOutputFileName( fileName );
doPrint(&printer);
}
示例15: exportToPdf
//-------------------------------------------------------------------------
void QGuidoItemContainer::exportToPdf(const QString& fileName)
{
QPrinter printer;
printer.setFullPage(true);
printer.setOutputFileName( fileName );
printer.setOutputFormat( QPrinter::PdfFormat );
exportToPdf( &printer );
}