QPrintEngine *QPrinterProto::printEngine() const { QPrinter *item = qscriptvalue_cast<QPrinter*>(thisObject()); if (item) return item->printEngine(); return 0; }
QStringList FilePrinter::optionPageMargins( QPrinter &printer ) { if (printer.printEngine()->property(QPrintEngine::PPK_PageMargins).isNull()) { return QStringList(); } else { qreal l, t, r, b; printer.getPageMargins( &l, &t, &r, &b, QPrinter::Point ); return QStringList("-o") << QString("page-left=%1").arg(l) << "-o" << QString("page-top=%1").arg(t) << "-o" << QString("page-right=%1").arg(r) << "-o" << QString("page-bottom=%1").arg(b); } }
QStringList FilePrinter::optionCupsProperties( QPrinter &printer ) { QStringList dialogOptions = printer.printEngine()->property(QPrintEngine::PrintEnginePropertyKey(0xfe00)).toStringList(); QStringList cupsOptions; for ( int i = 0; i < dialogOptions.count(); i = i + 2 ) { if ( dialogOptions[i+1].isEmpty() ) { cupsOptions << QStringLiteral("-o") << dialogOptions[i]; } else { cupsOptions << QStringLiteral("-o") << dialogOptions[i] + QLatin1Char('=') + dialogOptions[i+1]; } } return cupsOptions; }