An animation display. More...
#include <klfguiutil.h>
Public Slots | |
virtual void | setWaitMovie (QMovie *movie) |
Set which animation to display while searching. | |
virtual void | setWaitMovie (const QString &file) |
void | setWidthPercent (int widthpercent) |
Sets the width of this label. | |
void | setHeightPercent (int heightpercent) |
Sets the height of this label. | |
void | setPositionXPercent (int xpc) |
Sets the horizontal position of this label relative to the parent widget. | |
void | setPositionYPercent (int ypc) |
Sets the vertical position of this label relative to the parent widget. | |
void | setBackgroundColor (const QColor &c) |
Set the label background color. | |
virtual void | startWait () |
Display the animation. | |
virtual void | stopWait () |
Hide the animation. | |
Public Member Functions | |
KLFWaitAnimationOverlay (QWidget *parent) | |
virtual | ~KLFWaitAnimationOverlay () |
QString | waitMovieFileName () const |
int | widthPercent () const |
int | heightPercent () const |
int | positionXPercent () const |
int | positionYPercent () const |
QColor | backgroundColor () const |
Protected Member Functions | |
virtual void | timerEvent (QTimerEvent *event) |
virtual QRect | calcAnimationLabelGeometry () |
Properties | |
QString | waitMovie |
int | widthPercent |
int | heightPercent |
int | positionXPercent |
int | positionYPercent |
QColor | backgroundColor |
An animation display.
This animation widget can be used as an overlay widget (meaning, not positioned within a layout) to indicate the user to be patient.
Note that this label relies on a non-NULL parent widget. (Exception: the parent is only needed in calcAnimationLabelGeometry(); if you need a parentless animation widget, subclass this animation label and reimplement that function to fit your needs without calling the base implemenation of that function).
Definition at line 412 of file klfguiutil.h.
KLFWaitAnimationOverlay::KLFWaitAnimationOverlay | ( | QWidget * | parent | ) |
Definition at line 338 of file klfguiutil.cpp.
References setBackgroundColor().
KLFWaitAnimationOverlay::~KLFWaitAnimationOverlay | ( | ) | [virtual] |
Definition at line 363 of file klfguiutil.cpp.
QRect KLFWaitAnimationOverlay::calcAnimationLabelGeometry | ( | ) | [protected, virtual] |
Calculate the geometry the label should have, according to current parent geometry. This function is called just before the label is shown.
The returned QRect should be relative to the parent widget.
Definition at line 439 of file klfguiutil.cpp.
References QRect::height(), QSize::height(), KLF_DEBUG_TEE, KLF_FUNC_NAME, klfDbg, QSize::width(), and QRect::width().
Referenced by startWait().
int KLFWaitAnimationOverlay::heightPercent | ( | ) | const [inline] |
Definition at line 428 of file klfguiutil.h.
int KLFWaitAnimationOverlay::positionXPercent | ( | ) | const [inline] |
Definition at line 429 of file klfguiutil.h.
int KLFWaitAnimationOverlay::positionYPercent | ( | ) | const [inline] |
Definition at line 430 of file klfguiutil.h.
void KLFWaitAnimationOverlay::setBackgroundColor | ( | const QColor & | c | ) | [slot] |
Set the label background color.
This function will set the label background color. It may contain an alpha value to make the label translucent or semi-translucent.
This function internally sets a style sheet to this label.
Definition at line 389 of file klfguiutil.cpp.
References QColor::alpha(), QColor::blue(), QColor::green(), and QColor::red().
Referenced by KLFWaitAnimationOverlay().
void KLFWaitAnimationOverlay::setHeightPercent | ( | int | heightpercent | ) | [inline, slot] |
void KLFWaitAnimationOverlay::setPositionXPercent | ( | int | xpc | ) | [inline, slot] |
Sets the horizontal position of this label relative to the parent widget.
The value given is, in percent, the amout of space on the left of this label (relative to parent), with 0%
being aligned completely to the left (no space left on the left) and 100%
being aligned completely to the right (no space left on the right). 50%
will center the label.
The label will never go beyond the parent widget's geometry.
This function has no effect if calcAnimationLabelGeometry() has been reimplemented in a subclass that does not call the base implementation of that function.
See also setPositionYPercent().
Definition at line 480 of file klfguiutil.h.
void KLFWaitAnimationOverlay::setPositionYPercent | ( | int | ypc | ) | [inline, slot] |
Sets the vertical position of this label relative to the parent widget.
Definition at line 485 of file klfguiutil.h.
void KLFWaitAnimationOverlay::setWaitMovie | ( | QMovie * | movie | ) | [virtual, slot] |
Set which animation to display while searching.
An animation is displayed when performing long searches, to tell the user to be patient. A default animation is provided if you do not call this function. If you give a NULL movie pointer, the animation is unset and disabled.
The ownership of movie
is transferred to this search bar object, and will be delete'd
when no longer used.
Definition at line 372 of file klfguiutil.cpp.
References QObject::setParent().
Referenced by setWaitMovie().
void KLFWaitAnimationOverlay::setWaitMovie | ( | const QString & | file | ) | [virtual, slot] |
Set the animation to display while searching (eg. MNG file). See also setWaitMovie(QMovie*).
Definition at line 381 of file klfguiutil.cpp.
References QMovie::setCacheMode(), and setWaitMovie().
void KLFWaitAnimationOverlay::setWidthPercent | ( | int | widthpercent | ) | [inline, slot] |
Sets the width of this label.
Sets the width of the displayed animation, in percent of the parent's width. 50%
will occupy half of the parent's width, leaving 25%
on each side, while 100%
will occupy the full parent width.
This function has no effect if calcAnimationLabelGeometry() has been reimplemented in a subclass that does not call the base implementation of that function.
This function must be called before animation is shown with startWait().
See also setHeightPercent().
Definition at line 461 of file klfguiutil.h.
void KLFWaitAnimationOverlay::startWait | ( | ) | [virtual, slot] |
Display the animation.
Definition at line 396 of file klfguiutil.cpp.
References calcAnimationLabelGeometry(), QMovie::currentPixmap(), QMovie::jumpToFrame(), and QMovie::nextFrameDelay().
void KLFWaitAnimationOverlay::stopWait | ( | ) | [virtual, slot] |
Hide the animation.
Definition at line 416 of file klfguiutil.cpp.
void KLFWaitAnimationOverlay::timerEvent | ( | QTimerEvent * | event | ) | [protected, virtual] |
Definition at line 429 of file klfguiutil.cpp.
References QMovie::currentPixmap(), QMovie::jumpToNextFrame(), and QTimerEvent::timerId().
QString KLFWaitAnimationOverlay::waitMovieFileName | ( | ) | const [inline] |
Definition at line 425 of file klfguiutil.h.
References QMovie::fileName().
int KLFWaitAnimationOverlay::widthPercent | ( | ) | const [inline] |
Definition at line 427 of file klfguiutil.h.
QColor KLFWaitAnimationOverlay::backgroundColor [read, write] |
Definition at line 419 of file klfguiutil.h.
int KLFWaitAnimationOverlay::heightPercent [read, write] |
Definition at line 416 of file klfguiutil.h.
int KLFWaitAnimationOverlay::positionXPercent [read, write] |
Definition at line 417 of file klfguiutil.h.
int KLFWaitAnimationOverlay::positionYPercent [read, write] |
Definition at line 418 of file klfguiutil.h.
QString KLFWaitAnimationOverlay::waitMovie [read, write] |
Definition at line 415 of file klfguiutil.h.
int KLFWaitAnimationOverlay::widthPercent [read, write] |
Definition at line 415 of file klfguiutil.h.