O'Reilly logo

Qt 5 Projects by Marco Piccolino

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exporting the comic script to PDF

What if we also gave a means to our user to export the comic script as a PDF to preserve the nice formatting?

It turns out that this can be done fairly easily with Qt's printsupport module. To enable this functionality, we will need to add the printsupport module to ccscripter.pro:

# ccscripter.proQT += core guiQT += printsupport

Once this is done, we can add a new QAction to the File QMenu in mainwindow.ui, change the action's name object name to actionExportPdf, and point to it in main.cpp:

// ccscripter/main.cpp...auto actionExportPdf =  w.ui->actionExportPdf;...

Performing the PDF export can be done via the following steps:

  1. Choose a destination file path with a QFileDialog, as we have done for the text ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required