6#include <private/qprinter_p.h>
9#include <QtGui/qaction.h>
10#include <QtGui/qactiongroup.h>
11#include <QtWidgets/qboxlayout.h>
12#include <QtWidgets/qcombobox.h>
13#include <QtWidgets/qlineedit.h>
14#include <QtPrintSupport/qpagesetupdialog.h>
15#include <QtPrintSupport/qprinter.h>
16#include <QtWidgets/qstyle.h>
17#include <QtWidgets/qtoolbutton.h>
18#include <QtGui/qvalidator.h>
19#if QT_CONFIG(filedialog)
20#include <QtWidgets/qfiledialog.h>
22#include <QtWidgets/qmainwindow.h>
23#include <QtWidgets/qtoolbar.h>
24#include <QtCore/QCoreApplication>
26#include "private/qdialog_p.h"
28#include <QtWidgets/qformlayout.h>
29#include <QtWidgets/qlabel.h>
33 static bool resourcesInitialized =
false;
34 if (!resourcesInitialized) {
36 resourcesInitialized =
true;
49 QMenu *createPopupMenu()
override {
return nullptr; }
62 bool replacePercent =
false;
63 if (
input.endsWith(u
'%')) {
65 replacePercent =
true;
70 const int num_size = 4;
71 if (
state == Intermediate) {
73 if ((
i == -1 &&
input.size() > num_size)
74 || (
i != -1 &&
i > num_size))
89 connect(
this, &LineEdit::returnPressed,
this, &LineEdit::handleReturnPressed);
107 void handleReturnPressed()
219 LineEdit *zoomEditor =
new LineEdit;
220 zoomEditor->setValidator(
new ZoomFactorValidator(1, 1000, 1, zoomEditor));
222 static const short factorsX2[] = { 25, 50, 100, 200, 250, 300, 400, 800, 1600 };
223 for (
auto factorX2 : factorsX2)
230 QPrintPreviewMainWindow *mw =
new QPrintPreviewMainWindow(
q);
254 QSize pageNumEditSize, pageNumLabelSize;
294 mw->addToolBar(toolbar);
303 q->setLayout(topLayout);
308 q->setWindowTitle(caption);
311#
if defined(Q_OS_WIN) || defined(Q_OS_MAC)
321 const auto imagePrefix =
":/qt-project.org/dialogs/qprintpreviewdialog/images/"_L1;
455 int cyphersWidth =
q->fontMetrics().horizontalAdvance(
QString().
fill(u
'8', maxChars));
540#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
545#if QT_CONFIG(filedialog)
684 delete d->printDialog;
685 delete d->pageSetupDialog;
696 d->preview->updatePreview();
697 d->initialized =
true;
709 if (
d->receiverToDisconnectOnClose) {
711 d->receiverToDisconnectOnClose,
d->memberToDisconnectOnClose);
712 d->receiverToDisconnectOnClose =
nullptr;
714 d->memberToDisconnectOnClose.clear();
732 d->receiverToDisconnectOnClose = receiver;
733 d->memberToDisconnectOnClose = member;
761#include "moc_qprintpreviewdialog.cpp"
762#include "qprintpreviewdialog.moc"
The QActionGroup class groups actions together.
QAction * checkedAction() const
Returns the currently checked action in the group, or \nullptr if none are checked.
void removeAction(QAction *a)
Removes the action from this group.
bool isExclusive() const
Returns true if the group is exclusive.
void setExclusive(bool)
Enable or disable the group exclusion checking.
QAction * addAction(QAction *a)
Adds the action to this group, and returns it.
The QAction class provides an abstraction for user commands that can be added to different user inter...
void setIcon(const QIcon &icon)
void addWidget(QWidget *, int stretch=0, Qt::Alignment alignment=Qt::Alignment())
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment.
void addLayout(QLayout *layout, int stretch=0)
Adds layout to the end of the box, with serial stretch factor stretch.
The QComboBox widget is a combined button and popup list.
void setInsertPolicy(InsertPolicy policy)
QLineEdit * lineEdit() const
Returns the line edit used to edit items in the combobox, or \nullptr if there is no line edit.
void setMinimumContentsLength(int characters)
void addItem(const QString &text, const QVariant &userData=QVariant())
Adds an item to the combobox with the given text, and containing the specified userData (stored in th...
void setEditText(const QString &text)
Sets the text in the combobox's text edit.
void setLineEdit(QLineEdit *edit)
Sets the line edit to use instead of the current line edit widget.
void setEditable(bool editable)
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
The QDialog class is the base class of dialog windows.
void finished(int result)
virtual void done(int)
Closes the dialog and sets its result code to r.
The QDoubleValidator class provides range checking of floating-point numbers.
QValidator::State validate(QString &, int &) const override
Returns \l Acceptable if the string input is in the correct format and contains a double within the v...
static QString getSaveFileName(QWidget *parent=nullptr, const QString &caption=QString(), const QString &dir=QString(), const QString &filter=QString(), QString *selectedFilter=nullptr, Options options=Options())
This is a convenience static function that will return a file name selected by the user.
\inmodule QtCore \reentrant
The QFocusEvent class contains event parameters for widget focus events.
The QIcon class provides scalable icons in different modes and states.
void addFile(const QString &fileName, const QSize &size=QSize(), Mode mode=Normal, State state=Off)
Adds an image from the file with the given fileName to the icon, as a specialization for size,...
static QIcon fromTheme(const QString &name)
The QIntValidator class provides a validator that ensures a string contains a valid integer within a ...
The QLabel widget provides a text or image display.
void setText(const QString &)
QSize minimumSizeHint() const override
\reimp
bool setAlignment(QWidget *w, Qt::Alignment alignment)
Sets the alignment for widget w to alignment and returns true if w is found in this layout (not inclu...
void setContentsMargins(int left, int top, int right, int bottom)
The QLineEdit widget is a one-line text editor.
QSize minimumSizeHint() const override
Returns a minimum size for the line edit.
void setValidator(const QValidator *)
Sets the validator for values of line edit to v.
void setAlignment(Qt::Alignment flag)
bool hasAcceptableInput() const
void focusOutEvent(QFocusEvent *) override
\reimp
void setText(const QString &)
QString text
the line edit's text.
void focusInEvent(QFocusEvent *) override
\reimp
static QLocale system()
Returns a QLocale object initialized to the system locale.
The QMainWindow class provides a main application window.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Q_WEAK_OVERLOAD void setObjectName(const QString &name)
Sets the object's name to name.
The QPageSetupDialog class provides a configuration dialog for the page-related options on a printer.
int exec() override
This virtual function is called to pop up the dialog.
The QPrintDialog class provides a dialog for specifying the printer's configuration.
int exec() override
\reimp
void init(QPrinter *printer=nullptr)
QAction * facingModeAction
QByteArray memberToDisconnectOnClose
QPageSetupDialog * pageSetupDialog
QAction * pageSetupAction
void _q_fit(QAction *action)
void _q_navigate(QAction *action)
QAction * landscapeAction
void _q_zoomFactorChanged()
QPrintPreviewWidget * preview
QPointer< QObject > receiverToDisconnectOnClose
QPrintDialog * printDialog
QAction * overviewModeAction
QAction * firstPageAction
QActionGroup * orientationGroup
void _q_setMode(QAction *action)
QActionGroup * printerGroup
QAction * singleModeAction
QPrintPreviewDialogPrivate()
void updatePageNumLabel()
The QPrintPreviewDialog class provides a dialog for previewing and configuring page layouts for print...
~QPrintPreviewDialog()
Destroys the QPrintPreviewDialog.
QPrinter * printer()
Returns a pointer to the QPrinter object this dialog is currently operating on.
QPrintPreviewDialog(QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::WindowFlags())
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString docName() const
Returns the document name.
QString outputFileName() const
Returns the name of the output file.
void setOutputFileName(const QString &)
Sets the name of the output file to fileName.
OutputFormat outputFormat() const
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
constexpr int width() const noexcept
Returns the width.
\macro QT_RESTRICTED_CAST_FROM_ASCII
int toInt(bool *ok=nullptr, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
qsizetype size() const
Returns the number of characters in this string.
float toFloat(bool *ok=nullptr) const
Returns the string converted to a float value.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString & remove(qsizetype i, qsizetype len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
static QString static QString asprintf(const char *format,...) Q_ATTRIBUTE_FORMAT_PRINTF(1
The QVBoxLayout class lines up widgets vertically.
Combined button and popup list for selecting options.
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLdouble GLdouble GLdouble GLdouble top
GLdouble GLdouble GLdouble GLdouble q
GLenum GLenum GLenum input
static void _q_ppd_initResources()
static void qt_setupActionIcon(QAction *action, QLatin1StringView name)
#define Q_INIT_RESOURCE(name)
myObject disconnect()
[26]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent