phapha
30th October 2011, 13:47
Hi all,
I'am writing an application that takes data from a sqlite database and show it thanks to a qtableview. I would like now to add a button export which export the data displayed in this view to a PDF file.
Here is the slot I wrote:
//Exporter la liste des utilisateurs
void PageUser::genPdfUser()
{
QString filename="users.pdf";
//Paramètres d'impression
QPrinter printer(QPrinter::HighResolution);
printer.setOutputFileName(filename);
printer.setPaperSize(QPrinter::A4);
printer.setOutputFormat(QPrinter::PdfFormat);
QPainter painter(&printer);
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
m_userView->render( &painter );
painter.end();
}
It doesn't work because when I click the button, I have no reaction. Hindly help me to corect it.
thanks
I'am writing an application that takes data from a sqlite database and show it thanks to a qtableview. I would like now to add a button export which export the data displayed in this view to a PDF file.
Here is the slot I wrote:
//Exporter la liste des utilisateurs
void PageUser::genPdfUser()
{
QString filename="users.pdf";
//Paramètres d'impression
QPrinter printer(QPrinter::HighResolution);
printer.setOutputFileName(filename);
printer.setPaperSize(QPrinter::A4);
printer.setOutputFormat(QPrinter::PdfFormat);
QPainter painter(&printer);
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
m_userView->render( &painter );
painter.end();
}
It doesn't work because when I click the button, I have no reaction. Hindly help me to corect it.
thanks