本文整理汇总了C++中QPrinter::colorMode方法的典型用法代码示例。如果您正苦于以下问题:C++ QPrinter::colorMode方法的具体用法?C++ QPrinter::colorMode怎么用?C++ QPrinter::colorMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPrinter
的用法示例。
在下文中一共展示了QPrinter::colorMode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: colorMode
QPrinter::ColorMode QPrinterProto::colorMode() const
{
QPrinter *item = qscriptvalue_cast<QPrinter*>(thisObject());
if (item)
return item->colorMode();
return QPrinter::Color;
}
示例2: print
void ProRataGraphPane::print()
{
if ( !(qtwGraphTab->currentWidget()) )
{
return ;
}
/*
QString qsSaveFileName = QFileDialog::getSaveFileName(
this,
"ProRata - Choose a file name to save",
".",
"Images (*.png *.jpg)");
if (qsSaveFileName.isEmpty())
{
return;
}
*/
ProRataGraph *clickedGraph = (ProRataGraph *)qtwGraphTab->currentWidget();
QPrinter printer;
//printer.setOutputToFile(true);
//printer.setOutputFileName(qsSaveFileName);
printer.setDocName(QString("ProRata_Graph"));
printer.setCreator("ProRata Graph");
printer.setOrientation(QPrinter::Landscape);
QPrintDialog dialog(&printer);
if ( dialog.exec() )
{
QwtPlotPrintFilter filter;
if ( printer.colorMode() == QPrinter::GrayScale )
{
filter.setOptions(QwtPlotPrintFilter::PrintAll
& ~QwtPlotPrintFilter::PrintCanvasBackground);
}
clickedGraph->print( printer, filter );
}
/*
//QPixmap *qpPic = new QPixmap( qsSaveFileName );
//QPainter * qpntrPainter = new QPainter( qpPic );
QPixmap qpPic( qsSaveFileName );
qpPic.save( qsSaveFileName );
//QPainter * qpntrPainter = new QPainter( qpPic );
//clickedGraph->print( qpntrPainter, clickedGraph->frameGeometry() );
clickedGraph->print( qpPic );
*/
//QMessageBox::information( this, "Printing done.", QString( "Saved \"") + qsSaveFileName + QString( "\"" ) );
}
示例3: print
void Printer::print()
{
// we can only print if "PRINT" mode is selected
if (printMode != Printer::PRINT) {
return;
}
QPrinter *printerPtr;
printerPtr = static_cast<QPrinter*>(paintDevice);
TemplateLayout t(printOptions, templateOptions);
connect(&t, SIGNAL(progressUpdated(int)), this, SLOT(templateProgessUpdated(int)));
dpi = printerPtr->resolution();
//rendering resolution = selected paper size in inchs * printer dpi
pageSize.setHeight(qCeil(printerPtr->pageRect(QPrinter::Inch).height() * dpi));
pageSize.setWidth(qCeil(printerPtr->pageRect(QPrinter::Inch).width() * dpi));
webView->page()->setViewportSize(pageSize);
webView->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
// export border width with at least 1 pixel
// templateOptions->borderwidth = std::max(1, pageSize.width() / 1000);
if (printOptions->type == print_options::DIVELIST) {
webView->setHtml(t.generate());
} else if (printOptions->type == print_options::STATISTICS ) {
webView->setHtml(t.generateStatistics());
}
if (printOptions->color_selected && printerPtr->colorMode()) {
printerPtr->setColorMode(QPrinter::Color);
} else {
printerPtr->setColorMode(QPrinter::GrayScale);
}
// apply user settings
int divesPerPage;
// get number of dives per page from data-numberofdives attribute in the body of the selected template
bool ok;
divesPerPage = webView->page()->mainFrame()->findFirstElement("body").attribute("data-numberofdives").toInt(&ok);
if (!ok) {
divesPerPage = 1; // print each dive in a single page if the attribute is missing or malformed
//TODO: show warning
}
int Pages;
if (divesPerPage == 0) {
flowRender();
} else {
Pages = qCeil(getTotalWork(printOptions) / (float)divesPerPage);
render(Pages);
}
}
示例4: colorMode
int Printer::colorMode(lua_State * L) // const : ColorMode
{
QPrinter* lhs = ValueBinding<MyQPrinter>::check( L, 1 );
Util::push( L, lhs->colorMode() );
return 1;
}