KMessageWidget

KDE 4.7 PyKDE API Reference

- KDE's Python API

# KMessageWidget Class Reference

`from PyKDE4.kdeui import *`

Inherits: QFrame → QWidget → QObject

## 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

Author:
  Aurélien Gâteau <agateau@kde.org>

Since:
  4.7

## Enumerations
MessageType | { Positive, Information, Warning, Error }
## Methods
| __init__ (self, QWidget parent=0)
| __init__ (self, QString text, QWidget parent=0)
| addAction (self, QAction action)
| animatedHide (self)
| animatedShow (self)
bool | event (self, QEvent event)
bool | isCloseButtonVisible (self)
KMessageWidget.MessageType | messageType (self)
QSize | minimumSizeHint (self)
| paintEvent (self, QPaintEvent event)
| removeAction (self, QAction action)
| resizeEvent (self, QResizeEvent event)
| setCloseButtonVisible (self, bool visible)
| setMessageType (self, KMessageWidget.MessageType type)
| setText (self, QString text)
| setWordWrap (self, bool wordWrap)
| showEvent (self, QShowEvent event)
QSize | sizeHint (self)
QString | text (self)
bool | wordWrap (self)

## Method Documentation

__init__ | ( | self, |
|  | QWidget | parent=0
| ) |  |  |

Constructs a KMessageWidget with the specified parent.

__init__ | ( | self, |
|  | QString | text,
|  | QWidget | parent=0
| ) |  |  |

addAction | ( | self, |
|  | QAction | action
| ) |  |  |

animatedHide | ( |  | self ) |

Hide the widget using an animation, unless KGlobalSettings.graphicsEffectLevel() does not allow simple effects.

animatedShow | ( |  | self ) |

Show the widget using an animation, unless KGlobalSettings.graphicsEffectLevel() does not allow simple effects.

bool event | ( | self, |
|  | QEvent | event
| ) |  |  |

bool isCloseButtonVisible | ( |  | self ) |

KMessageWidget.MessageType messageType | ( |  | self ) |

QSize minimumSizeHint | ( |  | self ) |

paintEvent | ( | self, |
|  | QPaintEvent | event
| ) |  |  |

removeAction | ( | self, |
|  | QAction | action
| ) |  |  |

resizeEvent | ( | self, |
|  | QResizeEvent | event
| ) |  |  |

setCloseButtonVisible | ( | self, |
|  | bool | visible
| ) |  |  |

setMessageType | ( | self, |
|  | KMessageWidget.MessageType | type
| ) |  |  |

setText | ( | self, |
|  | QString | text
| ) |  |  |

setWordWrap | ( | self, |
|  | bool | wordWrap
| ) |  |  |

showEvent | ( | self, |
|  | QShowEvent | event
| ) |  |  |

QSize sizeHint | ( |  | self ) |

QString text | ( |  | self ) |

bool wordWrap | ( |  | self ) |

## Enumeration Documentation

MessageType

Enumerator:

  PlainMessage |
  InfoMessage |
  WarningMessage |
  ErrorMessage |