kdk::KMessageBox(3)

NAME
kdk::KMessageBox - 继承自KDialog，提供一个可自定义设置按钮和图标的对话框，类似QMessageBox

SYNOPSIS

#include <kmessagebox.h>

Inherits kdk::KDialog.

  Public Types

enum Icon { NoIcon = 0, Information = 1, Warning = 2, Critical = 3, Question = 4 }
The Icon enum，icon的五种类型，与 QMessageDialogOptions::Icon 保持同步
enum ButtonRole { InvalidRole = -1, AcceptRole, RejectRole, DestructiveRole, ActionRole, HelpRole, YesRole, NoRole, ResetRole, ApplyRole, NRoles }
The ButtonRole enum，可供设置的按钮role.
enum StandardButton { NoButton = 0x00000000, Ok = 0x00000400, Save = 0x00000800, SaveAll = 0x00001000, Open = 0x00002000, Yes = 0x00004000, YesToAll = 0x00008000, No = 0x00010000, NoToAll = 0x00020000, Abort = 0x00040000, Retry = 0x00080000, Ignore = 0x00100000, Close = 0x00200000, Cancel = 0x00400000, Discard = 0x00800000, Help = 0x01000000, Apply = 0x02000000, Reset = 0x04000000, RestoreDefaults = 0x08000000, FirstButton = Ok, LastButton = RestoreDefaults, YesAll = YesToAll, NoAll = NoToAll, Default = 0x00000100, Escape = 0x00000200, FlagMask = 0x00000300, ButtonMask = ~FlagMask }
The StandardButton enum，可供添加的按钮类型,与 QDialogButtonBox::StandardButton 和 QPlatformDialogHelper::StandardButton 保持同步
typedef StandardButton Button

  Signals

void buttonClicked (QAbstractButton *button)

  Public Member Functions

KMessageBox (QWidget *parent=nullptr)
void setCustomIcon (const QIcon &icon)
自定义KMessageBox的提示图标
void addButton (QAbstractButton *button, ButtonRole role)
添加一个自定义按钮
QPushButton * addButton (const QString &text, ButtonRole role)
添加设置好文本的按钮
QPushButton * addButton (StandardButton button)
添加一个标准按钮并且返回这个按钮
void removeButton (QAbstractButton *button)
移除一个按钮
QAbstractButton * button (StandardButton which) const
返回与标准按钮对应的指针，如果此消息框中不存在标准按钮，则返回0。
QList< QAbstractButton * > buttons () const
返回已添加到消息框中的所有按钮的列表
KMessageBox::ButtonRole buttonRole (QAbstractButton *button) const
返回指定按钮的按钮角色，如果按钮为0或尚未添加到消息框中，此函数将返回InvalidRole
QCheckBox * checkBox () const
返回KMessageBox中显示的复选框
void setCheckBox (QCheckBox *cb)
设置KMessageBox显示的复选框，未设置则为0
QString text () const
获取KMessageBox的文本
void setText (const QString &text)
设置KMessageBox的文本
QString informativeText () const
获取KMessageBox信息性文本的描述
void setInformativeText (const QString &text)
设置KMessageBox信息性文本的描述
Icon icon () const
获取KMessageBox的图标
void setIcon (Icon icon)
设置KMessageBox的图标
QPixmap iconPixmap () const
返回当前KMessageBox的icon
void setIconPixmap (const QPixmap &pixmap)
设置当前KMessageBox的icon
KMessageBox::StandardButtons standardButtons () const
KMessageBox中标准按钮的集合
void setStandardButtons (KMessageBox::StandardButtons buttons)
设置多个标准按钮
KMessageBox::StandardButton standardButton (QAbstractButton *button) const
返回与给定按钮对应的标准按钮枚举值，如果给定按钮不是标准按钮，则返回NoButton
QPushButton * defaultButton () const
返回KMessageBox的默认按钮
void setDefaultButton (QPushButton *button)
设置KMessageBox的默认按钮
void setDefaultButton (KMessageBox::StandardButton button)
设置KMessageBox的默认按钮
QAbstractButton * clickedButton () const
返回被点击的按钮
QLabel * informativeLabel ()
返回informativeLabel

Public Member Functions inherited from kdk::KDialog
KDialog (QWidget *parent=nullptr)
void setWindowIcon (const QIcon &icon)
设置对话框图标
void setWindowIcon (const QString &iconName)
设置对话框图标
void setWindowTitle (const QString &)
设置对话框标题名称
QPushButton * maximumButton ()
获取最大化按钮
QPushButton * minimumButton ()
获取最小化按钮
QPushButton * closeButton ()
获取关闭按钮
KMenuButton * menuButton ()
获取下拉菜单按钮
QWidget * mainWidget ()
获取主内容区Widget
KWindowButtonBar * windowButtonBar ()
windowButtonBar
KIconBar * iconBar ()
iconBar

  Static Public Member Functions

