NDEVR
API Documentation
PrintPreview

A dialog that shows a PrintPreview of a given widgets, reports, or images. More...

Collaboration diagram for PrintPreview:
[legend]

Public Member Functions

 PrintPreview (QWidget *parent=nullptr)
 Constructs a PrintPreview widget.
 ~PrintPreview ()
 Destroys the PrintPreview and releases printer resources.
void clearImages ()
 Clears all stored images from the print queue.
Vector< 2, fltp08customPercent () const
 Returns the custom scaling percentage for width and height.
bool event (QEvent *event) override
 Handles widget events.
void finishedSignal ()
 Emitted when the print preview dialog is finished.
bool isCustomPercent () const
 Returns whether a custom scaling percentage is being used.
bool isZoomMode () const
 Returns whether zoom mode is active.
Vector< 2, uint04pageResolution () const
 Returns the current page resolution in pixels.
void pageResolutionChangedSignal (Vector< 2, uint04 > pixel_size)
 Emitted when the page resolution changes.
QPageSetupDialog * pageSetupDialog ()
 Returns the page setup dialog.
void printedSignal ()
 Emitted after a print operation completes.
QPalette printPalette () const
 Returns the palette used for print rendering.
QPrintDialog * printSetupDialog ()
 Returns the print setup dialog.
void printWidget (QWidget *widget, const Buffer< QWidget * > &custom_print_options=Buffer< QWidget * >())
 Prints a single widget.
void printWidgets (const Buffer< QWidget * > &widgets, const Buffer< QWidget * > &custom_print_options=Buffer< QWidget * >())
 Prints multiple widgets.
void printWidgets (const DynamicPointer< WidgetIterator > &reports, const Buffer< QWidget * > &custom_print_options=Buffer< QWidget * >())
 Prints widgets provided by a WidgetIterator.
void resetPreferredSize ()
 Resets the preferred page size to the printer default.
Vector< 2, uint04scaledPageResolution () const
 Returns the page resolution after applying the current scale.
void setCustomPrintSettingsWidgets (const Buffer< QWidget * > &widgets)
 Sets custom widgets to display in the print settings area.
void setImage (uint04 index, const QImage &image, const Buffer< QWidget * > &custom_print_options=Buffer< QWidget * >())
 Sets a specific image at the given index.
void setImages (const Buffer< QImage > &images, const Buffer< QWidget * > &custom_print_options=Buffer< QWidget * >())
 Sets the images to print.
void setPreferredSize (QSize preferred_size)
 Sets the preferred page size for printing.
void setPrintFont (const QFont &font)
 Sets the font used for print rendering.
virtual QSize sizeHint () const override
 Returns the preferred size hint for this widget.
bool zoomInToFit () const
 Returns whether zoom-to-fit is enabled.
void zoomModeChangedSignal ()
 Emitted when the zoom mode setting changes.

Static Public Member Functions

static PrintPreviewPrintPreviewWidget ()
 Creates or returns the singleton PrintPreview widget.
static PrintPreviewPrintPreviewWidget (const Buffer< QImage > &images)
 Creates or returns the singleton PrintPreview widget with the given images.
static bool SystemHasPrinters ()
 Checks whether the system has any configured printers.

Protected Attributes

Buffer< QWidget * > m_custom_print_settings_widgets
 Custom widgets for print settings.
Buffer< QImage > m_images
 The images queued for printing.
bool m_is_setting_font
 Whether a font change is in progress.
bool m_is_virtual_printer = false
 Whether the selected printer is a virtual printer.
Vector< 2, uint04m_last_resolution
 The last known page resolution.
Buttonm_page_settings_button
 The page settings button.
QPageSetupDialog * m_page_setup_dialog
 The page layout setup dialog.
Buttonm_print_button
 The print action button.
QFont m_print_font
 The font used for printing.
QPrintPreviewWidget * m_print_preview
 The preview rendering widget.
Buttonm_print_settings_button
 The printer settings button.
QPrintDialog * m_print_setup_dialog
 The printer selection dialog.
QPrinter * m_printer
 The active printer device.
DynamicPointer< WidgetIteratorm_widgets
 The widget iterator for multi-page widget printing.
Ui::PrintPreviewUI * ui
 The auto-generated UI form.

Detailed Description

A dialog that shows a PrintPreview of a given widgets, reports, or images.


User can modify print settings and print directly from this dialog.

Definition at line 55 of file PrintPreview.h.

Constructor & Destructor Documentation

◆ PrintPreview()

PrintPreview::PrintPreview ( QWidget * parent = nullptr)

Constructs a PrintPreview widget.

Parameters
[in]parentThe optional parent widget.

Referenced by PrintPreviewWidget(), and PrintPreviewWidget().

Member Function Documentation

◆ customPercent()

Vector< 2, fltp08 > PrintPreview::customPercent ( ) const

Returns the custom scaling percentage for width and height.

Returns
A 2D vector of scale percentages.

◆ event()

bool PrintPreview::event ( QEvent * event)
override

Handles widget events.

