|
DtkWidget
DTK Widget module
|
Dtk 风格的打印预览页面. 更多...
信号 | |
| void | paintRequested (DPrinter *printer) |
| void | paintRequested (DPrinter *printer, const QVector< int > &pageRange) |
信号 继承自 Dtk::Widget::DDialog | |
| void | aboutToClose () |
| void | closed () |
| void | buttonClicked (int index, const QString &text) |
| void | titleChanged (QString title) |
| void | messageChanged (QString massage) |
| void | textFormatChanged (Qt::TextFormat textFormat) |
| void | sizeChanged (QSize size) |
| void | visibleChanged (bool visible) |
信号 继承自 Dtk::Widget::DAbstractDialog | |
| void | sizeChanged (QSize size) |
| 窗口大小发生改变 | |
Public 成员函数 | |
| DPrintPreviewDialog (QWidget *parent=nullptr) | |
| virtual bool | event (QEvent *event) override |
| bool | eventFilter (QObject *watched, QEvent *event) override |
| void | setDocName (const QString &) |
| DPrintPreviewDialog::setDocName 设置保存PDF的文件名称 str 文件名称 | |
| QString | docName () const |
| DPrintPreviewDialog::docName 保存PDF的文件名称 | |
| bool | setPrintFromPath (const QString &path=QString()) |
| DPrintPreviewDialog::setPrintFromPath 根据路径的文件进行打印. path 文件路径 | |
| QString | printFromPath () const |
| DPrintPreviewDialog::docName 路径文件的路径名 | |
| bool | setAsynPreview (int totalPage) |
| bool | isAsynPreview () const |
| DPrintPreviewSettingInfo * | createDialogSettingInfo (DPrintPreviewSettingInfo::SettingType type) |
| void | updateDialogSettingInfo (DPrintPreviewSettingInfo *info) |
Public 成员函数 继承自 Dtk::Widget::DDialog | |
| DDialog (QWidget *parent=nullptr) | |
| 构造一个 DDialog 对话框 | |
| DDialog (const QString &title, const QString &message, QWidget *parent=0) | |
| 构造一个 DDialog 对话框 | |
| int | getButtonIndexByText (const QString &text) const |
| 通过按钮文字获取按钮下标 | |
| int | buttonCount () const |
| 获得对话框包含的按钮数量 | |
| int | contentCount () const |
| 获得对话框包含的所有内容控件的数量 | |
| QList< QAbstractButton * > | getButtons () const |
| 获得对话框的按钮列表 | |
| QList< QWidget * > | getContents () const |
| 获得对话框包含的所有内容控件列表 | |
| QAbstractButton * | getButton (int index) const |
| 获得指定下标所对应的按钮 | |
| QWidget * | getContent (int index) const |
| 获取指定下标对应的内容控件 | |
| QString | title () const |
| 返回对话框标题 | |
| QString | message () const |
| 返回对话框消息文本 | |
| QIcon | icon () const |
| 返回对话框图标 | |
| Qt::TextFormat | textFormat () const |
| 返回对话框的文本格式 | |
| bool | onButtonClickedClose () const |
| 检查在点击任何按钮后是否都会关闭对话框 | |
| void | setContentLayoutContentsMargins (const QMargins &margins) |
| 设定内容布局的内容 margin | |
| QMargins | contentLayoutContentsMargins () const |
| 返回内容布局的边距. | |
| bool | closeButtonVisible () const |
| 关闭按钮的可见属性. | |
Public 成员函数 继承自 Dtk::Widget::DAbstractDialog | |
| DAbstractDialog (QWidget *parent=nullptr) | |
| 构造一个DAbstractDialog实例 | |
| DAbstractDialog (bool blurIfPossible, QWidget *parent=nullptr) | |
| 构造一个 DAbstractDialog 实例 | |
| DisplayPosition | displayPosition () const |
| void | move (const QPoint &pos) |
| 将窗口移动到指定坐标 | |
| void | move (int x, int y) |
| 将窗口移动到指定坐标 | |
| void | setGeometry (const QRect &rect) |
| 构造一个矩形 | |
| void | setGeometry (int x, int y, int width, int height) |
Protected 成员函数 | |
| virtual void | resizeEvent (QResizeEvent *event) override |
| void | timerEvent (QTimerEvent *event) override |
Protected 成员函数 继承自 Dtk::Widget::DDialog | |
| DDialog (DDialogPrivate &dd, QWidget *parent=0) | |
| void | showEvent (QShowEvent *event) Q_DECL_OVERRIDE |
| void | hideEvent (QHideEvent *event) Q_DECL_OVERRIDE |
| void | closeEvent (QCloseEvent *event) override |
| void | childEvent (QChildEvent *event) Q_DECL_OVERRIDE |
| void | resizeEvent (QResizeEvent *event) override |
| void | keyPressEvent (QKeyEvent *event) override |
| bool | eventFilter (QObject *watched, QEvent *event) override |
| void | changeEvent (QEvent *event) override |
Protected 成员函数 继承自 Dtk::Widget::DAbstractDialog | |
| void | mouseMoveEvent (QMouseEvent *event) Q_DECL_OVERRIDE |
| 对话框的鼠标移动事件 | |
| void | mousePressEvent (QMouseEvent *event) Q_DECL_OVERRIDE |
| 对话框的鼠标点击事件 | |
| void | mouseReleaseEvent (QMouseEvent *event) Q_DECL_OVERRIDE |
| 对话框的鼠标释放事件 | |
| void | resizeEvent (QResizeEvent *event) Q_DECL_OVERRIDE |
| 窗口大小改变事件 | |
| void | showEvent (QShowEvent *event) override |
| 窗口显示事件,如果收到过鼠标移动事件不再使用自动布局 | |
| DAbstractDialog (DAbstractDialogPrivate &dd, QWidget *parent=nullptr) | |
额外继承的成员函数 | |
Public 类型 继承自 Dtk::Widget::DDialog | |
| enum | ButtonType { ButtonNormal , ButtonWarning , ButtonRecommend } |
| 表示按钮类型 | |
Public 类型 继承自 Dtk::Widget::DAbstractDialog | |
| enum | DisplayPosition { Center , TopRight } |
| 对话框显示位置 更多... | |
| enum | DisplayPostion { DisplayCenter = Center , DisplayTopRight = TopRight } |
Public 槽 继承自 Dtk::Widget::DDialog | |
| int | addButton (const QString &text, bool isDefault=false, ButtonType type=ButtonNormal) |
| 向对话框添加按钮 | |
| int | addButtons (const QStringList &text) |
| 向对话框添加按钮 | |
| void | insertButton (int index, const QString &text, bool isDefault=false, ButtonType type=ButtonNormal) |
| 向对话框插入按钮 | |
| void | insertButton (int index, QAbstractButton *button, bool isDefault=false) |
| 向对话框插入按钮 | |
| void | insertButtons (int index, const QStringList &text) |
| 向对话框插入按钮 | |
| void | removeButton (int index) |
| 从对话框移除按钮 | |
| void | removeButton (QAbstractButton *button) |
| 从对话框移除按钮 | |
| void | removeButtonByText (const QString &text) |
| 从对话框移除按钮 | |
| void | clearButtons () |
| 清除所有按钮 | |
| bool | setDefaultButton (int index) |
| 设置默认按钮 | |
| bool | setDefaultButton (const QString &str) |
| 设置默认按钮 | |
| void | setDefaultButton (QAbstractButton *button) |
| 设置默认按钮 | |
| void | addContent (QWidget *widget, Qt::Alignment alignment={}) |
| 添加控件到对话框内容布局. | |
| void | insertContent (int index, QWidget *widget, Qt::Alignment alignment={}) |
| 在对话框内容布局指定位置插入控件. | |
| void | removeContent (QWidget *widget, bool isDelete=true) |
| 从对话框内容布局中移除指定控件 | |
| void | clearContents (bool isDelete=true) |
| 清空对话框内容布局中的所有内容. | |
| void | setSpacing (int spacing) |
| 设置对话框内容间隔 | |
| void | addSpacing (int spacing) |
| 追加对话框内容间隔. | |
| void | insertSpacing (int index, int spacing) |
| 插入对话框内容间隔 | |
| void | clearSpacing () |
| 清除内容间隔 | |
| void | setButtonText (int index, const QString &text) |
| 设置按钮文字 | |
| void | setButtonIcon (int index, const QIcon &icon) |
| 设置按钮图标 | |
| void | setTitle (const QString &title) |
| 设置对话框标题 | |
| void | setWordWrapTitle (bool wordWrap) |
| 设定标题Label内容是否可截断换行 | |
| void | setMessage (const QString &message) |
| 设置对话框消息内容 | |
| void | setWordWrapMessage (bool wordWrap) |
| 设置对话框消息内容 | |
| void | setIcon (const QIcon &icon) |
| 设置对话框图标 | |
| void | setTextFormat (Qt::TextFormat textFormat) |
| 设置文字格式 | |
| void | setOnButtonClickedClose (bool onButtonClickedClose) |
| 设置是否在点击按钮后关闭对话框 | |
| void | setCloseButtonVisible (bool closeButtonVisible) |
| 设置关闭按钮的可见性 | |
| int | exec () Q_DECL_OVERRIDE |
| 以模态框形式显示当前对话框 | |
Public 槽 继承自 Dtk::Widget::DAbstractDialog | |
| void | moveToCenter () |
| 将对话框移动至屏幕中央或其父控件的中央 | |
| void | moveToTopRight () |
| 将对话框移动至屏幕右上角或其父控件的右上角 | |
| void | moveToCenterByRect (const QRect &rect) |
移动对话框到给定rect区域的中央。rect是移动对话框要参照的QRect区域 | |
| void | moveToTopRightByRect (const QRect &rect) |
移动对话框到给定rect区域的右上角。rect是移动所需要参照的QRect位置。 | |
| void | setDisplayPosition (DisplayPosition displayPosition) |
| 设置对话框显示位置 | |
属性 继承自 Dtk::Widget::DDialog | |
| QString | title |
| 对话框标题属性 | |
| QString | message |
| 对话框消息属性 | |
| QIcon | icon |
| 对话框图标属性 | |
| Qt::TextFormat | textFormat |
| 对话框的文本格式属性 | |
| bool | onButtonClickedClose |
| 标志是否在点击按钮后关闭对话框的属性 | |
| bool | closeButtonVisible |
| 关闭按钮的可见属性 | |
属性 继承自 Dtk::Widget::DAbstractDialog | |
| DisplayPosition | displayPosition |
| 获取对话框显示位置 | |
Dtk 风格的打印预览页面.
\inmodule dtkwidget
一个用于创建 Dtk 风格的打印预览页面,通常情况下,只需要 构建一个 DPrintPreivewDialog 对象,并将原始数据绘制 到连接 DPrintPreview::paintRequested 信号的槽函数 中,最后以模态的形式显示就可以正常使用。
dtkwidget 项目的 collection 示例中有对打印预览的简单 示例。简单的讲:打印预览拥有两种预览模式,1. 同步预览模式 ,适用于数据量较小,且更新不太频繁的原始数据中,这种模式下 默认情况下的,打印预览仅会在页面大小或者打印机属性发生变化 时发射 DPrintPreview::paintRequested 信号。2. 异步 预览模式,该模式适用于数据量较大,且更新较频繁的原始数据, 这种模式下,打印预览会频繁触发异步的 DPrintPreview::paintRequested 信号,但每次接收的数据量较小,因此不用担心响应速度的问题。 默认情况下的打印预览窗口为同步模式。
| QString Dtk::Widget::DPrintPreviewDialog::docName | ( | ) | const |
DPrintPreviewDialog::docName 保存PDF的文件名称
| QString Dtk::Widget::DPrintPreviewDialog::printFromPath | ( | ) | const |
DPrintPreviewDialog::docName 路径文件的路径名
| bool Dtk::Widget::DPrintPreviewDialog::setPrintFromPath | ( | const QString & | path = QString() | ) |
DPrintPreviewDialog::setPrintFromPath 根据路径的文件进行打印. path 文件路径