Qt4: Print a SQL table to PDF

2020-07-22 09:34发布

问题:

Qt has built-in PDF export support (QPrinter::PdfFormat).

What's the best way to print an SQL table to a PDF file? (a table from a database loaded with QSqlDatabase and linked to a QTableView)...

回答1:

You use QWidget::render. See the documentation about Printing Widgets.