static QPixmap standardIcon (Icon icon)
返回用于标准图标的pixmap。
static StandardButton information (QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
打开带有给定标题和文本的信息消息框。对话框最多可以有三个按钮
static StandardButton question (QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=StandardButtons(Yes|No), StandardButton defaultButton=NoButton)
打开一个带有给定标题和文本的问题消息框
static StandardButton warning (QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
打开一个带有给定标题和文本的警告消息框
static StandardButton critical (QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
用给定的标题和文本打开一个关键信息框
static StandardButton success (QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
用给定的标题和文本打开一个成功消息框

  Protected Member Functions

bool event (QEvent *e) override

Protected Member Functions inherited from kdk::KDialog
bool eventFilter (QObject *target, QEvent *event) override
void changeTheme ()
void changeIconStyle ()
QBoxLayout * mainLayout ()

Detailed Description

继承自KDialog，提供一个可自定义设置按钮和图标的对话框，类似QMessageBox

Since
    2.0.2.1

Member Function Documentation

  QPushButton * kdk::KMessageBox::addButton (const QString & text, ButtonRole role)

添加设置好文本的按钮

Parameters
    text
    role

Returns

  void kdk::KMessageBox::addButton (QAbstractButton * button, ButtonRole role)

添加一个自定义按钮

Parameters
    button
    role

  QPushButton * kdk::KMessageBox::addButton (StandardButton button)

添加一个标准按钮并且返回这个按钮

Parameters
    button

Returns

  QAbstractButton * kdk::KMessageBox::button (StandardButton which) const

返回与标准按钮对应的指针，如果此消息框中不存在标准按钮，则返回0。

Parameters
    which

Returns

  KMessageBox::ButtonRole kdk::KMessageBox::buttonRole (QAbstractButton * button) const

返回指定按钮的按钮角色，如果按钮为0或尚未添加到消息框中，此函数将返回InvalidRole

Parameters
    button

Returns

  QList< QAbstractButton * > kdk::KMessageBox::buttons () const

返回已添加到消息框中的所有按钮的列表

Returns

  QCheckBox * kdk::KMessageBox::checkBox () const

返回KMessageBox中显示的复选框

Returns

  QAbstractButton * kdk::KMessageBox::clickedButton () const

返回被点击的按钮

Returns

  static StandardButton kdk::KMessageBox::critical (QWidget * parent, const QString & title, const QString & text, StandardButtons buttons = Ok, StandardButton defaultButton = NoButton) [static]

用给定的标题和文本打开一个关键信息框

Parameters
    parent
    title
    text
    buttons
    defaultButton

Returns

  QPushButton * kdk::KMessageBox::defaultButton () const

返回KMessageBox的默认按钮

Returns

  Icon kdk::KMessageBox::icon () const

获取KMessageBox的图标

Returns

  QPixmap kdk::KMessageBox::iconPixmap () const

返回当前KMessageBox的icon

Returns

  static StandardButton kdk::KMessageBox::information (QWidget * parent, const QString & title, const QString & text, StandardButtons buttons = Ok, StandardButton defaultButton = NoButton) [static]

打开带有给定标题和文本的信息消息框。对话框最多可以有三个按钮

Parameters
    parent
    title
    text
    buttons
    defaultButton

Returns

  QLabel * kdk::KMessageBox::informativeLabel ()

返回informativeLabel

Returns

Since
    3.0.1.0

  QString kdk::KMessageBox::informativeText () const

获取KMessageBox信息性文本的描述

Returns

  static StandardButton kdk::KMessageBox::question (QWidget * parent, const QString & title, const QString & text, StandardButtons buttons = StandardButtons(Yes|No), StandardButton defaultButton = NoButton) [static]

打开一个带有给定标题和文本的问题消息框

Parameters
    parent
    title
    text
    buttons
    defaultButton

Returns

  void kdk::KMessageBox::removeButton (QAbstractButton * button)

移除一个按钮

Parameters
    button

  void kdk::KMessageBox::setCheckBox (QCheckBox * cb)

设置KMessageBox显示的复选框，未设置则为0

Parameters
    cb

  void kdk::KMessageBox::setCustomIcon (const QIcon & icon)

自定义KMessageBox的提示图标

Parameters
    icon

  void kdk::KMessageBox::setDefaultButton (KMessageBox::StandardButton button)

设置KMessageBox的默认按钮

Parameters
    button

  void kdk::KMessageBox::setDefaultButton (QPushButton * button)

设置KMessageBox的默认按钮

Parameters
    button

  void kdk::KMessageBox::setIcon (Icon icon)

设置KMessageBox的图标

Parameters
    icon

  void kdk::KMessageBox::setIconPixmap (const QPixmap & pixmap)

设置当前KMessageBox的icon

Parameters
    pixmap

  void kdk::KMessageBox::setInformativeText (const QString & text)

设置KMessageBox信息性文本的描述

Parameters
    text

  void kdk::KMessageBox::setStandardButtons (KMessageBox::StandardButtons buttons)

设置多个标准按钮

Parameters
    buttons

  void kdk::KMessageBox::setText (const QString & text)

设置KMessageBox的文本

Parameters
    text

  KMessageBox::StandardButton kdk::KMessageBox::standardButton (QAbstractButton * button) const

返回与给定按钮对应的标准按钮枚举值，如果给定按钮不是标准按钮，则返回NoButton

Parameters
    button

Returns

  KMessageBox::StandardButtons kdk::KMessageBox::standardButtons () const

KMessageBox中标准按钮的集合

Returns

  static QPixmap kdk::KMessageBox::standardIcon (Icon icon) [static]

返回用于标准图标的pixmap。

Parameters
    icon

Returns

  static StandardButton kdk::KMessageBox::success (QWidget * parent, const QString & title, const QString & text, StandardButtons buttons = Ok, StandardButton defaultButton = NoButton) [static]

用给定的标题和文本打开一个成功消息框

Parameters
    parent
    title
    text
    buttons
    defaultButton

Returns

  QString kdk::KMessageBox::text () const

获取KMessageBox的文本

Returns

  static StandardButton kdk::KMessageBox::warning (QWidget * parent, const QString & title, const QString & text, StandardButtons buttons = Ok, StandardButton defaultButton = NoButton) [static]

打开一个带有给定标题和文本的警告消息框

Parameters
    parent
    title
    text
    buttons
    defaultButton

Returns

Author

Generated automatically by Doxygen for LIBKYSDK-APPLICATIONS from the source code.