DtkWidget 5.6.0.2
DTK Widget module
|
Dtk 风格的打印预览页面. 更多...
信号 | |
void | paintRequested (DPrinter *printer) |
void | paintRequested (DPrinter *printer, const QVector< int > &pageRange) |
![]() | |
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) |
![]() | |
void | sizeChanged (QSize size) |
sizeChanged is emitted when the size of this dialog changed. size is the target 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 |
![]() | |
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 |
获取指定下标对应的内容控件. index 控件下标 更多... | |
QString | title () const |
返回对话框标题. 更多... | |
QString | message () const |
返回对话框消息文本. 更多... | |
QIcon | icon () const |
返回对话框图标. 更多... | |
D_DECL_DEPRECATED QPixmap | iconPixmap () const |
返回对话框图标的 QPixmap 对象. 更多... | |
Qt::TextFormat | textFormat () const |
返回对话框的文本格式. 更多... | |
bool | onButtonClickedClose () const |
检查在点击任何按钮后是否都会关闭对话框. 更多... | |
void | setContentLayoutContentsMargins (const QMargins &margins) |
设定内容布局的内容 margin . margins 具体的 margins | |
QMargins | contentLayoutContentsMargins () const |
返回内容布局的边距. 更多... | |
bool | closeButtonVisible () const |
关闭按钮的可见属性. 更多... | |
![]() | |
DAbstractDialog (QWidget *parent=nullptr) | |
DAbstractDialog::DAbstractDialog constructs a DAbstractDialog instance. parent is the parent widget to be used. 更多... | |
DAbstractDialog (bool blurIfPossible, QWidget *parent=nullptr) | |
DisplayPosition | displayPosition () const |
DAbstractDialog::displayPosition 更多... | |
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) |
静态 Public 成员函数 | |
static void | setPluginMimeData (const QVariant &mimeData) |
static QVariant | pluginMimeData () |
static bool | setCurrentPlugin (const QString &pluginName) |
static QString | currentPlugin () |
static QStringList | availablePlugins () |
Protected 成员函数 | |
virtual void | resizeEvent (QResizeEvent *event) override |
void | timerEvent (QTimerEvent *event) override |
![]() | |
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 | 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) | |
额外继承的成员函数 | |
![]() | |
enum | ButtonType { ButtonNormal , ButtonWarning , ButtonRecommend } |
![]() | |
enum | DisplayPosition { Center , TopRight } |
enum | DisplayPostion { DisplayCenter = Center , DisplayTopRight = TopRight } |
![]() | |
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) |
设置按钮图标. index 需要设置图标的按钮的下标 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) |
设置对话框图标. icon 对话框图标. | |
D_DECL_DEPRECATED void | setIcon (const QIcon &icon, const QSize &expectedSize) |
设置对话框图标. 这是为便于使用而提供的一个重载成员函数.与上面的函数相比,它接受不同类型的参数.为对话框设置图标,同时可以指定一个期望的图标大小。 更多... | |
D_DECL_DEPRECATED void | setIconPixmap (const QPixmap &iconPixmap) |
设置对话框位图图标. 更多... | |
void | setTextFormat (Qt::TextFormat textFormat) |
设置文字格式. textFormat 文字格式. | |
void | setOnButtonClickedClose (bool onButtonClickedClose) |
设置是否在点击按钮后关闭对话框. 更多... | |
void | setCloseButtonVisible (bool closeButtonVisible) |
int | exec () Q_DECL_OVERRIDE |
以模态框形式显示当前对话框. 更多... | |
![]() | |
void | moveToCenter () |
DAbstractDialog::moveToCenter moves the dialog to the center of the screen or its parent widget. 更多... | |
void | moveToTopRight () |
DAbstractDialog::moveToTopRight moves the dialog to the top right of the screen or its parent widget. 更多... | |
void | moveToCenterByRect (const QRect &rect) |
DAbstractDialog::moveToCenterByRect moves the dialog to the center of the rect. rect is the target rect. 更多... | |
void | moveToTopRightByRect (const QRect &rect) |
DAbstractDialog::moveToTopRightByRect moves the dialog to the top right corner of the rect. rect is the target rect. 更多... | |
void | setDisplayPosition (DisplayPosition displayPosition) |
DAbstractDialog::setDisplayPosition sets the position of the dialog. displayPosition is the target position. 更多... | |
![]() | |
QString | title |
QString | message |
QIcon | icon |
Qt::TextFormat | textFormat |
bool | onButtonClickedClose |
bool | closeButtonVisible |
![]() | |
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 路径文件的路径名
DPrintPreviewDialog::setPrintFromPath 根据路径的文件进行打印. path 文件路径