DtkWidget 5.6.0.2
DTK Widget module
|
可以使用 DDialog 类快速创建符合 DDE 风格的简要对话框窗口. 更多...
Public 类型 | |
enum | ButtonType { ButtonNormal , ButtonWarning , ButtonRecommend } |
![]() | |
enum | DisplayPosition { Center , TopRight } |
enum | DisplayPostion { DisplayCenter = Center , DisplayTopRight = TopRight } |
Public 槽 | |
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. 更多... | |
信号 | |
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 成员函数 | |
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) |
Protected 成员函数 | |
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) | |
属性 | |
QString | title |
QString | message |
QIcon | icon |
Qt::TextFormat | textFormat |
bool | onButtonClickedClose |
bool | closeButtonVisible |
![]() | |
DisplayPosition | displayPosition |
可以使用 DDialog 类快速创建符合 DDE 风格的简要对话框窗口.
\inmodule dtkwidget
Use DDialog class to create quick dialog window matched DDE style.
DDialog 旨在提供简要的讯问式对话框的快速实现。提供了包含标题,对话框内容,默认图标,用以添加按钮的布局和一个可以自由添加内容的内容布局。 可以使用 addButton() , insertButton(), setDefaultButton() 等函数方便的给对话框插入按钮并进行管理,可以使用 addContent(), insertContent() 等函数操作内容布局。
此外, DDialog 还提供了一些额外的函数以供实现一些常见的需求。如,可以通过设置 setOnButtonClickedClose() 为 true 来使得用 户在点击任何对话框上的按钮后关闭对话框。
当你需要快速构建较为简单结构的对话框,你应当使用 DDialog ,对于较为复杂的需求,请参阅 DAbstractDialog 或 QDialog 相关文档。
|
explicit |
构造一个 DDialog 对话框.
parent 父控件指针.
|
explicit |
构造一个 DDialog 对话框。
title 标题 message 对话框消息 parent 父控件
|
slot |
向对话框添加按钮.
text 按钮文字 isDefault 是否默认按钮 type 按钮类型
|
slot |
向对话框添加按钮.
text 按钮文字
|
slot |
添加控件到对话框内容布局.
widget 待添加的控件 alignment 对齐方式
|
slot |
追加对话框内容间隔.
在对话框的内容布局后追加一个非弹性,大小为 spacing 的间隔(一个 QSpacerItem )。
|
slot |
清空对话框内容布局中的所有内容.
isDelete 是否删除
|
slot |
清除内容间隔.
清除对话框内容布局中包含的所有 QSpacerItem 。
bool Dtk::Widget::DDialog::closeButtonVisible | ( | ) | const |
关闭按钮的可见属性.
QMargins Dtk::Widget::DDialog::contentLayoutContentsMargins | ( | ) | const |
返回内容布局的边距.
|
slot |
以模态框形式显示当前对话框.
以 \l{QDialog::Modal Dialogs}{模态框} 形式显示当前对话框,将会阻塞直到用户关闭对话框。
onButtonClickedClose()为 true 时返回当前点击按钮的Index,否则返回 结果。
QAbstractButton * Dtk::Widget::DDialog::getButton | ( | int | index | ) | const |
获得指定下标所对应的按钮.
index 按钮下标
int Dtk::Widget::DDialog::getButtonIndexByText | ( | const QString & | text | ) | const |
通过按钮文字获取按钮下标.
text 按钮文字
QWidget * Dtk::Widget::DDialog::getContent | ( | int | index | ) | const |
获取指定下标对应的内容控件. index 控件下标
|
protected |
\reimp
QIcon Dtk::Widget::DDialog::icon | ( | ) | const |
返回对话框图标.
QPixmap Dtk::Widget::DDialog::iconPixmap | ( | ) | const |
返回对话框图标的 QPixmap 对象.
|
slot |
向对话框插入按钮.
index 下标 text 按钮文字 isDefault 是否是默认按钮 type 按钮类型
|
slot |
向对话框插入按钮.
index 下标 button 待插入的按钮 isDefault 是否是默认按钮
|
slot |
向对话框插入按钮.
index 下标 text 按钮文字
|
slot |
在对话框内容布局指定位置插入控件.
index 待插入的位置下标 widget 待插入的控件 alignment 对齐方式
|
slot |
插入对话框内容间隔.
在对话框的内容布局的指定位置插入一个非弹性,大小为 spacing 的间隔(一个 QSpacerItem )。 index 插入间隔的索引位置.
QString Dtk::Widget::DDialog::message | ( | ) | const |
返回对话框消息文本.
bool Dtk::Widget::DDialog::onButtonClickedClose | ( | ) | const |
检查在点击任何按钮后是否都会关闭对话框.
|
slot |
从对话框移除按钮.
index 待移除按钮的下标
|
slot |
从对话框移除按钮.
button 待移除的按钮
|
slot |
从对话框移除按钮.
text 待移除按钮的文本内容
|
slot |
从对话框内容布局中移除指定控件.
widget 待移除的控件 isDelete 是否执行删除
|
slot |
设置按钮文字.
index 需要设置文字的按钮的下标 text 所需要设置的文字
|
slot |
设置默认按钮.
str 要设置的默认按钮的文本内容
|
slot |
设置默认按钮.
index 要设置的默认按钮的下标.
|
slot |
设置默认按钮
button 要设置的默认按钮
|
slot |
设置对话框图标. 这是为便于使用而提供的一个重载成员函数.与上面的函数相比,它接受不同类型的参数.为对话框设置图标,同时可以指定一个期望的图标大小。
icon 对话框图标 expectedSize 期望大小.
|
slot |
设置对话框位图图标.
iconPixmap pixmap类型图标.
|
slot |
设置对话框消息内容.
message 对话框消息.
|
slot |
设置是否在点击按钮后关闭对话框.
当 onButtonClickedClose 设置为 true 后,无论点击什么按钮,都会在点击后关闭对话框。
|
slot |
设置对话框内容间隔.
设置对话框的内容布局的间隔 spacing 大小
|
slot |
设置对话框标题.
title 对话框标题.
|
slot |
设定标题Label内容是否可截断换行.
wordWrap true可换行 false不可以换行
|
protected |
\reimp
Qt::TextFormat Dtk::Widget::DDialog::textFormat | ( | ) | const |
返回对话框的文本格式.
QString Dtk::Widget::DDialog::title | ( | ) | const |
返回对话框标题.