Widget to generate PDF file. More...
Inherits QMainWindow.
Public Member Functions | |
CellPrinter (QWidget *parent=NULL) | |
virtual | ~CellPrinter () |
void | setScreenCellWidget (CellWidget *) |
void | setMode (int mode) |
void | toPdf (QPrinter *, bool imageOnly=false) |
Widget to generate PDF file.
CellPrinter is a simple Qt Widget to write the contents of a CellWidget into a QPrinter. As it may uses lots of memory (due to the high-res bitmaps) it is advisable to delete it immediatly after usage. The same rendering engine is used to both display on screen and onto the printer so it is a "What You See Is What You Get" mode (except for the higher resolution). It optionaly adds a frame and a cartouche (on by default).
It's use is straigtforward, as shown in the example below. It consist of four steps:
Code example (took from CellViewer):
The CellPrinter reads the following configuration variables for it's defaults settings (they are located in misc.conf
, for the system-wide settings).
"viewer.printer.mode"
, select between the two resolution modes (Cell or Design). "viewer.printer.paper"
, the output paper size, should be one value from the QPrinter::PaperSize enumeration. This widget is build as a QMainWindow (top-level) one encapsulating only a CellWidget. It is configured to never been shown thanks to the Qt::WA_DontShowOnScreen
attribute, but all the display computations still takes place as if it actually was.
To obtain a sufficent resolution the CellPrinter/CellWidget are resized to the resolution of the printed page. For a better look select a display style with patterns of 32x32 pixels, such as "Printer.Coriolis"
.
Hurricane::CellPrinter::CellPrinter | ( | QWidget * | parent = NULL | ) |
Construct a CellPrinter window no screen CellWidget is actually bound.
|
virtual |
Destructor.
void Hurricane::CellPrinter::setScreenCellWidget | ( | CellWidget * | screenCellWidget | ) |
Bind the CellPrinter to the screen CellWidget screenCellWidget
. It is those contents that will be printed.
|
inline |
Sets the display mode, that is the resolution that will be used. Two modes are availables:
void Hurricane::CellPrinter::toPdf | ( | QPrinter * | printer, |
bool | imageOnly = false |
||
) |
printer | The QPrinter to draw into. |
imageOnly | Whether to add the frame & cartouche or not. |
Perform the drawing operation on the QPrinter.
Generated by doxygen 1.9.1 on Thu Aug 11 2022 | Return to top of page |
Hurricane Design Viewer | Copyright © 2008-2020 Sorbonne Universite All rights reserved |