#include <KoPrintingDialog.h>
Inheritance diagram for KoPrintingDialog:

Public Slots | |
| virtual void | startPrinting (RemovePolicy removePolicy=DoNotDelete) |
Public Member Functions | |
| KoPrintingDialog (QWidget *parent) | |
| Create a new dialog. | |
| void | setShapeManager (KoShapeManager *sm) |
| Set the shape manager that should be used to print. | |
| void | setPageRange (const QList< int > &pages) |
| Set a list of all the pages that should be used to loop over and print. | |
| QPrinter & | printer () |
| Return the printer used to print. | |
Protected Member Functions | |
| virtual void | preparePage (int pageNumber) |
| Reimplement this method to setup the shapeManager and painter and maybe the shapes for printing the passed in page number. | |
| virtual void | printPage (int pageNumber, QPainter &painter) |
| This is a similar method to preparePage(), but is guaranteed to be called in the Ui thread. | |
| virtual QList< KoShape * > | shapesOnPage (int pageNumber)=0 |
| Implement to return the shapes on the requested page. | |
| KoShapeManager * | shapeManager () const |
| QPainter & | painter () const |
| Return the painter that will be used to print the shape data. | |
| bool | isStopped () const |
| Return true if the user pressed stop. | |
| virtual void | printingDone () |
| This virtual hook is called at the end of the printing process, either on success of on failure. | |
Friends | |
| class | KoPrintingDialogPrivate |
Using this class allows any application to print a set of shapes that are contained in the shapeManager() in a thread-safe manner, while ensuring that the full content is present before printing. A requirement for any shape that may use the network or simply use a lot of processing power to prepare its content before it can be painted. This class is of the type of 'create and forget'. Meaning that you create the dialog, initialize it with data and then call show() on it. It then continues to print and delete itself when ready.
KoPrintingDialog *dia = new KoPrintingDialog(myWidget); dia->printer().setOutputFormat(QPrinter::PdfFormat); dia->printer().setOutputFileName("output.pdf"); dia->printer().setResolution(600); dia->printer().setFullPage(true); // ignore printer margins dia->setShapeManager(m_canvas->shapeManager()) QList<int> pages; pages.append(1); dia->setPageRange(pages); dia->startPrinting();
| KoPrintingDialog::KoPrintingDialog | ( | QWidget * | parent | ) |
Create a new dialog.
| parent | the widget this dialog will use as a child. |
| bool KoPrintingDialog::isStopped | ( | ) | const [protected] |
Return true if the user pressed stop.
It is suggested to query this setting in long loops and abort the process as soon at it retuns yes.
| void KoPrintingDialog::preparePage | ( | int | pageNumber | ) | [protected, virtual] |
Reimplement this method to setup the shapeManager and painter and maybe the shapes for printing the passed in page number.
The printing itself will not happen in this method. This method will be called in a thread that is not the main-thread. So the processing can take a reasonably long time withing posing problems for user interaction.
| pageNumber | the number of the page to prepare. |
| QPrinter & KoPrintingDialog::printer | ( | ) | [virtual] |
| virtual void KoPrintingDialog::printingDone | ( | ) | [inline, protected, virtual] |
This virtual hook is called at the end of the printing process, either on success of on failure.
The method is empty by default.
| void KoPrintingDialog::printPage | ( | int | pageNumber, | |
| QPainter & | painter | |||
| ) | [protected, virtual] |
This is a similar method to preparePage(), but is guaranteed to be called in the Ui thread.
| pageNumber | the number of the page to prepare. |
| void KoPrintingDialog::setPageRange | ( | const QList< int > & | pages | ) |
Set a list of all the pages that should be used to loop over and print.
Note that any calls made to this method after printing started are ignored.
| pages | a list of page numbers that the preparePage() gets passed. |
| void KoPrintingDialog::setShapeManager | ( | KoShapeManager * | sm | ) |
Set the shape manager that should be used to print.
| sm | the shapeManager used for the next page(s) |
| KoShapeManager * KoPrintingDialog::shapeManager | ( | ) | const [protected] |
1.4.7