Qt 4.8
Public Functions | Public Variables | List of all members
QWindowsVistaPulse Class Reference

#include <qwindowsvistastyle_p.h>

Inheritance diagram for QWindowsVistaPulse:
QWindowsVistaAnimation

Public Functions

int duration () const
 
virtual void paint (QPainter *painter, const QStyleOption *option)
 Paints a pulse. More...
 
 QWindowsVistaPulse ()
 
void setAlternateImage (const QImage &image)
 
void setDuration (int duration)
 
void setPrimaryImage (const QImage &image)
 
virtual ~QWindowsVistaPulse ()
 
- Public Functions inherited from QWindowsVistaAnimation
 QWindowsVistaAnimation ()
 
bool running () const
 
void setRunning (bool val)
 
void setStartTime (const QTime &startTime)
 
void setWidget (QWidget *widget)
 
const QTimestartTime () const
 
QWidgetwidget () const
 
virtual ~QWindowsVistaAnimation ()
 

Public Variables

int _duration
 

Additional Inherited Members

- Protected Functions inherited from QWindowsVistaAnimation
void drawBlendedImage (QPainter *painter, QRect rect, float value)
 
- Protected Variables inherited from QWindowsVistaAnimation
QImage _primaryImage
 
bool _running
 
QImage _secondaryImage
 
QTime _startTime
 
QImage _tempImage
 
QPointer< QWidget_widget
 

Detailed Description

Definition at line 180 of file qwindowsvistastyle_p.h.

Constructors and Destructors

◆ QWindowsVistaPulse()

QWindowsVistaPulse::QWindowsVistaPulse ( )
inline

Definition at line 183 of file qwindowsvistastyle_p.h.

◆ ~QWindowsVistaPulse()

virtual QWindowsVistaPulse::~QWindowsVistaPulse ( )
inlinevirtual

Definition at line 184 of file qwindowsvistastyle_p.h.

184 { }

Functions

◆ duration()

int QWindowsVistaPulse::duration ( ) const
inline

Definition at line 189 of file qwindowsvistastyle_p.h.

189 { return _duration; }

◆ paint()

void QWindowsVistaPulse::paint ( QPainter painter,
const QStyleOption option 
)
virtual

Paints a pulse.

Warning
This function is not part of the public interface. The result will be a mix between the primary and secondary pulse images depending on the time difference between _startTime and current time.

Reimplemented from QWindowsVistaAnimation.

Definition at line 295 of file qwindowsvistastyle.cpp.

296 {
297  float alpha = 1.0;
298  if (_duration > 0) {
299  QTime current = QTime::currentTime();
300 
301  if (_startTime > current)
302  _startTime = current;
303 
304  int timeDiff = _startTime.msecsTo(current) % _duration*2;
305  if (timeDiff > _duration)
306  timeDiff = _duration*2 - timeDiff;
307  alpha = timeDiff/(float)_duration;
308  } else {
309  _running = false;
310  }
311  drawBlendedImage(painter, option->rect, alpha);
312 }
int msecsTo(const QTime &) const
Returns the number of milliseconds from this time to t.
Definition: qdatetime.cpp:1832
void drawBlendedImage(QPainter *painter, QRect rect, float value)
The QTime class provides clock time functions.
Definition: qdatetime.h:148
static QTime currentTime()
Returns the current time as reported by the system clock.
Definition: qdatetime.cpp:3125
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90

◆ setAlternateImage()

void QWindowsVistaPulse::setAlternateImage ( const QImage image)
inline

Definition at line 187 of file qwindowsvistastyle_p.h.

Referenced by QWindowsVistaStyle::drawControl().

187 { _secondaryImage = image; }

◆ setDuration()

void QWindowsVistaPulse::setDuration ( int  duration)
inline

◆ setPrimaryImage()

void QWindowsVistaPulse::setPrimaryImage ( const QImage image)
inline

Definition at line 186 of file qwindowsvistastyle_p.h.

Referenced by QWindowsVistaStyle::drawControl().

186 { _primaryImage = image; }

Properties

◆ _duration

int QWindowsVistaPulse::_duration

Definition at line 190 of file qwindowsvistastyle_p.h.


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