QPageSetupDialog Class

QPageSetupDialog 类为打印机上的页面相关选项提供了一个配置对话框。更多

Header: #include <QPageSetupDialog>
CMake: find_package(Qt6 REQUIRED COMPONENTS PrintSupport)
target_link_libraries(mytarget PRIVATE Qt6::PrintSupport)
qmake: QT += printsupport
继承: QDialog

公共函数

QPageSetupDialog(QWidget *parent = nullptr)
QPageSetupDialog(QPrinter *printer, QWidget *parent = nullptr)
virtual ~QPageSetupDialog()
void open(QObject *receiver, const char *member)
QPrinter *printer()

重新实现的公共函数

virtual void done(int result) override
virtual int exec() override
virtual void setVisible(bool visible) override

详细说明

在 Windows 和 macOS 中,页面设置对话框是使用本地页面设置对话框实现的。

请注意,在 Windows 和 macOS 上,自定义纸张尺寸不会反映在本地页面设置对话框中。此外,在QPrinter 上设置的自定义页边距也不会在本地 macOS 页面设置对话框中显示。

另请参阅 QPrinterQPrintDialog

成员函数文档

[explicit] QPageSetupDialog::QPageSetupDialog(QWidget *parent = nullptr)

构造页面设置对话框,配置默认构造的QPrinter ,并将parent 作为父窗口部件。

另请参阅 printer().

[explicit] QPageSetupDialog::QPageSetupDialog(QPrinter *printer, QWidget *parent = nullptr)

构建页面设置对话框,配置printer ,并将parent 作为父部件。

[virtual noexcept] QPageSetupDialog::~QPageSetupDialog()

销毁页面设置对话框。

[override virtual] void QPageSetupDialog::done(int result)

重实现:QDialog::done(int r)。

[override virtual] int QPageSetupDialog::exec()

重新实现:QDialog::exec().

调用此虚函数可弹出对话框。必须在子类中重新实现。

void QPageSetupDialog::open(QObject *receiver, const char *member)

这是一个重载函数。

打开对话框,并将accepted() 信号连接到receivermember 指定的槽。

关闭对话框时,信号将从槽中断开。

QPrinter *QPageSetupDialog::printer()

返回传递给QPageSetupDialog 构造函数的打印机。

[override virtual] void QPageSetupDialog::setVisible(bool visible)

重实现:QDialog::setVisible(bool visible)。

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.