Parameters
[in]eventThe event to process.
Returns
True if the event was handled.

References event().

Referenced by event().

◆ isCustomPercent()

bool PrintPreview::isCustomPercent ( ) const

Returns whether a custom scaling percentage is being used.

Returns
True if using custom percent.

◆ isZoomMode()

bool PrintPreview::isZoomMode ( ) const

Returns whether zoom mode is active.

Returns
True if in zoom mode.

◆ pageResolution()

Vector< 2, uint04 > PrintPreview::pageResolution ( ) const

Returns the current page resolution in pixels.

Returns
The page resolution as width and height.

◆ pageResolutionChangedSignal()

void PrintPreview::pageResolutionChangedSignal ( Vector< 2, uint04 > pixel_size)

Emitted when the page resolution changes.

Parameters
[in]pixel_sizeThe new page resolution in pixels.

◆ pageSetupDialog()

QPageSetupDialog * PrintPreview::pageSetupDialog ( )

Returns the page setup dialog.

Returns
A pointer to the QPageSetupDialog.

◆ printPalette()

QPalette PrintPreview::printPalette ( ) const

Returns the palette used for print rendering.

Returns
The print-specific QPalette.

◆ PrintPreviewWidget() [1/2]

PrintPreview * PrintPreview::PrintPreviewWidget ( )
static

Creates or returns the singleton PrintPreview widget.

Returns
A pointer to the PrintPreview widget.

References PrintPreview().

◆ PrintPreviewWidget() [2/2]

PrintPreview * PrintPreview::PrintPreviewWidget ( const Buffer< QImage > & images)
static

Creates or returns the singleton PrintPreview widget with the given images.

Parameters
[in]imagesThe images to display in the preview.
Returns
A pointer to the PrintPreview widget.

References PrintPreview().

◆ printSetupDialog()

QPrintDialog * PrintPreview::printSetupDialog ( )

Returns the print setup dialog.

Returns
A pointer to the QPrintDialog.

◆ printWidget()

void PrintPreview::printWidget ( QWidget * widget,
const Buffer< QWidget * > & custom_print_options = Buffer< QWidget * >() )

Prints a single widget.

Parameters
[in]widgetThe widget to print.
[in]custom_print_optionsOptional custom print settings widgets.

Referenced by finishedSignal().

◆ printWidgets() [1/2]

void PrintPreview::printWidgets ( const Buffer< QWidget * > & widgets,
const Buffer< QWidget * > & custom_print_options = Buffer< QWidget * >() )

Prints multiple widgets.

Parameters
[in]widgetsThe widgets to print.
[in]custom_print_optionsOptional custom print settings widgets.

Referenced by finishedSignal().

◆ printWidgets() [2/2]

void PrintPreview::printWidgets ( const DynamicPointer< WidgetIterator > & reports,
const Buffer< QWidget * > & custom_print_options = Buffer< QWidget * >() )

Prints widgets provided by a WidgetIterator.

Parameters
[in]reportsThe widget iterator providing pages to print.
[in]custom_print_optionsOptional custom print settings widgets.

◆ scaledPageResolution()

Vector< 2, uint04 > PrintPreview::scaledPageResolution ( ) const

Returns the page resolution after applying the current scale.

Returns
The scaled page resolution as width and height.

◆ setCustomPrintSettingsWidgets()

void PrintPreview::setCustomPrintSettingsWidgets ( const Buffer< QWidget * > & widgets)

Sets custom widgets to display in the print settings area.

Parameters
[in]widgetsThe custom settings widgets.

◆ setImage()

void PrintPreview::setImage ( uint04 index,
const QImage & image,
const Buffer< QWidget * > & custom_print_options = Buffer< QWidget * >() )

Sets a specific image at the given index.

Parameters
[in]indexThe image index to replace.
[in]imageThe new image.
[in]custom_print_optionsOptional custom print settings widgets.

◆ setImages()

void PrintPreview::setImages ( const Buffer< QImage > & images,
const Buffer< QWidget * > & custom_print_options = Buffer< QWidget * >() )

Sets the images to print.

Parameters
[in]imagesThe images to print.
[in]custom_print_optionsOptional custom print settings widgets.

◆ setPreferredSize()

void PrintPreview::setPreferredSize ( QSize preferred_size)

Sets the preferred page size for printing.

Parameters
[in]preferred_sizeThe preferred size.

◆ setPrintFont()

void PrintPreview::setPrintFont ( const QFont & font)

Sets the font used for print rendering.

Parameters
[in]fontThe font to use.

◆ sizeHint()

virtual QSize PrintPreview::sizeHint ( ) const
overridevirtual

Returns the preferred size hint for this widget.

Returns
The recommended widget size.

◆ SystemHasPrinters()

bool PrintPreview::SystemHasPrinters ( )
static

Checks whether the system has any configured printers.

Returns
True if at least one printer is available.

◆ zoomInToFit()

bool PrintPreview::zoomInToFit ( ) const

Returns whether zoom-to-fit is enabled.

Returns
True if zooming in to fit.

The documentation for this class was generated from the following file: