本文整理汇总了C++中QPrinter::setCreator方法的典型用法代码示例。如果您正苦于以下问题:C++ QPrinter::setCreator方法的具体用法?C++ QPrinter::setCreator怎么用?C++ QPrinter::setCreator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPrinter
的用法示例。
在下文中一共展示了QPrinter::setCreator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exportVector
void MultiLayer::exportVector(const QString &fileName, int res, bool color,
bool keepAspect, QPrinter::PageSize pageSize,
QPrinter::Orientation orientation) {
Q_UNUSED(res);
if (fileName.isEmpty()) {
QMessageBox::critical(this, tr("Error"),
tr("Please provide a valid file name!"));
return;
}
QPrinter printer;
printer.setDocName(this->name());
printer.setCreator("AlphaPlot");
printer.setFullPage(true);
printer.setOutputFileName(fileName);
if (fileName.contains(".eps"))
printer.setOutputFormat(QPrinter::PostScriptFormat);
if (color)
printer.setColorMode(QPrinter::Color);
else
printer.setColorMode(QPrinter::GrayScale);
if (pageSize == QPrinter::Custom)
printer.setPaperSize(canvas->size(), QPrinter::Point);
else {
printer.setOrientation(orientation);
printer.setPaperSize(pageSize);
}
exportPainter(printer, keepAspect);
}
示例2: saveAsDocument
void PageScreen::saveAsDocument(const QString &format)
{
const QString &suffix = QLatin1Char('.') + format.toLower();
QString pathWithoutSuffix = ui->location->text();
if (pathWithoutSuffix.endsWith(suffix, Qt::CaseInsensitive)) {
pathWithoutSuffix = pathWithoutSuffix.mid(0, pathWithoutSuffix.length() - suffix.length());
}
QPrinter printer;
printer.setCreator(QupZilla::tr("QupZilla %1 (%2)").arg(QupZilla::VERSION, QupZilla::WWWADDRESS));
printer.setOutputFileName(pathWithoutSuffix + suffix);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setPaperSize(m_pageImages.first().size(), QPrinter::DevicePixel);
printer.setPageMargins(0, 0, 0, 0, QPrinter::DevicePixel);
printer.setFullPage(true);
QPainter painter;
painter.begin(&printer);
for (int i = 0; i < m_pageImages.size(); ++i) {
const QImage &image = m_pageImages.at(i);
painter.drawImage(0, 0, image);
if (i != m_pageImages.size() - 1) {
printer.newPage();
}
}
painter.end();
}
示例3: exportVector
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();
}
示例4: print
/**
* Methode permettant d'imprimer un document
*/
void ValidDocument::print(){
QWebView webView;
QPrinter printer ;
printer.setPageSize(QPrinter::A4);
printer.setFullPage(true);
QString type=(docType==Document::Facture)?QObject::trUtf8("Facture"):QObject::trUtf8("Devis");
printer.setDocName(type+"_"+QString::number(id) );
printer.setCreator(QObject::trUtf8("QFacturation"));
printer.setOutputFormat(QPrinter::NativeFormat);
webView.setHtml(view);
webView.show();
QPrintDialog printDialog(&printer);
if(printDialog.exec() == QDialog::Accepted) {
qDebug("Ne fonctionne pas sous windows")<<" Hack ....";
#if defined(Q_WS_WIN)
QTextDocument text;
text.setHtml(view);
text.print(&printer);
#endif
#if defined(Q_WS_QWS)
webView.print(&printer);
#endif
#if defined(Q_WS_X11)
webView.print(&printer);
#endif
}
}
示例5: 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( "\"" ) );
}
示例6: savePDF
void data_plot::savePDF()
{
if (save_file_name.length() > 0)
{
QPrinter printer;
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOrientation(QPrinter::Landscape);
printer.setOutputFileName((save_file_name + ".pdf").c_str());
printer.setCreator("Aluminizer2");
myPlot.print(printer);
}
}
示例7: filePrint
void PmChart::filePrint()
{
QPrinter printer;
QString creator = QString("pmchart Version ");
creator.append(pmGetConfig("PCP_VERSION"));
printer.setCreator(creator);
printer.setOrientation(QPrinter::Portrait);
printer.setDocName("pmchart.pdf");
QPrintDialog print(&printer, (QWidget *)this);
if (print.exec()) {
QPainter qp(&printer);
painter(&qp, printer.width(), printer.height(), false, false);
}
}
示例8: print
void Matrix::print(const QString& fileName)
{
QPrinter printer;
printer.setColorMode (QPrinter::GrayScale);
if (!fileName.isEmpty()){
printer.setCreator("QtiPlot");
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(fileName);
} else {
QPrintDialog printDialog(&printer, applicationWindow());
if (printDialog.exec() != QDialog::Accepted)
return;
}
printer.setFullPage( true );
print(&printer);
}
示例9: Print
/*
*Function: Print
*Inputs:none
*Outputs:none
*Returns:none
*/
void GraphPaneData::Print()
{
IT_IT("GraphPaneData::Print");
QPrinter prt;
prt.setDocName(tr("Pen Trace"));
prt.setCreator(tr(SYSTEM_NAME));
prt.setOrientation(QPrinter::Landscape);
prt.setOutputFileName("~out.ps");
prt.setOutputToFile(false);
//
if(prt.setup(this))
{
//
// Handle the case of no printer being selected
//
if(!prt.printerName().isEmpty())
{
QPainter p;
p.begin(&prt);
QPaintDeviceMetrics metrics(p.device());
//
int dpix = metrics.logicalDpiX() ; // inch border
int dpiy = metrics.logicalDpiY() ;
//
QRect body(dpix, dpiy, metrics.width() - dpix*6, metrics.height() - dpiy*2);
TheGraph.Plot(p,body,Qt::white);
//
QFont font("times", 8);
p.setFont(font);
//
p.drawText( body.left() ,body.top(), Title);
//
p.end();
//
}
else
{
QMessageBox::information(this,tr("Print Graph Error"),tr("No Printer Selected!"));
};
};
};
示例10: printPlot
void PlotWindow::printPlot()
{
QPrinter printer;
QString docName = mpPlot->title().text();
if (docName.isEmpty())
{
//docName.replace (QRegExp (QString::fromLatin1 ("\n")), tr (" -- "));
docName = QString::fromLatin1("A plot of selected COPASI output");
printer.setDocName(docName);
}
printer.setCreator("COPASI");
printer.setOrientation(QPrinter::Landscape);
QPrintDialog dialog(&printer);
if (dialog.exec())
mpPlot->print(printer, PrintFilter());
}
示例11: on_pushButton_print_clicked
/**
Impression du livre des recettes
*/
void DialogInvoiceList::on_pushButton_print_clicked() {
//Si on est pas connecte on sort
if((!m_data->isConnected()) || (ui->tableWidget_Invoices->rowCount()<=0) )return;
QPrinter printer;
printer.setPageSize(QPrinter::A4);
QString name = tr("LIVRERECETTES-")+ m_date.toString(tr("yyyyMM")) ;
printer.setOutputFileName( name + ".pdf");
printer.setDocName( name );
printer.setCreator("mcercle");
DialogPrintChoice *m_DialogPrintChoice = new DialogPrintChoice(&printer);
m_DialogPrintChoice->setModal(true);
m_DialogPrintChoice->exec();
if(m_DialogPrintChoice->result() == QDialog::Accepted) {
QWidget fenetre;
QPrintPreviewDialog m_PreviewDialog(&printer, &fenetre, Qt::Widget | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint);
connect(&m_PreviewDialog, SIGNAL(paintRequested(QPrinter *)), this, SLOT(on_paintPrinter(QPrinter *)));
m_PreviewDialog.setWindowState(Qt::WindowMaximized);
m_PreviewDialog.exec();
}
示例12: on_saveButton_clicked
void SimDialog::on_saveButton_clicked()
{
#if QT_VERSION >= 0x040100
#ifndef QT_NO_FILEDIALOG
const QString fileName = QFileDialog::getSaveFileName(
this, "Save File Name", QString(),
"PDF Documents (*.pdf)");
#else
const QString fileName = "similarity.pdf";
#endif
if ( !fileName.isEmpty() )
{
QPrinter printer;
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOrientation(QPrinter::Landscape);
printer.setOutputFileName(fileName);
printer.setCreator("Octree Similarity");
m_plot->print(printer);
}
#endif
}
示例13: print
void Clamp::print() {
#if 1
QPrinter printer;
#else
QPrinter printer(QPrinter::HighResolution);
#if QT_VERSION < 0x040000
printer.setOutputToFile(true);
printer.setOutputFileName("/tmp/FI.ps");
printer.setColorMode(QPrinter::Color);
#else
printer.setOutputFileName("/tmp/FI.pdf");
#endif
#endif
QString docName = splot->title().text();
if (!docName.isEmpty()) {
docName.replace(QRegExp(QString::fromLatin1("\n")), tr(" -- "));
printer.setDocName(docName);
}
printer.setCreator("RTXI");
printer.setOrientation(QPrinter::Landscape);
#if QT_VERSION >= 0x040000
QPrintDialog dialog(&printer);
if ( dialog.exec() ) {
#else
if (printer.setup()) {
#endif
/*
RTXIPrintFilter filter;
if (printer.colorMode() == QPrinter::GrayScale) {
int options = QwtPlotPrintFilter::PrintAll;
filter.setOptions(options);
filter.color(QColor(29, 100, 141),
QwtPlotPrintFilter::CanvasBackground);
filter.color(Qt::white, QwtPlotPrintFilter::CurveSymbol);
}
*/
// splot->print(printer, filter);
QwtPlotRenderer *renderer = new QwtPlotRenderer;
renderer->renderTo(splot, printer);
}
}
void Clamp::exportSVG() {
QString fileName = "FI.svg";
std::cout<<"flag 0"<<std::endl;
#if QT_VERSION < 0x040000
std::cout<<"flag 1"<<std::endl;
#ifndef QT_NO_FILEDIALOG
std::cout<<"flag 2"<<std::endl;
fileName = QFileDialog::getSaveFileName("FI.svg", "SVG Documents (*.svg)", this);
#endif
std::cout<<"flag 3"<<std::endl;
if (!fileName.isEmpty()) {
// enable workaround for Qt3 misalignments
QwtPainter::setSVGMode(true);
QPicture picture;
QPainter p(&picture);
// splot->print(&p, QRect(0, 0, 800, 600));
QwtPlotRenderer *renderer = new QwtPlotRenderer;
renderer->renderTo(splot, p, QRect(0, 0, 800, 600));
p.end();
picture.save(fileName, "svg");
}
#elif QT_VERSION >= 0x040300
std::cout<<"flag 4"<<std::endl;
#ifdef QT_SVG_LIB
std::cout<<"flag 5"<<std::endl;
#ifndef QT_NO_FILEDIALOG
std::cout<<"flag 6"<<std::endl;
fileName = QFileDialog::getSaveFileName(this, "Export File Name",
QString(), "SVG Documents (*.svg)");
#endif
std::cout<<"flag 7"<<std::endl;
if ( !fileName.isEmpty() ) {
QSvgGenerator generator;
generator.setFileName(fileName);
generator.setSize(QSize(800, 600));
// splot->print(generator);
}
#endif
#endif
}
示例14: printRegister
void CustRegister::printRegister()
{
QDate theDate;
QPrinter prn;
QPainter p;
QRect rect;
ADBTable cust;
ADBTable cont;
ADB DB;
QString tmpSt;
char tStr[1024];
int yPos;
int pageNo = 1;
float Balance = 0.00;
float EndingBalance;
CustomersDB CDB;
AddressesDB addrDB;
CDB.get(myCustID);
addrDB.get(REF_CUSTOMER, myCustID, "Billing");
theDate = QDate::currentDate();
// prn.setPrintProgram("ghostview");
prn.setPrinterName("PostScript");
// prn.setOutputFileName("/home/marc/test.ps");
// prn.setOutputToFile(TRUE);
prn.setPageSize(QPrinter::Letter);
prn.setDocName("Register Listing");
prn.setCreator("Blarg! Online Services, Inc.");
if (!prn.setup()) return;
p.begin(&prn);
EndingBalance = DB.sumFloat("select SUM(Amount) from AcctsRecv where CustomerID = %ld", myCustID);
// Put the Blarg header and contact information on the page.
printHeader(&p, &CDB, &addrDB, EndingBalance);
// Put the register header on the page.
registerHeader(&p);
// Now, get the register information from the database.
DB.query("select TransDate, DueDate, LoginID, Memo, Amount from AcctsRecv where CustomerID = %ld order by TransDate, LoginID", myCustID);
yPos = 165;
p.setFont(QFont("courier", 8, QFont::Normal));
while (DB.getrow()) {
int Lines = (int) (strlen(DB.curRow["Memo"]) / 52) + 1;
int RowHeight = 15 * Lines;
// Check to see if we have enough room on the page left for this
// line.
if (yPos+RowHeight >= 740) {
printFooter(&p, pageNo++);
prn.newPage();
printHeader(&p, &CDB, &addrDB, EndingBalance);
registerHeader(&p);
yPos = 165;
p.setFont(QFont("courier", 8, QFont::Normal));
}
// The transaction date.
rect.setCoords(20, yPos, 79, yPos + RowHeight);
p.drawRect(rect);
p.drawText(rect, AlignVCenter|AlignHCenter, DB.curRow["TransDate"]);
// The Due Date
rect.setCoords(80, yPos, 139, yPos + RowHeight);
p.drawRect(rect);
p.drawText(rect, AlignVCenter|AlignHCenter, DB.curRow["DueDate"]);
// The Login ID
rect.setCoords(140, yPos, 199, yPos + RowHeight);
p.drawRect(rect);
p.drawText(rect, AlignVCenter|AlignHCenter, DB.curRow["LoginID"]);
// The description...
rect.setCoords(200, yPos, 419, yPos + RowHeight);
p.drawRect(rect);
rect.setCoords(203, yPos, 419, yPos + RowHeight);
p.drawText(rect, WordBreak|AlignLeft|AlignVCenter, DB.curRow["Memo"]);
// The amount.
rect.setCoords(420, yPos, 479, yPos + RowHeight);
p.drawRect(rect);
p.drawText(rect, AlignRight|AlignVCenter, DB.curRow["Amount"]);
// The balance.
Balance += atof(DB.curRow["Amount"]);
sprintf(tStr, "%.2f", Balance);
if (Balance == 0.0) strcpy(tStr, "0.00");
rect.setCoords(480, yPos, 539, yPos + RowHeight);
p.drawRect(rect);
p.drawText(rect, AlignRight|AlignVCenter, tStr);
yPos += RowHeight;
}
//.........这里部分代码省略.........
示例15: triggerAction
void Window::triggerAction(int identifier, const QVariantMap ¶meters)
{
switch (identifier)
{
case ActionsManager::CloneTabAction:
if (canClone())
{
m_mainWindow->addWindow(clone(true, m_mainWindow));
}
break;
case ActionsManager::PinTabAction:
setPinned(!isPinned());
break;
case ActionsManager::DetachTabAction:
if (m_mainWindow->getWindowCount() > 1)
{
m_mainWindow->moveWindow(this);
}
break;
case ActionsManager::SuspendTabAction:
if (!m_contentsWidget || m_contentsWidget->close())
{
m_session = getSession();
setContentsWidget(nullptr);
}
break;
case ActionsManager::CloseTabAction:
if (!isPinned())
{
requestClose();
}
break;
case ActionsManager::GoAction:
case ActionsManager::ActivateAddressFieldAction:
case ActionsManager::ActivateSearchFieldAction:
{
AddressWidget *addressWidget(findAddressWidget());
SearchWidget *searchWidget(nullptr);
for (int i = 0; i < m_searchWidgets.count(); ++i)
{
if (m_searchWidgets.at(i) && m_searchWidgets.at(i)->isVisible())
{
searchWidget = m_searchWidgets.at(i);
break;
}
}
if (identifier == ActionsManager::ActivateSearchFieldAction && searchWidget)
{
searchWidget->activate(Qt::ShortcutFocusReason);
}
else if (addressWidget)
{
if (identifier == ActionsManager::ActivateAddressFieldAction)
{
addressWidget->activate(Qt::ShortcutFocusReason);
}
else if (identifier == ActionsManager::ActivateSearchFieldAction)
{
addressWidget->setText(QLatin1String("? "));
addressWidget->activate(Qt::OtherFocusReason);
}
else if (identifier == ActionsManager::GoAction)
{
addressWidget->handleUserInput(addressWidget->text(), SessionsManager::CurrentTabOpen);
return;
}
}
else if (identifier == ActionsManager::ActivateAddressFieldAction || identifier == ActionsManager::ActivateSearchFieldAction)
{
OpenAddressDialog dialog(this);
if (identifier == ActionsManager::ActivateSearchFieldAction)
{
dialog.setText(QLatin1String("? "));
}
connect(&dialog, SIGNAL(requestedLoadUrl(QUrl,SessionsManager::OpenHints)), this, SLOT(handleOpenUrlRequest(QUrl,SessionsManager::OpenHints)));
connect(&dialog, SIGNAL(requestedOpenBookmark(BookmarksItem*,SessionsManager::OpenHints)), this, SIGNAL(requestedOpenBookmark(BookmarksItem*,SessionsManager::OpenHints)));
connect(&dialog, SIGNAL(requestedSearch(QString,QString,SessionsManager::OpenHints)), this, SLOT(handleSearchRequest(QString,QString,SessionsManager::OpenHints)));
dialog.exec();
}
}
break;
case ActionsManager::PrintAction:
{
QPrinter printer;
printer.setCreator(QStringLiteral("Otter Browser %1").arg(Application::getFullVersion()));
//.........这里部分代码省略.........