API Documentation
Loading...
Searching...
No Matches
PrintPreview.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Widgets
28File: PrintPreview
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/Vector.h>
35#include <NDEVR/Buffer.h>
36#include <NDEVR/Pointer.h>
37#include <QWidget>
38#include <QImage>
39namespace Ui
40{
41 class PrintPreviewUI;
42}
43class QPrintDialog;
44class QPageSetupDialog;
45class QPrintPreviewWidget;
46class QPrinter;
47namespace NDEVR
48{
49 class WidgetIterator;
50 class Button;
51 /**--------------------------------------------------------------------------------------------------
52 \brief A dialog that shows a PrintPreview of a given widgets, reports, or images. User can modify
53 print settings and print directly from this dialog.
54 **/
55 class NDEVR_PRINT_API PrintPreview : public QWidget
56 {
57 Q_OBJECT
58 public:
59 PrintPreview(QWidget* parent = nullptr);
62 void setImages(const Buffer<QImage, uint04, ObjectAllocator<false>>& images, const Buffer<QWidget*>& custom_print_options = Buffer<QWidget*>());
63 void setImage(uint04 index, const QImage& image, const Buffer<QWidget*>& custom_print_options = Buffer<QWidget*>());
64 void setPreferredSize(QSize prefered_size);
66 void printWidget(QWidget* widget, const Buffer<QWidget*>& custom_print_options = Buffer<QWidget*>());
67 void printWidgets(const Buffer<QWidget*>& widgets, const Buffer<QWidget*>& custom_print_options = Buffer<QWidget*>());
68 void printWidgets(const DynamicPointer<WidgetIterator>& reports, const Buffer<QWidget*>& custom_print_options = Buffer<QWidget*>());
73 bool isZoomMode() const;
74 bool isCustomPercent() const;
75
76 virtual QSize sizeHint() const override;
77 QPalette printPalette() const;
78 void setPrintFont(const QFont& font);
79 bool event(QEvent* event) override;
80 static bool SystemHasPrinters();
81 QPrintDialog* printSetupDialog();
82 QPageSetupDialog* pageSetupDialog();
83 public:
86 signals:
91 protected slots:
96 void Print(QPrinter *printer);
97 void choosePrinterAccepted(QPrinter* printer);
98 protected:
100 void printImages(QPrinter* printer);
101 void printWidgets(QPrinter* printer);
102 void printWidget(QWidget* widget, QPainter& painter, QPoint offset);
103 protected:
108 QPrinter* m_printer;
109 QPrintDialog* m_print_setup_dialog;
110 QPrintPreviewWidget* m_print_preview;
111 QPageSetupDialog* m_page_setup_dialog;
118 Ui::PrintPreviewUI* ui;
119 bool m_is_virtual_printer = false;
120 };
121
122
123}
#define NDEVR_PRINT_API
Definition DLLInfo.h:56
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
A core widget that allows the user to click one of many button types.
Definition Button.h:66
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:320
Definition MemoryManager.h:261
A dialog that shows a PrintPreview of a given widgets, reports, or images. User can modify print sett...
Definition PrintPreview.h:56
Button * m_page_settings_button
Definition PrintPreview.h:114
void printWidget(QWidget *widget, const Buffer< QWidget * > &custom_print_options=Buffer< QWidget * >())
Vector< 2, uint04 > pageResolution() const
QFont m_print_font
Definition PrintPreview.h:116
void setCustomPrintSettingsWidgets(const Buffer< QWidget * > &widgets)
static bool SystemHasPrinters()
bool isCustomPercent() const
bool isZoomMode() const
void printWidget(QWidget *widget, QPainter &painter, QPoint offset)
Vector< 2, fltp08 > customPercent() const
static PrintPreview * PrintPreviewWidget()
bool event(QEvent *event) override
void printWidgets(const Buffer< QWidget * > &widgets, const Buffer< QWidget * > &custom_print_options=Buffer< QWidget * >())
void setPreferredSize(QSize prefered_size)
virtual QSize sizeHint() const override
QPrintDialog * m_print_setup_dialog
Definition PrintPreview.h:109
QPageSetupDialog * m_page_setup_dialog
Definition PrintPreview.h:111
QPrintDialog * printSetupDialog()
void setImages(const Buffer< QImage, uint04, ObjectAllocator< false > > &images, const Buffer< QWidget * > &custom_print_options=Buffer< QWidget * >())
void zoomModeChangedSignal()
void choosePrinterAccepted(QPrinter *printer)
bool m_is_setting_font
Definition PrintPreview.h:117
QPrinter * m_printer
Definition PrintPreview.h:108
Button * m_print_settings_button
Definition PrintPreview.h:113
void printWidgets(const DynamicPointer< WidgetIterator > &reports, const Buffer< QWidget * > &custom_print_options=Buffer< QWidget * >())
void printImages(QPrinter *printer)
void printWidgets(QPrinter *printer)
Vector< 2, uint04 > m_last_resolution
Definition PrintPreview.h:104
void setImage(uint04 index, const QImage &image, const Buffer< QWidget * > &custom_print_options=Buffer< QWidget * >())
DynamicPointer< WidgetIterator > m_widgets
Definition PrintPreview.h:107
static PrintPreview * PrintPreviewWidget(const Buffer< QImage > &images)
Ui::PrintPreviewUI * ui
Definition PrintPreview.h:118
QPrintPreviewWidget * m_print_preview
Definition PrintPreview.h:110
void setPrintFont(const QFont &font)
Buffer< QImage, uint04, ObjectAllocator< false > > m_images
Definition PrintPreview.h:106
PrintPreview(QWidget *parent=nullptr)
Buffer< QWidget * > m_custom_print_settings_widgets
Definition PrintPreview.h:115
Vector< 2, uint04 > scaledPageResolution() const
Button * m_print_button
Definition PrintPreview.h:112
QPageSetupDialog * pageSetupDialog()
void pageResolutionChangedSignal(Vector< 2, uint04 > pixel_size)
bool m_last_is_zoom
Definition PrintPreview.h:105
QPalette printPalette() const
void Print(QPrinter *printer)
A fixed-size array with better performance compared to dynamic containers.
Definition Vector.hpp:60
Definition ACIColor.h:37
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
Definition FontEditor.h:6