QStringList FilePrinter::destination( QPrinter &printer, const QString &version ) { if ( version == QLatin1String("lp") ) { return QStringList(QStringLiteral("-d")) << printer.printerName(); } if ( version.startsWith( QLatin1String("lpr") ) ) { return QStringList(QStringLiteral("-P")) << printer.printerName(); } return QStringList(); }
QString QPrinterProto::printerName() const { QPrinter *item = qscriptvalue_cast<QPrinter*>(thisObject()); if (item) return item->printerName(); return QString(); }
/*! Constructs a QPrinterInfo object from \a printer. */ QPrinterInfo::QPrinterInfo(const QPrinter &printer) : d_ptr(&QPrinterInfoPrivate::shared_null) { QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get(); if (ps) { QPrinterInfo pi = ps->printerInfo(printer.printerName()); d_ptr.reset(new QPrinterInfoPrivate(*pi.d_ptr)); } }
/*! Constructs a QPrinterInfo object from \a printer. */ QPrinterInfo::QPrinterInfo(const QPrinter &printer) : d_ptr(&QPrinterInfoPrivate::shared_null) { foreach (const QPrinterInfo &printerInfo, availablePrinters()) { if (printerInfo.printerName() == printer.printerName()) { d_ptr.reset(new QPrinterInfoPrivate(*printerInfo.d_ptr)); break; } } }
/*! Constructs a QPrinterInfo object from \a printer. */ QPrinterInfo::QPrinterInfo(const QPrinter &printer) : d_ptr(shared_null) { QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get(); if (ps) { QPrinterInfo pi(printer.printerName()); if (pi.d_ptr.data() == shared_null) d_ptr.reset(shared_null); else d_ptr.reset(new QPrinterInfoPrivate(*pi.d_ptr)); } }
void DocuWindow::print() { QPrinter printer; if (printer.printerName().isEmpty()) { statusBar()->showMessage(tr("No printer installed"), 2000); return; } QPrintDialog printDialog(&printer, this); if (!printDialog.exec()) { statusBar()->showMessage(tr("Printing aborted"), 2000); return; } browser->document()->print(&printer); }
void QtDesignerChild::printFormHelper( QDesignerFormWindowInterface* form, bool quick ) { bool ok; const QStringList styles = QStyleFactory::keys(); const int id = styles.indexOf( pStylesActionGroup::systemStyle() ); QString style = QInputDialog::getItem( this, tr( "Choose a style..." ), tr( "Choose a style to render the form:" ), styles, id, false, &ok ); if ( !ok ) { return; } // get printer QPrinter printer; // if quick print if ( quick ) { // check if default printer is set if ( printer.printerName().isEmpty() ) { MonkeyCore::messageManager()->appendMessage( tr( "There is no default printer, please set one before trying quick print" ) ); return; } // print and return QPainter painter( &printer ); painter.drawPixmap( 0, 0, mDesignerManager->previewPixmap( form, style ) ); } else { // printer dialog QPrintDialog printDialog( &printer ); // if ok if ( printDialog.exec() ) { // print and return QPainter painter( &printer ); painter.drawPixmap( 0, 0, mDesignerManager->previewPixmap( form, style ) ); } } }
/* *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!")); }; }; };
void DocuWindow::print() { #ifdef QT_NO_PRINTER Q_UNIMPLEMENTED(); #else QPrinter printer; if (printer.printerName().isEmpty()) { statusBar()->showMessage(tr("No printer installed"), 2000); return; } QPrintDialog printDialog(&printer, this); if (!printDialog.exec()) { statusBar()->showMessage(tr("Printing aborted"), 2000); return; } browser->document()->print(&printer); #endif }
int Printer::printerName(lua_State * L) // const : QString { QPrinter* lhs = ValueBinding<MyQPrinter>::check( L, 1 ); *QtValue<QString>::create( L ) = lhs->printerName(); return 1; }