Ejemplo n.º 1
0
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();
}
Ejemplo n.º 2
0
QString QPrinterProto::printerName() const
{
  QPrinter *item = qscriptvalue_cast<QPrinter*>(thisObject());
  if (item)
    return item->printerName();
  return QString();
}
Ejemplo n.º 3
0
/*!
    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));
    }
}
Ejemplo n.º 4
0
/*!
    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;
        }
    }
}
Ejemplo n.º 5
0
/*!
    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));
    }
}
Ejemplo n.º 6
0
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);
}
Ejemplo n.º 7
0
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 ) );
        }
    }
}
Ejemplo n.º 8
0
/*
*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!"));
		};
	};
};
Ejemplo n.º 9
0
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
}
Ejemplo n.º 10
0
int Printer::printerName(lua_State * L) // const : QString 
{
	QPrinter* lhs = ValueBinding<MyQPrinter>::check( L, 1 );
    *QtValue<QString>::create( L ) = lhs->printerName();
	return 1; 
}