本文整理汇总了Java中com.trolltech.qt.gui.QPainter类的典型用法代码示例。如果您正苦于以下问题:Java QPainter类的具体用法?Java QPainter怎么用?Java QPainter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
QPainter类属于com.trolltech.qt.gui包,在下文中一共展示了QPainter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Printer
import com.trolltech.qt.gui.QPainter; //导入依赖的package包/类
public static void Printer(QTableWidget tw){
QPrinter printer = new QPrinter(); //(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter.OutputFormat.PdfFormat);
printer.setOutputFileName("/home/pablo/temp/informe.pdf");
printer.setPageSize(QPrinter.PageSize.Letter);
QPainter painter = new QPainter();
if(!painter.begin(printer)){
//qWarning("Error al abrir el archivo PDF para escritura.");
return;
}
painter.setRenderHint(QPainter.RenderHint.Antialiasing, true);
// Arreglo utilizado para el header del informe con sus respectivos Widths y Aligns
String header[][] = new String[2][3];
header[0][0] = "50"; // Width de la celda
header[0][1] = "ID"; // Texto de la celda
header[0][2] = "3"; // Align de la celda
header[1][0] = "300";
header[1][1] = "DESCRIPCIÓN";
header[1][2] = "0";
String lTitle = "INFORME DE CITACIONES";
Utils.PrintHeader(painter, lTitle, header, 1, (int)(tw.rowCount() / 44) + 1);
Utils.PrintTableWidget(printer, painter, lTitle, tw, header);
painter.end(); // finaliza el dibujado y libera el archivo PDF.
Utils.ShowPDF(printer.outputFileName());
}
示例2: paint
import com.trolltech.qt.gui.QPainter; //导入依赖的package包/类
@Override
public void paint(QPainter painter, QStyleOptionGraphicsItem option, QWidget widget)
{
// TODO Auto-generated method stub
painter.setRenderHint(QPainter.RenderHint.Antialiasing, true); //Anti aliasing
painter.setPen(Qt.PenStyle.NoPen);
painter.setBrush(QColor.fromRgba(QColor.yellow.rgb() & 0x7fffffff));
painter.drawEllipse(-1, -1, 2, 2);
painter.setPen(QPEN_BLACK);
painter.drawEllipse(-1, -1, 2, 2);
}
示例3: paint
import com.trolltech.qt.gui.QPainter; //导入依赖的package包/类
@Override
public void paint(QPainter painter, QStyleOptionGraphicsItem option, QWidget widget)
{
if (begin == null || end == null)
return;
//Draw the line itself
QLineF line = new QLineF(sourcePoint, destPoint);
painter.setRenderHint(QPainter.RenderHint.Antialiasing, true); //Anti aliasing
painter.setPen(qPenEdge);
painter.drawLine(line);
//Draw the arrows if there's enough room
double angle;
if (line.length() > 0)
angle = Math.acos(line.dx() / line.length());
else
angle = 0;
if (line.dy() >= 0)
angle = (Math.PI * 2) - angle;
destArrowP1.setX(destPoint.x() + Math.sin(angle - Math.PI / 3) * ARROWSIZE);
destArrowP1.setY(destPoint.y() + Math.cos(angle - Math.PI / 3) * ARROWSIZE);
destArrowP2.setX(destPoint.x() + Math.sin(angle - Math.PI + Math.PI / 3) * ARROWSIZE);
destArrowP2.setY(destPoint.y() + Math.cos(angle - Math.PI + Math.PI / 3) * ARROWSIZE);
pol.clear();
pol.append(line.p2());
pol.append(destArrowP1);
pol.append(destArrowP2);
painter.setBrush(qColor);
painter.drawPolygon(pol);
}
示例4: renderToImage
import com.trolltech.qt.gui.QPainter; //导入依赖的package包/类
/**
* Get a render of the page as an image
* @param width
* @param height
* @return Rendered page image
*/
public MBFImage renderToImage(int width, int height) {
QWebElement ele = webframe.documentElement();
if (ele == null) return null;
QSize size = ele.geometry().size();
if (size.width() < width) width = size.width();
if (size.height() < height) height = size.height();
if (width <= 0 || height <= 0)
return null;
QImage image = new QImage(new QSize(width, height), QImage.Format.Format_ARGB32_Premultiplied);
QPainter p = new QPainter(image);
p.setRenderHint(QPainter.RenderHint.Antialiasing, false);
p.setRenderHint(QPainter.RenderHint.TextAntialiasing, false);
p.setRenderHint(QPainter.RenderHint.SmoothPixmapTransform, false);
ele.render(p);
p.end();
MBFImage mbfimage = new MBFImage(width, height, ColourSpace.RGB);
FImage rf = mbfimage.bands.get(0);
FImage gf = mbfimage.bands.get(1);
FImage bf = mbfimage.bands.get(2);
for (int y=0; y<height; y++) {
for (int x=0; x<width; x++) {
int rgb = image.pixel(x, y);
int r = ((rgb >> 16) & 0xff);
int g = ((rgb >> 8) & 0xff);
int b = ((rgb) & 0xff);
rf.pixels[y][x] = r / 255f;
gf.pixels[y][x] = g / 255f;
bf.pixels[y][x] = b / 255f;
}
}
return mbfimage;
}
示例5: Printer
import com.trolltech.qt.gui.QPainter; //导入依赖的package包/类
public static void Printer(QTableWidget tw){
QPrinter printer = new QPrinter(); //(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter.OutputFormat.PdfFormat);
printer.setOutputFileName("/home/pablo/temp/informe.pdf");
printer.setPageSize(QPrinter.PageSize.Letter);
printer.setCreator("EIMS - eHC::RIS");
printer.setDocName("Informe de cuidades");
QPainter painter = new QPainter();
if(!painter.begin(printer)){
//qWarning("Error al abrir el archivo PDF para escritura.");
return;
}
painter.setRenderHint(QPainter.RenderHint.Antialiasing, true);
// Arreglo utilizado para el header del informe con sus respectivos Widths y Aligns
String header[][] = new String[2][3];
header[0][0] = "50"; // Width de la celda
header[0][1] = "ID"; // Texto de la celda
header[0][2] = "3"; // Align de la celda
header[1][0] = "300";
header[1][1] = "DESCRIPCIÓN";
header[1][2] = "0";
String lTitle = "INFORME DE CIUDADES";
Utils.PrintHeader(painter, lTitle, header, 1, (int)(tw.rowCount() / 44) + 1);
Utils.PrintTableWidget(printer, painter, lTitle, tw, header);
painter.end(); // finaliza el dibujado y libera el archivo PDF.
Utils.ShowPDF(printer.outputFileName());
}
示例6: Printer
import com.trolltech.qt.gui.QPainter; //导入依赖的package包/类
public static void Printer(QTableWidget tw){
QPrinter printer = new QPrinter(); //(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter.OutputFormat.PdfFormat);
printer.setOutputFileName("/home/pablo/temp/informe.pdf");
printer.setPageSize(QPrinter.PageSize.Letter);
printer.setCreator("EIMS - eHC::RIS");
printer.setDocName("Informe sistemas de salud");
QPainter painter = new QPainter();
if(!painter.begin(printer)){
//qWarning("Error al abrir el archivo PDF para escritura.");
return;
}
painter.setRenderHint(QPainter.RenderHint.Antialiasing, true);
// Arreglo utilizado para el header del informe con sus respectivos Widths y Aligns
String header[][] = new String[3][3];
header[0][0] = "50"; // Width de la celda
header[0][1] = "ID"; // Texto de la celda
header[0][2] = "3"; // Align de la celda
header[1][0] = "300";
header[1][1] = "DESCRIPCIÓN";
header[1][2] = "0";
header[2][0] = "80";
header[2][1] = "VIGENTE";
header[2][2] = "5";
String lTitle = "INFORME SISTEMAS DE SALUD";
Utils.PrintHeader(painter, lTitle, header, 1, (int)(tw.rowCount() / 44) + 1);
Utils.PrintTableWidget(printer, painter, lTitle, tw, header);
painter.end(); // finaliza el dibujado y libera el archivo PDF.
Utils.ShowPDF(printer.outputFileName());
}
示例7: Printer
import com.trolltech.qt.gui.QPainter; //导入依赖的package包/类
public static void Printer(QTableWidget tw){
QPrinter printer = new QPrinter(); //(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter.OutputFormat.PdfFormat);
printer.setOutputFileName("/home/pablo/temp/informe.pdf");
printer.setPageSize(QPrinter.PageSize.Letter);
printer.setCreator("EIMS - eHC::RIS");
printer.setDocName("Informe lugares de derivación");
QPainter painter = new QPainter();
if(!painter.begin(printer)){
//qWarning("Error al abrir el archivo PDF para escritura.");
return;
}
painter.setRenderHint(QPainter.RenderHint.Antialiasing, true);
// Arreglo utilizado para el header del informe con sus respectivos Widths y Aligns
String header[][] = new String[4][3];
header[0][0] = "50"; // Width de la celda
header[0][1] = "ID"; // Texto de la celda
header[0][2] = "3"; // Align de la celda
header[1][0] = "120";
header[1][1] = "TIPO";
header[1][2] = "0";
header[2][0] = "300";
header[2][1] = "DESCRIPCIÓN";
header[2][2] = "0";
header[3][0] = "80";
header[3][1] = "VIGENTE";
header[3][2] = "5";
String lTitle = "INFORME LUGARES DE DERIVACIÓN";
Utils.PrintHeader(painter, lTitle, header, 1, (int)(tw.rowCount() / 44) + 1);
Utils.PrintTableWidget(printer, painter, lTitle, tw, header);
painter.end(); // finaliza el dibujado y libera el archivo PDF.
Utils.ShowPDF(printer.outputFileName());
}
示例8: Printer
import com.trolltech.qt.gui.QPainter; //导入依赖的package包/类
public static void Printer(QTableWidget tw){
QPrinter printer = new QPrinter(); //(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter.OutputFormat.PdfFormat);
printer.setOutputFileName("/home/pablo/temp/informe.pdf");
printer.setPageSize(QPrinter.PageSize.Letter);
printer.setCreator("EIMS - eHC::RIS");
printer.setDocName("Informe de recursos físicos");
QPainter painter = new QPainter();
if(!painter.begin(printer)){
//qWarning("Error al abrir el archivo PDF para escritura.");
return;
}
painter.setRenderHint(QPainter.RenderHint.Antialiasing, true);
// Arreglo utilizado para el header del informe con sus respectivos Widths y Aligns
String header[][] = new String[4][4];
header[0][0] = "50"; // Width de la celda
header[0][1] = "ID"; // Texto de la celda
header[0][2] = "3"; // Align de la celda
header[1][0] = "300";
header[1][1] = "DESCRIPCIÓN";
header[1][2] = "0";
header[2][0] = "100";
header[2][1] = "MODALIDAD";
header[2][2] = "5";
header[3][0] = "80";
header[3][1] = "VIGENTE";
header[3][2] = "5";
String lTitle = "INFORME DE RECURSOS FÍSICOS";
Utils.PrintHeader(painter, lTitle, header, 1, (int)(tw.rowCount() / 44) + 1);
Utils.PrintTableWidget(printer, painter, lTitle, tw, header);
painter.end(); // finaliza el dibujado y libera el archivo PDF.
Utils.ShowPDF(printer.outputFileName());
}
示例9: Printer
import com.trolltech.qt.gui.QPainter; //导入依赖的package包/类
public static void Printer(QTableWidget tw){
QPrinter printer = new QPrinter(); //(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter.OutputFormat.PdfFormat);
printer.setOutputFileName("/home/pablo/temp/informe.pdf");
printer.setOrientation(QPrinter.Orientation.Landscape);
printer.setPageSize(QPrinter.PageSize.Letter);
QPainter painter = new QPainter();
if(!painter.begin(printer)){
//qWarning("Error al abrir el archivo PDF para escritura.");
return;
}
painter.setRenderHint(QPainter.RenderHint.Antialiasing, true);
// Arreglo utilizado para el header del informe con sus respectivos Widths y Aligns
String header[][] = new String[5][3];
header[0][0] = "70"; // Width de la celda
header[0][1] = "CÓDIGO"; // Texto de la celda
header[0][2] = "0"; // Align de la celda
header[1][0] = "100";
header[1][1] = "TIPO";
header[1][2] = "0";
header[2][0] = "400";
header[2][1] = "DESCRIPCIÓN";
header[2][2] = "0";
header[3][0] = "250";
header[3][1] = "RRFF ASOCIADO";
header[3][2] = "0";
header[4][0] = "80";
header[4][1] = "VIGENTE";
header[4][2] = "5";
String lTitle = "INFORME DE PRESTACIONES";
Utils.PrintHeader(painter, lTitle, header, 1, (int)(tw.rowCount() / 32) + 1);
Utils.PrintTableWidget(printer, painter, lTitle, tw, header);
painter.end(); // finaliza el dibujado y libera el archivo PDF.
Utils.ShowPDF(printer.outputFileName());
}
示例10: Printer
import com.trolltech.qt.gui.QPainter; //导入依赖的package包/类
public static void Printer(QTableWidget tw){
QPrinter printer = new QPrinter(); //(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter.OutputFormat.PdfFormat);
printer.setOutputFileName("/home/pablo/temp/informe.pdf");
printer.setPageSize(QPrinter.PageSize.Letter);
printer.setCreator("EIMS - eHC::RIS");
printer.setDocName("Informe de profesiones");
QPainter painter = new QPainter();
if(!painter.begin(printer)){
//qWarning("Error al abrir el archivo PDF para escritura.");
return;
}
painter.setRenderHint(QPainter.RenderHint.Antialiasing, true);
// Arreglo utilizado para el header del informe con sus respectivos Widths y Aligns
String header[][] = new String[4][3];
header[0][0] = "50"; // Width de la celda
header[0][1] = "ID"; // Texto de la celda
header[0][2] = "3"; // Align de la celda
header[1][0] = "300";
header[1][1] = "DESCRIPCIÓN";
header[1][2] = "0";
header[2][0] = "100";
header[2][1] = "ABREV.";
header[2][2] = "0";
header[3][0] = "80";
header[3][1] = "VIGENTE";
header[3][2] = "5";
String lTitle = "INFORME DE PROFESIONES";
Utils.PrintHeader(painter, lTitle, header, 1, (int)(tw.rowCount() / 44) + 1);
Utils.PrintTableWidget(printer, painter, lTitle, tw, header);
painter.end(); // finaliza el dibujado y libera el archivo PDF.
Utils.ShowPDF(printer.outputFileName());
}
示例11: PrintTableWidget
import com.trolltech.qt.gui.QPainter; //导入依赖的package包/类
public static void PrintTableWidget(QPrinter printer, QPainter painter, String title, QTableWidget tw, String widthFields[][]){
int lW;
int lH = 20;
int lX1 = 20;
int lY = 90;
int nroPage = 1;
int height = painter.paintEngine().paintDevice().height(); // alto de la página
int nroPerPage = (height == 992 ? 44 : 32); //922
int totalPage = (int)(tw.rowCount() / nroPerPage) + 1;
QPen pen = new QPen();
pen.setWidth(1);
pen.setColor(QColor.black);
painter.setPen(pen);
QFont fnt = new QFont("Arial",10);
painter.setFont(fnt);
//992 salto de página letter portrait
for(int i=0; i<tw.rowCount(); i++){
if(lY>=(height - 22)){
printer.newPage();
PrintHeader(painter, title, widthFields, ++nroPage, totalPage);
fnt.setPointSize(10);
painter.setFont(fnt);
lX1 = 20;
lY = 90;
}
for(int j=0; j<widthFields.length; j++){
lW = Integer.parseInt(widthFields[j][0]);
painter.drawRect(lX1 , lY, lW , lH);
painter.drawText(lX1+2, lY, lW-4, lH, Qt.AlignmentFlag.AlignVCenter.value() | Integer.parseInt(widthFields[j][2]), tw.item(i, j).text());
lX1 += lW;
}
//painter.drawText(40, lY-5, "Y:" + lY); // para chequear en que coordenada hacer el salto de página
lX1 = 20;
lY += lH;
}
}
示例12: on_btnImprimir_Clicked
import com.trolltech.qt.gui.QPainter; //导入依赖的package包/类
/**
*
*/
public void on_btnImprimir_Clicked()
{
QPrinter printer = new QPrinter(QPrinter.PrinterMode.HighResolution);
printer.setOutputFormat(QPrinter.OutputFormat.PdfFormat);
printer.setOutputFileName("/home/pablo/temp/citacion.pdf");
printer.setPageSize(QPrinter.PageSize.A6);
//printer.setFullPage(true);
printer.setPageMargins(2,2,2,2,QPrinter.Unit.Millimeter);
QPainter painter = new QPainter();
if(!painter.begin(printer)){
QMessageBox.critical(this, "Escritura de archivo", "Error al abrir el archivo PDF para escritura.");
return;
}
QPen pen = new QPen();
pen.setWidth(1);
pen.setColor(QColor.black);
painter.setPen(pen);
QFont fnt = new QFont("Tahoma",10);
painter.setFont(fnt);
painter.drawText( 20, 100, "COMPROBANTE DE CITACION NUMERO: ");
//painter.drawText( 20, 250, "Imp.:"+Utils.ObtenerFechaHora().toDateTime().toString("dd-MM-yyyy HH:mm ")+DBUtils.getTableField(String.format("SELECT eps_user FROM minitis.prestsol_enc WHERE eps_id=%1$s", ui.leID.text())).toString());
painter.drawText( 20, 250, "Imp.:"+Utils.ObtenerFechaHora()+" "+DBUtils.getTableField(String.format("SELECT eps_user FROM miniris.prestsol_enc WHERE eps_id=%1$s", ui.leID.text())).toString());
painter.drawText( 20, 400, "Ambulatorio");
painter.drawText( 20, 550, "Citación");
painter.drawText( 20, 700, ui.cmbSSal.currentText());
painter.drawText( 20, 850, "DERIVADO DE: "+ui.cmbTDer.currentText()+". "+ui.cmbDeri.currentText());
fnt.setFamily("C39HrP48DhTt");
fnt.setPointSize(42);
painter.setFont(fnt);
painter.drawText(3400, 550, "*"+ui.leID.text()+"*");
fnt.setFamily("Tahoma");
fnt.setPointSize(10);
painter.setFont(fnt);
painter.drawLine( 0, 950, 4700,950);
painter.drawText(20,1150, ui.leRUN.text().isEmpty()?ui.leFich.text():ui.leRUN.text()+" "+ui.lePaciente.text());
//painter.drawText(20,1300, "Edad: "+ui.lblEdad.text()+" Sexo: "+ui.lblSexo.text()+" Prioridad: "+ui.cmbNUrg.currentText()+" "+ui.lblFHCit.text());
painter.drawLine( 0,1400, 4700,1400);
fnt.setPointSize(8);
painter.setFont(fnt);
int lY = 1400;
for(int row=0;row<ui.twPrestaciones.rowCount();row++)
painter.drawText(20,lY+=150, ui.twPrestaciones.item(row,1).text()+" x "+ui.twPrestaciones.item(row,3).text()+" "+ui.twPrestaciones.item(row,2).text());
lY += 100;
painter.drawLine( 0,lY,4700,lY);
fnt.setPointSize(13);
painter.setFont(fnt);
lY += 200;
painter.drawText(20,lY,"CITADO EL: "+ui.cwFecha.selectedDate().toString("dd-MM-yyyy")+" A LAS: "+ui.twHoras.item(ui.twHoras.currentRow(),1).text()+" HRS.");
painter.end();
Utils.ShowPDF(printer.outputFileName());
//Citacion.Printer(ui.twHoras);
}
示例13: on_btnImprimir_Clicked
import com.trolltech.qt.gui.QPainter; //导入依赖的package包/类
public void on_btnImprimir_Clicked()
{
QPrinter printer = new QPrinter(); //(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter.OutputFormat.PdfFormat);
printer.setOutputFileName("/home/pablo/temp/informe_recepciones.pdf");
printer.setOrientation(QPrinter.Orientation.Landscape);
printer.setPageSize(QPrinter.PageSize.Legal);
printer.setCreator("EIMS - eHC::RIS");
printer.setDocName("Informe de recepciones por periodo");
QPainter painter = new QPainter();
if(!painter.begin(printer)){
//qWarning("Error al abrir el archivo PDF para escritura.");
return;
}
painter.setRenderHint(QPainter.RenderHint.Antialiasing, true);
// Arreglo utilizado para el header del informe con sus respectivos Widths y Aligns
String header[][] = new String[9][3];
header[0][0] = "80"; // Width de la celda
header[0][1] = "ID"; // Texto de la celda
header[0][2] = "0"; // Align de la celda
header[1][0] = "100";
header[1][1] = "TIPO";
header[1][2] = "0";
header[2][0] = "110";
header[2][1] = "FECHA/HORA";
header[2][2] = "0";
header[3][0] = "250";
header[3][1] = "PACIENTE";
header[3][2] = "0";
header[4][0] = "200";
header[4][1] = "DERIVADOR";
header[4][2] = "0";
header[5][0] = "100";
header[5][1] = "N.U.";
header[5][2] = "0";
header[6][0] = "60";
header[6][1] = "ASISTE";
header[6][2] = "5";
header[7][0] = "100";
header[7][1] = "ESTADO";
header[7][2] = "0";
header[8][0] = "150";
header[8][1] = "SISTEMA SALUD";
header[8][2] = "0";
String lTitle = String.format("INFORME DE RECEPCIONES POR PERIODO\nDEL %1$S AL %2$s", ui.deFDesde.text(), ui.deFHasta.text());
Utils.PrintHeader(painter, lTitle, header, 1, (int)(ui.twRecepciones.rowCount() / 32) + 1);
Utils.PrintTableWidget(printer, painter, lTitle, ui.twRecepciones, header);
painter.end(); // finaliza el dibujado y libera el archivo PDF.
Utils.ShowPDF(printer.outputFileName());
}
示例14: Printer
import com.trolltech.qt.gui.QPainter; //导入依赖的package包/类
public static void Printer(QTableWidget tw){
QPrinter printer = new QPrinter(); //(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter.OutputFormat.PdfFormat);
printer.setOutputFileName("/home/pablo/temp/informe.pdf");
printer.setOrientation(QPrinter.Orientation.Landscape);
printer.setPageSize(QPrinter.PageSize.Letter);
printer.setCreator("EIMS - eHC::RIS");
printer.setDocName("Informe de funcionarios");
QPainter painter = new QPainter();
if(!painter.begin(printer)){
//qWarning("Error al abrir el archivo PDF para escritura.");
return;
}
painter.setRenderHint(QPainter.RenderHint.Antialiasing, true);
// Arreglo utilizado para el header del informe con sus respectivos Widths y Aligns
String header[][] = new String[7][3];
header[0][0] = "50"; // Width de la celda
header[0][1] = "ID"; // Texto de la celda
header[0][2] = "3"; // Align de la celda
header[1][0] = "200";
header[1][1] = "NOMBRE";
header[1][2] = "0";
header[2][0] = "150";
header[2][1] = "A. PATERNO";
header[2][2] = "0";
header[3][0] = "150";
header[3][1] = "A. MATERNO";
header[3][2] = "0";
header[4][0] = "50";
header[4][1] = "INIC";
header[4][2] = "0";
header[5][0] = "200";
header[5][1] = "PROFESIÓN";
header[5][2] = "0";
header[6][0] = "80";
header[6][1] = "VIGENTE";
header[6][2] = "5";
String lTitle = "INFORME DE FUNCIONARIOS";
Utils.PrintHeader(painter, lTitle, header, 1, (int)(tw.rowCount() / 32) + 1);
Utils.PrintTableWidget(printer, painter, lTitle, tw, header);
painter.end(); // finaliza el dibujado y libera el archivo PDF.
Utils.ShowPDF(printer.outputFileName());
}
示例15: PrintHeader
import com.trolltech.qt.gui.QPainter; //导入依赖的package包/类
/**
PrintHeader
Descripción: Imprime en el painter la cabezera de un informe.
Parámetros :
painter : Objeto QPainter en donde se dibujará (argumento utilizado por referencia)
title : String con el título del informe
*/
public static void PrintHeader(QPainter painter, String title, String header[][], int nroPage, int totalPage){
//QRect rect = new QRect(10,10,350,150);
QPen pen = new QPen();
pen.setWidth(1);
pen.setColor(QColor.black);
painter.setPen(pen);
int width = painter.paintEngine().paintDevice().width(); // ancho de la página
int height = painter.paintEngine().paintDevice().height(); // alto de la página
QFont fnt = new QFont("Arial",8);
//fnt.setLetterSpacing(QFont::PercentageSpacing,104);
int lX = 20; // Para el margen izquierdo
//painter.drawImage(rect,QImage(String(":/images/resources/logo.png")));
//painter.drawRect(lX, 10, width - (lX * 2), 60);
painter.setFont(fnt);
painter.drawText(lX+4 , 30, "EIMS");
painter.drawText(width - lX - 60 , 30, QDate.currentDate().toString("dd-MM-yyyy"));
painter.drawText(lX+4, 50, "RIS");
painter.drawText(width - lX - 60 , 50, QTime.currentTime().toString("HH:mm:ss"));
fnt.setPointSize(14);
fnt.setBold(true);
painter.setFont(fnt);
painter.drawText(0, 20, width, 40, 5, title);
pen.setWidth(2);
painter.setPen(pen);
painter.drawLine(lX, 65, width - lX, 65);
pen.setWidth(1);
painter.setPen(pen);
fnt.setPointSize(12);
fnt.setBold(false);
painter.setFont(fnt);
int lX1 = lX;
int lW;
for(int i=0; i<header.length; i++){
lW = Integer.parseInt(header[i][0]);
painter.fillRect(lX1 , 70, lW , 20, QColor.lightGray);
painter.drawRect(lX1 , 70, lW , 20);
painter.drawText(lX1+2, 70, lW-4, 20, 0, header[i][1]);
lX1 += lW;
}
// Para el footer de la página
fnt.setPointSize(8);
painter.setFont(fnt);
pen.setWidth(2);
painter.setPen(pen);
painter.drawLine(lX, height - 14, width - lX, height - 14);
pen.setWidth(1);
painter.setPen(pen);
painter.drawText(lX, height - 10, width - lX, 20, 5, "EIMS - Sistema de Información Radiológica");
painter.drawText(width - lX - 60 , height - 10, 100, 20, 0, "Pág.: " + nroPage+"/"+totalPage);
}