Esempio n. 1
0
QSize FilePrinter::psPaperSize( QPrinter &printer )
{
    QSize size;

    switch ( printer.pageSize() ) {
    case QPrinter::A0:        size = QSize( 2384, 3370 ); break;
    case QPrinter::A1:        size = QSize( 1684, 2384 ); break;
    case QPrinter::A2:        size = QSize( 1191, 1684 ); break;
    case QPrinter::A3:        size = QSize(  842, 1191 ); break;
    case QPrinter::A4:        size = QSize(  595,  842 ); break;
    case QPrinter::A5:        size = QSize(  420,  595 ); break;
    case QPrinter::A6:        size = QSize(  298,  420 ); break;
    case QPrinter::A7:        size = QSize(  210,  298 ); break;
    case QPrinter::A8:        size = QSize(  147,  210 ); break;
    case QPrinter::A9:        size = QSize(  105,  147 ); break;
    case QPrinter::B0:        size = QSize( 2835, 4008 ); break;
    case QPrinter::B1:        size = QSize( 2004, 2835 ); break;
    case QPrinter::B2:        size = QSize( 1417, 2004 ); break;
    case QPrinter::B3:        size = QSize( 1001, 1417 ); break;
    case QPrinter::B4:        size = QSize(  709, 1001 ); break;
    case QPrinter::B5:        size = QSize(  499,  709 ); break;
    case QPrinter::B6:        size = QSize(  354,  499 ); break;
    case QPrinter::B7:        size = QSize(  249,  354 ); break;
    case QPrinter::B8:        size = QSize(  176,  249 ); break;
    case QPrinter::B9:        size = QSize(  125,  176 ); break;
    case QPrinter::B10:       size = QSize(   88,  125 ); break;
    case QPrinter::C5E:       size = QSize(  459,  649 ); break;
    case QPrinter::Comm10E:   size = QSize(  297,  684 ); break;
    case QPrinter::DLE:       size = QSize(  312,  624 ); break;
    case QPrinter::Executive: size = QSize(  522,  756 ); break;
    case QPrinter::Folio:     size = QSize(  595,  935 ); break;
    case QPrinter::Ledger:    size = QSize( 1224,  792 ); break;
    case QPrinter::Legal:     size = QSize(  612, 1008 ); break;
    case QPrinter::Letter:    size = QSize(  612,  792 ); break;
    case QPrinter::Tabloid:   size = QSize(  792, 1224 ); break;
    case QPrinter::Custom:    return QSize( (int) printer.widthMM() * ( 25.4 / 72 ),
                                            (int) printer.heightMM() * ( 25.4 / 72 ) );
    default:                  return QSize();
    }

    if ( printer.orientation() == QPrinter::Landscape ) {
        size.transpose();
    }

    return size;
}
Esempio n. 2
0
QString FilePrinter::mediaPageSize( QPrinter &printer )
{
    switch ( printer.pageSize() ) {
    case QPrinter::A0:         return QStringLiteral("A0");
    case QPrinter::A1:         return QStringLiteral("A1");
    case QPrinter::A2:         return QStringLiteral("A2");
    case QPrinter::A3:         return QStringLiteral("A3");
    case QPrinter::A4:         return QStringLiteral("A4");
    case QPrinter::A5:         return QStringLiteral("A5");
    case QPrinter::A6:         return QStringLiteral("A6");
    case QPrinter::A7:         return QStringLiteral("A7");
    case QPrinter::A8:         return QStringLiteral("A8");
    case QPrinter::A9:         return QStringLiteral("A9");
    case QPrinter::B0:         return QStringLiteral("B0");
    case QPrinter::B1:         return QStringLiteral("B1");
    case QPrinter::B10:        return QStringLiteral("B10");
    case QPrinter::B2:         return QStringLiteral("B2");
    case QPrinter::B3:         return QStringLiteral("B3");
    case QPrinter::B4:         return QStringLiteral("B4");
    case QPrinter::B5:         return QStringLiteral("B5");
    case QPrinter::B6:         return QStringLiteral("B6");
    case QPrinter::B7:         return QStringLiteral("B7");
    case QPrinter::B8:         return QStringLiteral("B8");
    case QPrinter::B9:         return QStringLiteral("B9");
    case QPrinter::C5E:        return QStringLiteral("C5");     //Correct Translation?
    case QPrinter::Comm10E:    return QStringLiteral("Comm10"); //Correct Translation?
    case QPrinter::DLE:        return QStringLiteral("DL");     //Correct Translation?
    case QPrinter::Executive:  return QStringLiteral("Executive");
    case QPrinter::Folio:      return QStringLiteral("Folio");
    case QPrinter::Ledger:     return QStringLiteral("Ledger");
    case QPrinter::Legal:      return QStringLiteral("Legal");
    case QPrinter::Letter:     return QStringLiteral("Letter");
    case QPrinter::Tabloid:    return QStringLiteral("Tabloid");
    case QPrinter::Custom:     return QStringLiteral("Custom.%1x%2mm")
                                            .arg( printer.heightMM() )
                                            .arg( printer.widthMM() );
    default:                   return QString();
    }
}
Esempio n. 3
0
int Printer::pageSize(lua_State * L) // const : PageSize 
{
	QPrinter* lhs = ValueBinding<MyQPrinter>::check( L, 1 );
	Util::push( L, lhs->pageSize() );
	return 1; 
}