Re: [Qt-creator] export to pdf
Awesome! Just what I needed. On Mon, Feb 1, 2010 at 11:11 AM, Boy Lenssen boy.lens...@esaote.nl wrote: How about using the render() function? QTableWidget t; t.render( painter ); -- *From:* qt-creator-boun...@trolltech.com [mailto: qt-creator-boun...@trolltech.com] *On Behalf Of *John Bull *Sent:* zondag 31 januari 2010 7:24 *To:* qt-creator@trolltech.com *Subject:* Re: [Qt-creator] export to pdf This is what I have for now. I need the actual table as it is. Any reference on how to do this would be appreciated. JB void Table::exportToPdf() { QString fileName = QFileDialog::getSaveFileName(this,tr(Export as Pdf..),, tr(PDF files (*.pdf))); if (fileName.isEmpty()) return; QPrinter printer; printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(fileName); printer.setFullPage(true); printer.setOrientation(QPrinter::Portrait); printer.setPaperSize(QPrinter::A4); QPainter painter(printer); painter.drawText(0, 0 , 250, 200,Qt::TextWordWrap,exportText ); // painter.begin() } On Sat, Jan 30, 2010 at 9:16 PM, Martin Hofius mar...@hofius-online.com wrote: Am Samstag, 30. Januar 2010 schrieb John Bull: I have a QTable widget in a simple app I'm involved in and I would like to be able to export it to pdf as it is .? How can I achieve this. how about printing it to pdf...? Martin ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator
Re: [Qt-creator] export to pdf
Glad to be of help :-) From: qt-creator-boun...@trolltech.com [mailto:qt-creator-boun...@trolltech.com] On Behalf Of John Bull Sent: woensdag 3 februari 2010 12:52 To: qt-creator@trolltech.com Subject: Re: [Qt-creator] export to pdf Awesome! Just what I needed. On Mon, Feb 1, 2010 at 11:11 AM, Boy Lenssen boy.lens...@esaote.nl wrote: How about using the render() function? QTableWidget t; t.render( painter ); From: qt-creator-boun...@trolltech.com [mailto:qt-creator-boun...@trolltech.com] On Behalf Of John Bull Sent: zondag 31 januari 2010 7:24 To: qt-creator@trolltech.com Subject: Re: [Qt-creator] export to pdf This is what I have for now. I need the actual table as it is. Any reference on how to do this would be appreciated. JB void Table::exportToPdf() { QString fileName = QFileDialog::getSaveFileName(this,tr(Export as Pdf..),, tr(PDF files (*.pdf))); if (fileName.isEmpty()) return; QPrinter printer; printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(fileName); printer.setFullPage(true); printer.setOrientation(QPrinter::Portrait); printer.setPaperSize(QPrinter::A4); QPainter painter(printer); painter.drawText(0, 0 , 250, 200,Qt::TextWordWrap,exportText ); // painter.begin() } On Sat, Jan 30, 2010 at 9:16 PM, Martin Hofius mar...@hofius-online.com wrote: Am Samstag, 30. Januar 2010 schrieb John Bull: I have a QTable widget in a simple app I'm involved in and I would like to be able to export it to pdf as it is .? How can I achieve this. how about printing it to pdf...? Martin ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator
Re: [Qt-creator] export to pdf
uh-oh! I just noticed that when the QTableWidget oveflows the window, the render only prints the visible part. More like a screenshot rather than actually painting the whole widget from top to bottom to the pdf Any suggestions? QPrinter printer; printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(fileName); printer.setFullPage(true); printer.setOrientation(QPrinter::Portrait); printer.setPaperSize(QPrinter::A4); QPainter painter(printer); ui-table-render(painter,QPoint(80,100)); Thanks JB. On Wed, Feb 3, 2010 at 1:58 PM, Boy Lenssen boy.lens...@esaote.nl wrote: Glad to be of help J -- *From:* qt-creator-boun...@trolltech.com [mailto: qt-creator-boun...@trolltech.com] *On Behalf Of *John Bull *Sent:* woensdag 3 februari 2010 12:52 *To:* qt-creator@trolltech.com *Subject:* Re: [Qt-creator] export to pdf Awesome! Just what I needed. On Mon, Feb 1, 2010 at 11:11 AM, Boy Lenssen boy.lens...@esaote.nl wrote: How about using the render() function? QTableWidget t; t.render( painter ); -- *From:* qt-creator-boun...@trolltech.com [mailto: qt-creator-boun...@trolltech.com] *On Behalf Of *John Bull *Sent:* zondag 31 januari 2010 7:24 *To:* qt-creator@trolltech.com *Subject:* Re: [Qt-creator] export to pdf This is what I have for now. I need the actual table as it is. Any reference on how to do this would be appreciated. JB void Table::exportToPdf() { QString fileName = QFileDialog::getSaveFileName(this,tr(Export as Pdf..),, tr(PDF files (*.pdf))); if (fileName.isEmpty()) return; QPrinter printer; printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(fileName); printer.setFullPage(true); printer.setOrientation(QPrinter::Portrait); printer.setPaperSize(QPrinter::A4); QPainter painter(printer); painter.drawText(0, 0 , 250, 200,Qt::TextWordWrap,exportText ); // painter.begin() } On Sat, Jan 30, 2010 at 9:16 PM, Martin Hofius mar...@hofius-online.com wrote: Am Samstag, 30. Januar 2010 schrieb John Bull: I have a QTable widget in a simple app I'm involved in and I would like to be able to export it to pdf as it is .? How can I achieve this. how about printing it to pdf...? Martin ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator
Re: [Qt-creator] export to pdf
How about using the render() function? QTableWidget t; t.render( painter ); From: qt-creator-boun...@trolltech.com [mailto:qt-creator-boun...@trolltech.com] On Behalf Of John Bull Sent: zondag 31 januari 2010 7:24 To: qt-creator@trolltech.com Subject: Re: [Qt-creator] export to pdf This is what I have for now. I need the actual table as it is. Any reference on how to do this would be appreciated. JB void Table::exportToPdf() { QString fileName = QFileDialog::getSaveFileName(this,tr(Export as Pdf..),, tr(PDF files (*.pdf))); if (fileName.isEmpty()) return; QPrinter printer; printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(fileName); printer.setFullPage(true); printer.setOrientation(QPrinter::Portrait); printer.setPaperSize(QPrinter::A4); QPainter painter(printer); painter.drawText(0, 0 , 250, 200,Qt::TextWordWrap,exportText ); // painter.begin() } On Sat, Jan 30, 2010 at 9:16 PM, Martin Hofius mar...@hofius-online.com wrote: Am Samstag, 30. Januar 2010 schrieb John Bull: I have a QTable widget in a simple app I'm involved in and I would like to be able to export it to pdf as it is .? How can I achieve this. how about printing it to pdf...? Martin ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator
[Qt-creator] export to pdf
I have a QTable widget in a simple app I'm involved in and I would like to be able to export it to pdf as it is .? How can I achieve this. JB. ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator
Re: [Qt-creator] export to pdf
Am Samstag, 30. Januar 2010 schrieb John Bull: I have a QTable widget in a simple app I'm involved in and I would like to be able to export it to pdf as it is .? How can I achieve this. how about printing it to pdf...? Martin ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator
Re: [Qt-creator] export to pdf
This is what I have for now. I need the actual table as it is. Any reference on how to do this would be appreciated. JB void Table::exportToPdf() { QString fileName = QFileDialog::getSaveFileName(this,tr(Export as Pdf..),, tr(PDF files (*.pdf))); if (fileName.isEmpty()) return; QPrinter printer; printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(fileName); printer.setFullPage(true); printer.setOrientation(QPrinter::Portrait); printer.setPaperSize(QPrinter::A4); QPainter painter(printer); painter.drawText(0, 0 , 250, 200,Qt::TextWordWrap,exportText ); // painter.begin() } On Sat, Jan 30, 2010 at 9:16 PM, Martin Hofius mar...@hofius-online.comwrote: Am Samstag, 30. Januar 2010 schrieb John Bull: I have a QTable widget in a simple app I'm involved in and I would like to be able to export it to pdf as it is .? How can I achieve this. how about printing it to pdf...? Martin ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator