• Skip to content
  • Skip to link menu
KDE 4.7 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

KDEUI

Public Types | Public Slots | Public Member Functions | Protected Member Functions | Properties
KMessageWidget Class Reference

#include <kmessagewidget.h>

Inheritance diagram for KMessageWidget:
Inheritance graph
[legend]

List of all members.

Public Types

enum  MessageType { Positive, Information, Warning, Error }

Public Slots

void animatedHide ()
void animatedShow ()
void setCloseButtonVisible (bool visible)
void setMessageType (KMessageWidget::MessageType type)
void setText (const QString &text)
void setWordWrap (bool wordWrap)

Public Member Functions

 KMessageWidget (QWidget *parent=0)
 KMessageWidget (const QString &text, QWidget *parent=0)
 ~KMessageWidget ()
void addAction (QAction *action)
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
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
Author:
Aurélien Gâteau <agateau@kde.org>
Since:
4.7

Member Enumeration Documentation

enum KMessageWidget::MessageType
Enumerator:
Positive 
Information 
Warning 
Error 

Definition at line 102 of file kmessagewidget.h.


Constructor & Destructor Documentation

KMessageWidget::KMessageWidget ( QWidget *  parent = 0) [explicit]

Constructs a KMessageWidget with the specified parent.

Definition at line 185 of file kmessagewidget.cpp.

KMessageWidget::KMessageWidget ( const QString &  text,
QWidget *  parent = 0 
) [explicit]

Definition at line 192 of file kmessagewidget.cpp.

KMessageWidget::~KMessageWidget ( )

Definition at line 200 of file kmessagewidget.cpp.


Member Function Documentation

void KMessageWidget::addAction ( QAction *  action)

Definition at line 342 of file kmessagewidget.cpp.

void KMessageWidget::animatedHide ( ) [slot]

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

Definition at line 378 of file kmessagewidget.cpp.

void KMessageWidget::animatedShow ( ) [slot]

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

Definition at line 354 of file kmessagewidget.cpp.

bool KMessageWidget::event ( QEvent *  event) [protected]

Definition at line 284 of file kmessagewidget.cpp.

bool KMessageWidget::isCloseButtonVisible ( ) const

Definition at line 332 of file kmessagewidget.cpp.

MessageType KMessageWidget::messageType ( ) const
QSize KMessageWidget::minimumSizeHint ( ) const

Definition at line 278 of file kmessagewidget.cpp.

void KMessageWidget::paintEvent ( QPaintEvent *  event) [protected]

Definition at line 300 of file kmessagewidget.cpp.

void KMessageWidget::removeAction ( QAction *  action)

Definition at line 348 of file kmessagewidget.cpp.

void KMessageWidget::resizeEvent ( QResizeEvent *  event) [protected]

Definition at line 292 of file kmessagewidget.cpp.

void KMessageWidget::setCloseButtonVisible ( bool  visible) [slot]

Definition at line 337 of file kmessagewidget.cpp.

void KMessageWidget::setMessageType ( KMessageWidget::MessageType  type) [slot]

Definition at line 221 of file kmessagewidget.cpp.

void KMessageWidget::setText ( const QString &  text) [slot]

Definition at line 210 of file kmessagewidget.cpp.

void KMessageWidget::setWordWrap ( bool  wordWrap) [slot]

Definition at line 325 of file kmessagewidget.cpp.

void KMessageWidget::showEvent ( QShowEvent *  event) [protected]

Definition at line 310 of file kmessagewidget.cpp.

QSize KMessageWidget::sizeHint ( void  ) const

Definition at line 272 of file kmessagewidget.cpp.

QString KMessageWidget::text ( ) const
bool KMessageWidget::wordWrap ( ) const

Property Documentation

bool KMessageWidget::closeButtonVisible [read, write]

Definition at line 99 of file kmessagewidget.h.

KMessageWidget::MessageType KMessageWidget::messageType [read, write]

Definition at line 100 of file kmessagewidget.h.

QString KMessageWidget::text [read, write]

Definition at line 97 of file kmessagewidget.h.

bool KMessageWidget::wordWrap [read, write]

Definition at line 98 of file kmessagewidget.h.


The documentation for this class was generated from the following files:
  • kmessagewidget.h
  • kmessagewidget.cpp

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.5
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal