本文整理汇总了C++中QPrinter::printerName方法的典型用法代码示例。如果您正苦于以下问题:C++ QPrinter::printerName方法的具体用法?C++ QPrinter::printerName怎么用?C++ QPrinter::printerName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPrinter
的用法示例。
在下文中一共展示了QPrinter::printerName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: destination
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();
}
示例2: printerName
QString QPrinterProto::printerName() const
{
QPrinter *item = qscriptvalue_cast<QPrinter*>(thisObject());
if (item)
return item->printerName();
return QString();
}
示例3: QPrinterInfoPrivate
/*!
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));
}
}
示例4: foreach
/*!
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;
}
}
}
示例5: pi
/*!
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));
}
}
示例6: print
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);
}
示例7: printFormHelper
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 ) );
}
}
}
示例8: 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!"));
};
};
};
示例9: print
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
}
示例10: printerName
int Printer::printerName(lua_State * L) // const : QString
{
QPrinter* lhs = ValueBinding<MyQPrinter>::check( L, 1 );
*QtValue<QString>::create( L ) = lhs->printerName();
return 1;
}