kdk::KMessageBox(3)
✨ kdk::KMessageBox(3) ✨
okay so bestie, welcome to the KMessageBox manual page — it's giving dialog box but make it customizable 💅
🌸 NAME 🌸
kdk::KMessageBox — inherits from KDialog, gives you a dialog where you can customize buttons and icons, kinda like QMessageBox but with more main character energy ✨
🦋 SYNOPSIS 🦋
#include <kmessagebox.h>
Inherits kdk::KDialog.
🎀 Public Types 🎀
enum Icon
enum Icon { NoIcon = 0, Information = 1, Warning = 2, Critical = 3, Question = 4 }
The Icon enum — five icon types, kept in sync with QMessageDialogOptions::Icon 💖
enum ButtonRole
enum ButtonRole { InvalidRole = -1, AcceptRole, RejectRole, DestructiveRole, ActionRole, HelpRole, YesRole, NoRole, ResetRole, ApplyRole, NRoles }
The ButtonRole enum — the button roles you can set, bestie 🎀
enum StandardButton
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 — the button types you can add, synced with QDialogButtonBox::StandardButton and QPlatformDialogHelper::StandardButton 💅
typedef StandardButton Button
🌈 Signals 🌈
void buttonClicked (QAbstractButton *button)— the buttonClicked signal ✨
💖 Public Member Functions 💖
KMessageBox (QWidget *parent=nullptr)— constructor, bestie 🫶void setCustomIcon (const QIcon &icon)— customize the KMessageBox icon 🎀void addButton (QAbstractButton *button, ButtonRole role)— add a custom button ✨QPushButton * addButton (const QString &text, ButtonRole role)— add a button with text already set 💅QPushButton * addButton (StandardButton button)— add a standard button and return it 🔥void removeButton (QAbstractButton *button)— remove a button 🙈QAbstractButton * button (StandardButton which) const— return the pointer for a standard button, or0if that standard button isn't in this message box 💀QList< QAbstractButton * > buttons () const— return a list of all buttons added to the message box 📋KMessageBox::ButtonRole buttonRole (QAbstractButton *button) const— return the button role of the given button; if the button is0or hasn't been added to the message box yet, returnsInvalidRole🎭QCheckBox * checkBox () const— return the checkbox shown in the KMessageBox ☑️void setCheckBox (QCheckBox *cb)— set the checkbox shown in the KMessageBox; if not set, it's0💖QString text () const— get the KMessageBox text 📝void setText (const QString &text)— set the KMessageBox text ✍️QString informativeText () const— get the informative text description of the KMessageBox ℹ️void setInformativeText (const QString &text)— set the informative text description of the KMessageBox 💬Icon icon () const— get the KMessageBox icon 🌟void setIcon (Icon icon)— set the KMessageBox icon 🎨QPixmap iconPixmap () const— return the current KMessageBox icon as a pixmap 🖼️void setIconPixmap (const QPixmap &pixmap)— set the current KMessageBox icon as a pixmap 🖌️KMessageBox::StandardButtons standardButtons () const— the set of standard buttons in the KMessageBox 🔘void setStandardButtons (KMessageBox::StandardButtons buttons)— set multiple standard buttons 🔘🔘KMessageBox::StandardButton standardButton (QAbstractButton *button) const— return the standard button enum value for the given button; if the given button isn't a standard button, returnsNoButton🚫QPushButton * defaultButton () const— return the KMessageBox default button ⭐void setDefaultButton (QPushButton *button)— set the KMessageBox default button 🌟void setDefaultButton (KMessageBox::StandardButton button)— set the KMessageBox default button (using a standard button) ✨QAbstractButton * clickedButton () const— return the button that was clicked 👆QLabel * informativeLabel ()— return theinformativeLabel🏷️
🫶 Public Member Functions inherited from kdk::KDialog 🫶
KDialog (QWidget *parent=nullptr)— constructor, bestie 💅void setWindowIcon (const QIcon &icon)— set the dialog icon 🖼️void setWindowIcon (const QString &iconName)— set the dialog icon 🖼️void setWindowTitle (const QString &)— set the dialog window title name 🏷️QPushButton * maximumButton ()— get the maximize button 🔼QPushButton * minimumButton ()— get the minimize button 🔽QPushButton * closeButton ()— get the close button ❌KMenuButton * menuButton ()— get the dropdown menu button 📋QWidget * mainWidget ()— get the main content area Widget 🧩KWindowButtonBar * windowButtonBar ()—windowButtonBar🪟KIconBar * iconBar ()—iconBar🌟
🌟 Static Public Member Functions 🌟
static QPixmap standardIcon (Icon icon)— return the pixmap used for a standard icon 🖼️static StandardButton information (QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)— open an information message box with the given title and text. The dialog can have up to three buttons ℹ️static StandardButton question (QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=StandardButtons(Yes|No), StandardButton defaultButton=NoButton)— open a question message box with the given title and text ❓static StandardButton warning (QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)— open a warning message box with the given title and text ⚠️static StandardButton critical (QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)— open a critical message box with the given title and text 🚨static StandardButton success (QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)— open a success message box with the given title and text ✅
🛡️ Protected Member Functions 🛡️
bool event (QEvent *e) override— override, bestie 🛡️
🛡️ Protected Member Functions inherited from kdk::KDialog 🛡️
bool eventFilter (QObject *target, QEvent *event) override— event filter, bestie 🕵️void changeTheme ()— change theme, bestie 🎨void changeIconStyle ()— change icon style, bestie 🌟QBoxLayout * mainLayout ()— main layout, bestie 📐
💜 Detailed Description 💜
Inherits from KDialog, gives you a dialog where you can customize buttons and icons, kinda like QMessageBox but with more main character energy ✨
Since 2.0.2.1
✨ Member Function Documentation ✨
okay bestie, this is the part where we meet all the actual functions 💅. Every single one of them. No skips, no "and the rest is obvious", we're going the whole way through because you deserve the full picture. Buckle up, hydrate, let's go 🫶
addButton — the one with text
QPushButton * kdk::KMessageBox::addButton (const QString & text, ButtonRole role)
Adds a button that already has its text set. Like, you hand it the words, it hands you back a button with the words on it. Iconic behaviour, honestly. 👑
Parameters
text— the text you want the button to say.role— theButtonRoleyou want it to have.
Returns — a QPushButton *, obviously, because that's literally the signature bestie 😭
addButton — the custom one
void kdk::KMessageBox::addButton (QAbstractButton * button, ButtonRole role)
Adds a custom button. Not a premade standard one, your button, your rules, your vibe. ✨
Parameters
button— theQAbstractButton *you're bringing to the party.role— theButtonRoleit gets.
addButton — the standard one
QPushButton * kdk::KMessageBox::addButton (StandardButton button)
Adds a standard button and returns that button. Two things at once, she's an overachiever, we love her. 🌸
Parameters
button— theStandardButtonyou want added.
Returns — the QPushButton * for it.
button
QAbstractButton * kdk::KMessageBox::button (StandardButton which) const
Returns the pointer that corresponds to the standard button. BUT — and this is the important bit — if that standard button doesn't exist in this message box, it returns 0. So like, check for the zero, bestie. Always check for the zero. 🙈
Parameters
which— theStandardButtonyou're asking about.
Returns — the matching QAbstractButton *, or 0.
buttonRole
KMessageBox::ButtonRole kdk::KMessageBox::buttonRole (QAbstractButton * button) const
Returns the button role of the button you pass in. And if the button is 0, or it hasn't been added to the message box yet? It returns InvalidRole. Ghosting rules apply: not added = no role. 💀
Parameters
button— the button whose role you want.
Returns — the KMessageBox::ButtonRole, or InvalidRole.
buttons
QList< QAbstractButton * > kdk::KMessageBox::buttons () const
Returns the list of ALL the buttons that have been added to the message box. The whole squad, no one left behind 🫶
Returns — a QList< QAbstractButton * >.
checkBox
QCheckBox * kdk::KMessageBox::checkBox () const
Returns the checkbox that's showing in the KMessageBox. Yes, she has a checkbox. She contains multitudes. ☑️
Returns — a QCheckBox *.
clickedButton
QAbstractButton * kdk::KMessageBox::clickedButton () const
Returns the button that got clicked. The chosen one. The main character of that particular interaction. 👑
Returns — the QAbstractButton * that was clicked.
critical
static StandardButton kdk::KMessageBox::critical (QWidget * parent, const QString & title, const QString & text, StandardButtons buttons = Ok, StandardButton defaultButton = NoButton) [static]
Opens a critical information box with the given title and text. It's giving "🚨 something went very wrong 🚨" energy. This one is static, so you don't need an instance, just call it.
Parameters
parent— the parent widget.title— the title.text— the text.buttons— theStandardButtonsto show. Defaults toOk.defaultButton— theStandardButtonthat's the default. Defaults toNoButton.
Returns — a StandardButton.
defaultButton
QPushButton * kdk::KMessageBox::defaultButton () const
Returns the default button of the KMessageBox. The one that gets hit when you just press enter and hope for the best. ⌨️
Returns — a QPushButton *.
icon
Icon kdk::KMessageBox::icon () const
Gets the icon of the KMessageBox. ✨
Returns — an Icon.
iconPixmap
QPixmap kdk::KMessageBox::iconPixmap () const
Returns the icon of the current KMessageBox. Same energy as icon(), but pixmap-flavoured. 🖼️
Returns — a QPixmap.
information
static StandardButton kdk::KMessageBox::information (QWidget * parent, const QString & title, const QString & text, StandardButtons buttons = Ok, StandardButton defaultButton = NoButton) [static]
Opens an information message box with the given title and text. Heads up: the dialog can have at most three buttons. Three. That's the limit, bestie, don't push it. 🙅♀️
Parameters
parent— the parent widget.title— the title.text— the text.buttons— theStandardButtonsto show. Defaults toOk.defaultButton— the defaultStandardButton. Defaults toNoButton.
Returns — a StandardButton.
informativeLabel
QLabel * kdk::KMessageBox::informativeLabel ()
Returns the informativeLabel. That's the whole description, she said what she said. 💅
Returns — a QLabel *.
Since — 3.0.1.0 🎀 (so if you're on something older than that, this one's not for you yet, sorry babe)
informativeText
QString kdk::KMessageBox::informativeText () const
Gets the informative text description of the KMessageBox. The little extra paragraph that explains the vibe. 📝
Returns — a QString.
question
static StandardButton kdk::KMessageBox::question (QWidget * parent, const QString & title, const QString & text, StandardButtons buttons = StandardButtons(Yes|No), StandardButton defaultButton = NoButton) [static]
Opens a question message box with the given title and text. 👀 Note the default buttons here are StandardButtons(Yes|No) — not just Ok like the others. Pay attention, this is a choice.
Parameters
parent— the parent widget.title— the title.text— the text.buttons— theStandardButtonsto show. Defaults toStandardButtons(Yes|No).defaultButton— the defaultStandardButton. Defaults toNoButton.
Returns — a StandardButton.
removeButton
void kdk::KMessageBox::removeButton (QAbstractButton * button)
Removes a button. Gone. Blocked. Uninvited from the dialog. 🚫
Parameters
button— the button to remove.
setCheckBox
void kdk::KMessageBox::setCheckBox (QCheckBox * cb)
Sets the checkbox that the KMessageBox shows — and if it hasn't been set, it's 0. Simple as. ☑️
Parameters
cb— theQCheckBox *to set.
setCustomIcon
void kdk::KMessageBox::setCustomIcon (const QIcon & icon)
Customises the KMessageBox's hint icon. Your box, your art direction, your aesthetic. 🎨
Parameters
icon— theQIconto use.
setDefaultButton — the standard version
void kdk::KMessageBox::setDefaultButton (KMessageBox::StandardButton button)
Sets the default button of the KMessageBox.
Parameters
button— theKMessageBox::StandardButtonto make default.
setDefaultButton — the QPushButton version
void kdk::KMessageBox::setDefaultButton (QPushButton * button)
Sets the default button of the KMessageBox. Same job, different argument type. Two paths, one destiny. 💫
Parameters
button— theQPushButton *to make default.
setIcon
void kdk::KMessageBox::setIcon (Icon icon)
Sets the icon of the KMessageBox. ✨
Parameters
icon— theIconto set.
setIconPixmap
void kdk::KMessageBox::setIconPixmap (const QPixmap & pixmap)
Sets the icon of the current KMessageBox. Pixmap edition. 🖼️
Parameters
pixmap— theQPixmapto set.
setInformativeText
void kdk::KMessageBox::setInformativeText (const QString & text)
Sets the informative text description of the KMessageBox.</pulple>
Parameters
text— theQStringto set it to.
setStandardButtons
void kdk::KMessageBox::setStandardButtons (KMessageBox::StandardButtons buttons)
Sets multiple standard buttons at once. Bulk mode. Efficiency queen. 👑
Parameters
buttons— theKMessageBox::StandardButtonsto set.
setText
void kdk::KMessageBox::setText (const QString & text)
Sets the text of the KMessageBox.
Parameters
text— theQStringto set.
standardButton
KMessageBox::StandardButton kdk::KMessageBox::standardButton (QAbstractButton * button) const
Returns the standard button enum value that corresponds to the given button. And if the given button isn't a standard button? It returns NoButton. Not every button gets to be standard, bestie, that's just life. 💀
Parameters
button— the button you're checking.
Returns — a KMessageBox::StandardButton, or NoButton.
standardButtons
KMessageBox::StandardButtons kdk::KMessageBox::standardButtons () const
The set of standard buttons in the KMessageBox. The whole standard lineup. 🌈
Returns — a KMessageBox::StandardButtons.
standardIcon
static QPixmap kdk::KMessageBox::standardIcon (Icon icon) [static]
Returns the pixmap used for a standard icon. static, so no instance needed, just vibes. ⭐
Parameters
icon— theIconto get the pixmap for.
Returns — a QPixmap.
success
static StandardButton kdk::KMessageBox::success (QWidget * parent, const QString & title, const QString & text, StandardButtons buttons = Ok, StandardButton defaultButton = NoButton) [static]
Opens a success message box with the given title and text. 🎉 The happy one!! The "you did it bestie" one!! We love a success box. 🥳
Parameters
parent— the parent widget.title— the title.text— the text.buttons— theStandardButtonsto show. Defaults toOk.defaultButton— the defaultStandardButton. Defaults toNoButton.
Returns — a StandardButton.
text
QString kdk::KMessageBox::text () const
Gets the text of the KMessageBox.
Returns — a QString.
warning
static StandardButton kdk::KMessageBox::warning (QWidget * parent, const QString & title, const QString & text, StandardButtons buttons = Ok, StandardButton defaultButton = NoButton) [static]
Opens a warning message box with the given title and text. ⚠️ Not quite an emergency, but definitely a "hey. hey bestie. look at this." moment.
Parameters
parent— the parent widget.title— the title.text— the text.buttons— theStandardButtonsto show. Defaults toOk.defaultButton— the defaultStandardButton. Defaults toNoButton.
Returns — a StandardButton.
🌸 Author 🌸
Generated automatically by Doxygen for LIBKYSDK-APPLICATIONS from the source code. So like, a robot wrote this. A very thorough robot. Respect. 🤖💖
and that's the whole thing, bestie!! 🎀 you made it all the way through every single member function, and honestly? that's main character energy. this page is LIBKYSDK-APPLICATIONS, version version:3.0, and it's the kdk::KMessageBox(3) page — go forth and open dialogs responsibly, mwah 💋🦋
📦 where this page comes from
- arch rolling: libkysdk-applications 3.0.1.2-1 · BSD-3-Clause AND GPL-3.0-or-later AND LGPL-2.1-or-later AND LGPL-3.0-or-later AND MIT AND MulanPSL-2.0
- ubuntu resolute: libkysdk-applications-dev 3.0.1.1-1 · LGPL-3.0-or-later
- ubuntu stonking: libkysdk-applications-dev 3.0.1.2-1build2 · LGPL-3.0-or-later
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms