KTutorial  0.5.1
Public Slots | Signals | Public Member Functions | Protected Member Functions
ktutorial::extendedinformation::WidgetHighlighter Class Reference

Utility class to highlight a widget. More...

#include <WidgetHighlighter.h>

List of all members.

Public Slots

void start ()
 Starts highlighting the target widget.
void stop ()
 Stops highlighting the target widget.

Signals

void stopped (extendedinformation::WidgetHighlighter *widgetHighlighter)
 Emitted when the animation has stopped.

Public Member Functions

 WidgetHighlighter (QWidget *targetWidget)
 Creates a new WidgetHighlighter for the given widget.
virtual bool eventFilter (QObject *watched, QEvent *event)
 Resizes this WidgetHighlighter to the size of its parent widget when it receives a resize event.

Protected Member Functions

virtual void paintEvent (QPaintEvent *event)
 Paints a frame with a semi-transparent highlight color.

Detailed Description

Utility class to highlight a widget.

WidgetHighlighter executes an animation that tints its parent widget, changing its colors from normal to highlighted and back again.

Once started, the animation goes on indefinitely until the stop slot is called. The parent widget recovers its original appearance animating the change from the current color of the widget to the normal one. If the highlighting is started again while the stop animation is running, the highlighting animation is started again from the current color (that is, the stop animation is cancelled and a new highlight animation is started from that point).

To tint the widget, the WidgetHighlighter paints itself over the parent widget with a semi-transparent highlight color. However, due to performance reasons, only a frame is tinted instead of the whole widget. The center of the frame is always transparent.

WidgetHighlighter should not be created directly. Instead, WidgetHighlighterManager should be used, as it takes care of deleting the highlighter when no longer needed.

See also:
WidgetHighlighterManager

Definition at line 53 of file WidgetHighlighter.h.


Constructor & Destructor Documentation

Creates a new WidgetHighlighter for the given widget.

Parameters:
targetWidgetThe widget to highlight.

Definition at line 30 of file WidgetHighlighter.cpp.


Member Function Documentation

bool ktutorial::extendedinformation::WidgetHighlighter::eventFilter ( QObject *  watched,
QEvent *  event 
) [virtual]

Resizes this WidgetHighlighter to the size of its parent widget when it receives a resize event.

Parameters:
watchedThe filtered object that received an event.
eventThe event received.
Returns:
False, to allow the event to be handled further.

Definition at line 59 of file WidgetHighlighter.cpp.

void ktutorial::extendedinformation::WidgetHighlighter::paintEvent ( QPaintEvent *  event) [protected, virtual]

Paints a frame with a semi-transparent highlight color.

The degree of opacity depends on the progress of the animation.

Parameters:
eventThe paint event.

Definition at line 91 of file WidgetHighlighter.cpp.

Starts highlighting the target widget.

If there is a normal animation already running nothing is done. However, if there is a stop animation running, it is cancelled and the highlighting animation is started again from the current color.

Definition at line 72 of file WidgetHighlighter.cpp.

Referenced by ktutorial::extendedinformation::WidgetHighlighterManager::highlight().

Stops highlighting the target widget.

The animation is not stopped sharply, but a stop animation (the widget recovering its normal color) is executed.

Definition at line 79 of file WidgetHighlighter.cpp.

References stopped().

Referenced by ktutorial::extendedinformation::WidgetHighlighterManager::stopHighlighting().

Emitted when the animation has stopped.

Note that it is emitted when the animation has truly stopped, that is, when there is not even an stop animation.

Parameters:
widgetHighlighterThis WidgetHighlighter.

Referenced by stop().


The documentation for this class was generated from the following files: