Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
4#ifndef QPRINTPREVIEWWIDGET_H
5#define QPRINTPREVIEWWIDGET_H
6
7#include <QtPrintSupport/qtprintsupportglobal.h>
8#include <QtWidgets/qwidget.h>
9#include <QtPrintSupport/qprinter.h>
10
11QT_REQUIRE_CONFIG(printpreviewwidget);
12
14
15
17
18class Q_PRINTSUPPORT_EXPORT QPrintPreviewWidget : public QWidget
19{
21 Q_DECLARE_PRIVATE(QPrintPreviewWidget)
22public:
23
29
30 enum ZoomMode {
33 FitInView
34 };
35
36 explicit QPrintPreviewWidget(QPrinter *printer, QWidget *parent = nullptr,
37 Qt::WindowFlags flags = Qt::WindowFlags());
38 explicit QPrintPreviewWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
40
41 qreal zoomFactor() const;
42 QPageLayout::Orientation orientation() const;
43 ViewMode viewMode() const;
44 ZoomMode zoomMode() const;
45 int currentPage() const;
46 int pageCount() const;
47 void setVisible(bool visible) override;
48
49public Q_SLOTS:
50 void print();
51
52 void zoomIn(qreal zoom = 1.1);
53 void zoomOut(qreal zoom = 1.1);
54 void setZoomFactor(qreal zoomFactor);
55 void setOrientation(QPageLayout::Orientation orientation);
56 void setViewMode(ViewMode viewMode);
57 void setZoomMode(ZoomMode zoomMode);
58 void setCurrentPage(int pageNumber);
59
60 void fitToWidth();
61 void fitInView();
62 void setLandscapeOrientation();
63 void setPortraitOrientation();
64 void setSinglePageViewMode();
65 void setFacingPagesViewMode();
66 void setAllPagesViewMode();
67
68 void updatePreview();
69
71 void paintRequested(QPrinter *printer);
73
74private:
75 Q_PRIVATE_SLOT(d_func(), void _q_fit())
76 Q_PRIVATE_SLOT(d_func(), void _q_updateCurrentPage())
77};
78
80
81#endif // QPRINTPREVIEWWIDGET_H
Orientation
This enum type defines the page orientation.
Definition qpagelayout.h:33
The QPrintPreviewWidget class provides a widget for previewing page layouts for printer output.
ViewMode
This enum is used to describe the view mode of the preview widget.
ZoomMode
This enum is used to describe zoom mode of the preview widget.
void previewChanged()
This signal is emitted whenever the preview widget has changed some internal state,...
void paintRequested(QPrinter *printer)
This signal is emitted when the preview widget needs to generate a set of preview pages.
\reentrant
Definition qprinter.h:28
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
Combined button and popup list for selecting options.
GLbitfield flags
#define QT_REQUIRE_CONFIG(feature)
#define Q_OBJECT
#define Q_SLOTS
#define Q_PRIVATE_SLOT(d, signature)
#define Q_SIGNALS
double qreal
Definition qtypes.h:187
dialog setViewMode(QFileDialog::Detail)
[3]