QPinter *printer = new QPinter(QPrinter::HighResolution); printer->setPageOrientation(QPageLayout::Landscape); printer->setPageSize(QPrinter::A4); message(QString("resol 1 = %1").arg(printer.resolution()));QPainter painter; painter.begin(printer); QRect viewport = painter.viewport(); message( QString("painter.viewport(): left = %1\nrigth = %2\ntop = %3\nbottom = %4\n") .arg(viewport.left()) .arg(viewport.right()) .arg(viewport.top()) .arg(viewport.bottom())); painter.end();
QPainter.drawText(1000,3000, "Hello world!");
QPrinter printer(QPrinter::HighResolution);printer.setPageMargins( QMarginsF(0, 0, 5000, 2000), QPageLayout::Point); ...QPainter painter;painter.begin(printer);QRect viewport = painter.viewport();message( QString("painter.viewport(): left = %1\nrigth = %2\ntop = %3\nbottom = %4\n") .arg(viewport.left()) .arg(viewport.right()) .arg(viewport.top()) .arg(viewport.bottom()));QRect windowPort = painter.window(); message( QString("painter.window(): left = %1\nrigth = %2\ntop = %3\nbottom = %4\n") .arg(windowPort.left()) .arg(windowPort.right()) .arg(windowPort.top()) .arg(windowPort.bottom()));.......}
C++ (Qt)bool QPainter::begin ( QPaintDevice * device )
C++ (Qt)painter.begin(printer);
C++ (Qt)painter.begin(&printer);