本文整理汇总了C++中QPrinter::setPrinterName方法的典型用法代码示例。如果您正苦于以下问题:C++ QPrinter::setPrinterName方法的具体用法?C++ QPrinter::setPrinterName怎么用?C++ QPrinter::setPrinterName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPrinter
的用法示例。
在下文中一共展示了QPrinter::setPrinterName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_actionPrint_triggered
// Push textEdit contents to a printer
void MainWindow::on_actionPrint_triggered()
{
QPrinter printer;
printer.setPrinterName("Printer");
QPrintDialog dialog(&printer, this);
if(dialog.exec() == QDialog::Rejected) {
return;
} else {
ui->textEdit->print(&printer);
}
}
示例2: printOverSide
void dController::printOverSide(int RowId)
{
//TODO это должно быть в отдельном классе !!!
QGraphicsScene *scene = new QGraphicsScene();
bool page_orient= false;
int margin_top = MM_TO_POINT(15);
int margin_bottom=MM_TO_POINT(15);
int margin_left=MM_TO_POINT(35);
int margin_right=MM_TO_POINT(15);
int page_width=210;
int page_height=297;
scene->clear();
scene->setSceneRect(0, 0, MM_TO_POINT(page_width),MM_TO_POINT(page_height));
QGraphicsRectItem *border_rect = new QGraphicsRectItem (QRectF(margin_left, margin_top, MM_TO_POINT(page_width)-margin_left-margin_right,MM_TO_POINT(page_height)-margin_top-margin_bottom));
qDebug() <<"margin_rect"<< margin_left << margin_top << margin_left<<margin_right;
border_rect->setPen(QPen(Qt::black,2,Qt::DotLine));
border_rect->setBrush(QBrush(Qt::white));
border_rect->setOpacity(0.5);
border_rect->setZValue(0);
//border_rect->setData(ObjectName, "Border");
scene->addItem(border_rect);
SimpleItem* MBitem = new SimpleItem;
MBitem->setPos(MM_TO_POINT(5), MM_TO_POINT(280));
MBitem->setPrintFrame(false);
MBitem->setText(QStringList()<<QString("МБ №-%1"));
MBitem->setFlag(QGraphicsItem::ItemIsMovable);
MBitem->setParentItem(border_rect);
//scene->addItem(MBtem);
scene->update();
QPrinter printer;
printer.setPrinterName(curPrinter); //Печать на реальный принтер
//printer.setOutputFormat(QPrinter::PdfFormat);
//printer.setOutputFileName("overside.pdf");
//printer.setPageSize(QPrinter::A4);
QPainter painter(&printer);
scene->render(&painter);
//emit sayMeGood();
}
示例3: filePrint
void RenderWindow::filePrint()
{
orReport report;
report.setDom(_doc);
report.setParamList(getParameterList());
QPrinter printer;
if(!_printerName.isEmpty())
{
printer.setPrinterName(_printerName);
_printerName = QString::null;
}
if(report.isValid())
report.print(&printer);
else
report.reportError(this);
}
示例4: setPrinterName
void QPrinterProto::setPrinterName(const QString & name)
{
QPrinter *item = qscriptvalue_cast<QPrinter*>(thisObject());
if (item)
item->setPrinterName(name);
}
示例5: setPrinterName
int Printer::setPrinterName(lua_State * L) // ( const QString & name )
{
QPrinter* lhs = ValueBinding<MyQPrinter>::check( L, 1 );
lhs->setPrinterName( QtValueBase::toString( L, 2 ));
return 0;
}
示例6: 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;
}
//.........这里部分代码省略.........