Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-04 09:21:18

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 // Qt-Security score:significant reason:default
0004 
0005 #ifndef QPRINTPREVIEWWIDGET_H
0006 #define QPRINTPREVIEWWIDGET_H
0007 
0008 #include <QtPrintSupport/qtprintsupportglobal.h>
0009 #include <QtWidgets/qwidget.h>
0010 #include <QtPrintSupport/qprinter.h>
0011 
0012 QT_REQUIRE_CONFIG(printpreviewwidget);
0013 
0014 QT_BEGIN_NAMESPACE
0015 
0016 
0017 class QPrintPreviewWidgetPrivate;
0018 
0019 class Q_PRINTSUPPORT_EXPORT QPrintPreviewWidget : public QWidget
0020 {
0021     Q_OBJECT
0022     Q_DECLARE_PRIVATE(QPrintPreviewWidget)
0023 public:
0024 
0025     enum ViewMode {
0026         SinglePageView,
0027         FacingPagesView,
0028         AllPagesView
0029     };
0030 
0031     enum ZoomMode {
0032         CustomZoom,
0033         FitToWidth,
0034         FitInView
0035     };
0036 
0037     explicit QPrintPreviewWidget(QPrinter *printer, QWidget *parent = nullptr,
0038                                  Qt::WindowFlags flags = Qt::WindowFlags());
0039     explicit QPrintPreviewWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
0040     ~QPrintPreviewWidget();
0041 
0042     qreal zoomFactor() const;
0043     QPageLayout::Orientation orientation() const;
0044     ViewMode viewMode() const;
0045     ZoomMode zoomMode() const;
0046     int currentPage() const;
0047     int pageCount() const;
0048     void setVisible(bool visible) override;
0049 
0050 public Q_SLOTS:
0051     void print();
0052 
0053     void zoomIn(qreal zoom = 1.1);
0054     void zoomOut(qreal zoom = 1.1);
0055     void setZoomFactor(qreal zoomFactor);
0056     void setOrientation(QPageLayout::Orientation orientation);
0057     void setViewMode(ViewMode viewMode);
0058     void setZoomMode(ZoomMode zoomMode);
0059     void setCurrentPage(int pageNumber);
0060 
0061     void fitToWidth();
0062     void fitInView();
0063     void setLandscapeOrientation();
0064     void setPortraitOrientation();
0065     void setSinglePageViewMode();
0066     void setFacingPagesViewMode();
0067     void setAllPagesViewMode();
0068 
0069     void updatePreview();
0070 
0071 Q_SIGNALS:
0072     void paintRequested(QPrinter *printer);
0073     void previewChanged();
0074 
0075 private:
0076     Q_PRIVATE_SLOT(d_func(), void _q_fit())
0077     Q_PRIVATE_SLOT(d_func(), void _q_updateCurrentPage())
0078 };
0079 
0080 QT_END_NAMESPACE
0081 
0082 #endif // QPRINTPREVIEWWIDGET_H