KDEUI
#include <kmessagewidget.h>

Public Types | |
enum | MessageType { Positive , Information , Warning , Error } |
Public Slots | |
void | animatedHide () |
void | animatedShow () |
void | setCloseButtonVisible (bool visible) |
void | setIcon (const QIcon &icon) |
void | setMessageType (KMessageWidget::MessageType type) |
void | setText (const QString &text) |
void | setWordWrap (bool wordWrap) |
Signals | |
void | linkActivated (const QString &contents) |
void | linkHovered (const QString &contents) |
Public Member Functions | |
KMessageWidget (const QString &text, QWidget *parent=0) | |
KMessageWidget (QWidget *parent=0) | |
~KMessageWidget () | |
void | addAction (QAction *action) |
int | heightForWidth (int width) const |
QIcon | icon () const |
bool | isCloseButtonVisible () const |
MessageType | messageType () const |
QSize | minimumSizeHint () const |
void | removeAction (QAction *action) |
QSize | sizeHint () const |
QString | text () const |
bool | wordWrap () const |
Protected Member Functions | |
bool | event (QEvent *event) |
void | paintEvent (QPaintEvent *event) |
void | resizeEvent (QResizeEvent *event) |
void | showEvent (QShowEvent *event) |
Properties | |
bool | closeButtonVisible |
QIcon | icon |
MessageType | messageType |
QString | text |
bool | wordWrap |
Detailed Description
A widget to provide feedback or propose opportunistic interactions.
KMessageWidget can be used to provide inline positive or negative feedback, or to implement opportunistic interactions.
As a feedback widget, KMessageWidget provides a less intrusive alternative to "OK Only" message boxes. If you do not need the modalness of KMessageBox, consider using KMessageWidget instead.
Negative feedback
The KMessageWidget can be used as a secondary indicator of failure: the first indicator is usually the fact the action the user expected to happen did not happen.
Example: User fills a form, clicks "Submit".
- Expected feedback: form closes
- First indicator of failure: form stays there
- Second indicator of failure: a KMessageWidget appears on top of the form, explaining the error condition
When used to provide negative feedback, KMessageWidget should be placed close to its context. In the case of a form, it should appear on top of the form entries.
KMessageWidget should get inserted in the existing layout. Space should not be reserved for it, otherwise it becomes "dead space", ignored by the user. KMessageWidget should also not appear as an overlay to prevent blocking access to elements the user needs to interact with to fix the failure.
Positive feedback
KMessageWidget can be used for positive feedback but it shouldn't be overused. It is often enough to provide feedback by simply showing the results of an action.
Examples of acceptable uses:
- Confirm success of "critical" transactions
- Indicate completion of background tasks
Example of inadapted uses:
- Indicate successful saving of a file
- Indicate a file has been successfully removed
Opportunistic interaction
Opportunistic interaction is the situation where the application suggests to the user an action he could be interested in perform, either based on an action the user just triggered or an event which the application noticed.
Example of acceptable uses:
- A browser can propose remembering a recently entered password
- A music collection can propose ripping a CD which just got inserted
- A chat application may notify the user a "special friend" just connected
- Since
- 4.7
Definition at line 92 of file kmessagewidget.h.
Member Enumeration Documentation
◆ MessageType
Enumerator | |
---|---|
Positive | |
Information | |
Warning | |
Error |
Definition at line 103 of file kmessagewidget.h.
Constructor & Destructor Documentation
◆ KMessageWidget() [1/2]
|
explicit |
Constructs a KMessageWidget with the specified parent.
Definition at line 214 of file kmessagewidget.cpp.
◆ KMessageWidget() [2/2]
|
explicit |
Definition at line 221 of file kmessagewidget.cpp.
◆ ~KMessageWidget()
KMessageWidget::~KMessageWidget | ( | ) |
Definition at line 229 of file kmessagewidget.cpp.
Member Function Documentation
◆ addAction()
void KMessageWidget::addAction | ( | QAction * | action | ) |
Definition at line 390 of file kmessagewidget.cpp.
◆ animatedHide
|
slot |
Hide the widget using an animation, unless KGlobalSettings::graphicsEffectLevel() does not allow simple effects.
Definition at line 426 of file kmessagewidget.cpp.
◆ animatedShow
|
slot |
Show the widget using an animation, unless KGlobalSettings::graphicsEffectLevel() does not allow simple effects.
Definition at line 402 of file kmessagewidget.cpp.
◆ event()
|
protected |
Definition at line 318 of file kmessagewidget.cpp.
◆ heightForWidth()
int KMessageWidget::heightForWidth | ( | int | width | ) | const |
Definition at line 335 of file kmessagewidget.cpp.
◆ icon()
QIcon KMessageWidget::icon | ( | ) | const |
The icon shown on the left of the text.
By default, no icon is shown.
- Since
- 4.11
Definition at line 446 of file kmessagewidget.cpp.
◆ isCloseButtonVisible()
bool KMessageWidget::isCloseButtonVisible | ( | ) | const |
Definition at line 379 of file kmessagewidget.cpp.
◆ linkActivated
|
signal |
This signal is emitted when the user clicks a link in the text label.
The URL referred to by the href anchor is passed in contents.
- Parameters
-
contents text of the href anchor
- See also
- QLabel::linkActivated()
- Since
- 4.10
◆ linkHovered
|
signal |
This signal is emitted when the user hovers over a link in the text label.
The URL referred to by the href anchor is passed in contents.
- Parameters
-
contents text of the href anchor
- See also
- QLabel::linkHovered()
- Since
- 4.11
◆ messageType()
KMessageWidget::MessageType KMessageWidget::messageType | ( | ) | const |
Definition at line 245 of file kmessagewidget.cpp.
◆ minimumSizeHint()
QSize KMessageWidget::minimumSizeHint | ( | ) | const |
Definition at line 312 of file kmessagewidget.cpp.
◆ paintEvent()
|
protected |
Definition at line 341 of file kmessagewidget.cpp.
◆ removeAction()
void KMessageWidget::removeAction | ( | QAction * | action | ) |
Definition at line 396 of file kmessagewidget.cpp.
◆ resizeEvent()
|
protected |
Definition at line 326 of file kmessagewidget.cpp.
◆ setCloseButtonVisible
|
slot |
Definition at line 384 of file kmessagewidget.cpp.
◆ setIcon
|
slot |
Define an icon to be shown on the left of the text.
- Since
- 4.11
Definition at line 451 of file kmessagewidget.cpp.
◆ setMessageType
|
slot |
Definition at line 257 of file kmessagewidget.cpp.
◆ setText
|
slot |
Definition at line 239 of file kmessagewidget.cpp.
◆ setWordWrap
|
slot |
Definition at line 363 of file kmessagewidget.cpp.
◆ showEvent()
|
protected |
Definition at line 351 of file kmessagewidget.cpp.
◆ sizeHint()
QSize KMessageWidget::sizeHint | ( | ) | const |
Definition at line 306 of file kmessagewidget.cpp.
◆ text()
QString KMessageWidget::text | ( | ) | const |
Definition at line 234 of file kmessagewidget.cpp.
◆ wordWrap()
bool KMessageWidget::wordWrap | ( | ) | const |
Definition at line 358 of file kmessagewidget.cpp.
Property Documentation
◆ closeButtonVisible
|
readwrite |
Definition at line 1 of file kmessagewidget.h.
◆ icon
|
readwrite |
Definition at line 1 of file kmessagewidget.h.
◆ messageType
|
readwrite |
Definition at line 1 of file kmessagewidget.h.
◆ text
|
readwrite |
Definition at line 1 of file kmessagewidget.h.
◆ wordWrap
|
readwrite |
Definition at line 1 of file kmessagewidget.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.