Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qprintpreviewwidget.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QPRINTPREVIEWWIDGET_H
6#define QPRINTPREVIEWWIDGET_H
7
8#include <QtPrintSupport/qtprintsupportglobal.h>
9#include <QtWidgets/qwidget.h>
10#include <QtPrintSupport/qprinter.h>
11
13
14QT_BEGIN_NAMESPACE
15
16
17class QPrintPreviewWidgetPrivate;
18
19class Q_PRINTSUPPORT_EXPORT QPrintPreviewWidget : public QWidget
20{
21 Q_OBJECT
22 Q_DECLARE_PRIVATE(QPrintPreviewWidget)
23public:
24
25 enum ViewMode {
26 SinglePageView,
27 FacingPagesView,
28 AllPagesView
29 };
30
31 enum ZoomMode {
32 CustomZoom,
33 FitToWidth,
34 FitInView
35 };
36
37 explicit QPrintPreviewWidget(QPrinter *printer, QWidget *parent = nullptr,
38 Qt::WindowFlags flags = Qt::WindowFlags());
39 explicit QPrintPreviewWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
40 ~QPrintPreviewWidget();
41
42 qreal zoomFactor() const;
43 QPageLayout::Orientation orientation() const;
44 ViewMode viewMode() const;
45 ZoomMode zoomMode() const;
46 int currentPage() const;
47 int pageCount() const;
48 void setVisible(bool visible) override;
49
50public Q_SLOTS:
51 void print();
52
53 void zoomIn(qreal zoom = 1.1);
54 void zoomOut(qreal zoom = 1.1);
55 void setZoomFactor(qreal zoomFactor);
56 void setOrientation(QPageLayout::Orientation orientation);
57 void setViewMode(ViewMode viewMode);
58 void setZoomMode(ZoomMode zoomMode);
59 void setCurrentPage(int pageNumber);
60
61 void fitToWidth();
62 void fitInView();
63 void setLandscapeOrientation();
64 void setPortraitOrientation();
65 void setSinglePageViewMode();
66 void setFacingPagesViewMode();
67 void setAllPagesViewMode();
68
69 void updatePreview();
70
71Q_SIGNALS:
72 void paintRequested(QPrinter *printer);
73 void previewChanged();
74
75private:
76 Q_PRIVATE_SLOT(d_func(), void _q_fit())
77 Q_PRIVATE_SLOT(d_func(), void _q_updateCurrentPage())
78};
79
80QT_END_NAMESPACE
81
82#endif // QPRINTPREVIEWWIDGET_H
void init(QPrinter *printer=nullptr)
void _q_navigate(QAction *action)
QString formattedZoomFactor(double value)
QPointer< QObject > receiverToDisconnectOnClose
The QPrintPreviewDialog class provides a dialog for previewing and configuring page layouts for print...
The QPrintPreviewWidget class provides a widget for previewing page layouts for printer output.
static void _q_ppd_initResources()
static void qt_setupActionIcon(QAction *action, QLatin1StringView name)
QT_REQUIRE_CONFIG(printpreviewdialog)
QT_REQUIRE_CONFIG(thread)