| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QABSTRACTPRINTDIALOG_H |
| 5 | #define QABSTRACTPRINTDIALOG_H |
| 6 | |
| 7 | #include <QtPrintSupport/qtprintsupportglobal.h> |
| 8 | |
| 9 | #include <QtWidgets/qdialog.h> |
| 10 | |
| 11 | QT_REQUIRE_CONFIG(printdialog); |
| 12 | |
| 13 | QT_BEGIN_NAMESPACE |
| 14 | |
| 15 | class QAbstractPrintDialogPrivate; |
| 16 | class QPrinter; |
| 17 | |
| 18 | class Q_PRINTSUPPORT_EXPORT QAbstractPrintDialog : public QDialog |
| 19 | { |
| 20 | Q_DECLARE_PRIVATE(QAbstractPrintDialog) |
| 21 | Q_OBJECT |
| 22 | |
| 23 | public: |
| 24 | // Keep in sync with QPrinter::PrintRange |
| 25 | enum PrintRange { |
| 26 | AllPages, |
| 27 | Selection, |
| 28 | , |
| 29 | CurrentPage |
| 30 | }; |
| 31 | |
| 32 | enum PrintDialogOption { |
| 33 | PrintToFile = 0x0001, |
| 34 | PrintSelection = 0x0002, |
| 35 | = 0x0004, |
| 36 | PrintShowPageSize = 0x0008, |
| 37 | PrintCollateCopies = 0x0010, |
| 38 | PrintCurrentPage = 0x0040 |
| 39 | }; |
| 40 | Q_ENUM(PrintDialogOption) |
| 41 | |
| 42 | Q_DECLARE_FLAGS(PrintDialogOptions, PrintDialogOption) |
| 43 | Q_FLAG(PrintDialogOptions) |
| 44 | |
| 45 | explicit QAbstractPrintDialog(QPrinter *printer, QWidget *parent = nullptr); |
| 46 | ~QAbstractPrintDialog(); |
| 47 | |
| 48 | void setOptionTabs(const QList<QWidget*> &tabs); |
| 49 | |
| 50 | void setPrintRange(PrintRange range); |
| 51 | PrintRange printRange() const; |
| 52 | |
| 53 | void setMinMax(int min, int max); |
| 54 | int minPage() const; |
| 55 | int maxPage() const; |
| 56 | |
| 57 | void setFromTo(int fromPage, int toPage); |
| 58 | int fromPage() const; |
| 59 | int toPage() const; |
| 60 | |
| 61 | QPrinter *printer() const; |
| 62 | |
| 63 | protected: |
| 64 | QAbstractPrintDialog(QAbstractPrintDialogPrivate &ptr, QPrinter *printer, QWidget *parent = nullptr); |
| 65 | |
| 66 | private: |
| 67 | Q_DISABLE_COPY(QAbstractPrintDialog) |
| 68 | |
| 69 | }; |
| 70 | |
| 71 | Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractPrintDialog::PrintDialogOptions) |
| 72 | |
| 73 | QT_END_NAMESPACE |
| 74 | |
| 75 | #endif // QABSTRACTPRINTDIALOG_H |
| 76 | |