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

#include <qwindowsvistastyle_p.h>

Inheritance diagram for QWindowsVistaTransition:
QWindowsVistaAnimation

Public Functions

int duration () const
 
virtual void paint (QPainter *painter, const QStyleOption *option)
 Paints a transition state. More...
 
 QWindowsVistaTransition ()
 
void setDuration (int duration)
 
void setEndImage (const QImage &image)
 
void setStartImage (const QImage &image)
 
virtual ~QWindowsVistaTransition ()
 
- 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 165 of file qwindowsvistastyle_p.h.

Constructors and Destructors

◆ QWindowsVistaTransition()

QWindowsVistaTransition::QWindowsVistaTransition ( )
inline

Definition at line 168 of file qwindowsvistastyle_p.h.

◆ ~QWindowsVistaTransition()

virtual QWindowsVistaTransition::~QWindowsVistaTransition ( )
inlinevirtual

Definition at line 169 of file qwindowsvistastyle_p.h.

169 { }

Functions

◆ duration()

int QWindowsVistaTransition::duration ( ) const
inline

Definition at line 174 of file qwindowsvistastyle_p.h.

◆ paint()

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

Paints a transition state.

Warning
This function is not part of the public interface. The result will be a mix between the initial and final state of the transition, depending on the time difference between _startTime and current time.

Reimplemented from QWindowsVistaAnimation.

Definition at line 265 of file qwindowsvistastyle.cpp.

266 {
267  float alpha = 1.0;
268  if (_duration > 0) {
269  QTime current = QTime::currentTime();
270 
271  if (_startTime > current)
272  _startTime = current;
273 
274  int timeDiff = _startTime.msecsTo(current);
275  alpha = timeDiff/(float)_duration;
276  if (timeDiff > _duration) {
277  _running = false;
278  alpha = 1.0;
279  }
280  }
281  else {
282  _running = false;
283  }
284  drawBlendedImage(painter, option->rect, alpha);
285 }
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

◆ setDuration()

void QWindowsVistaTransition::setDuration ( int  duration)
inline

◆ setEndImage()

void QWindowsVistaTransition::setEndImage ( const QImage image)
inline

◆ setStartImage()

void QWindowsVistaTransition::setStartImage ( const QImage image)
inline

Properties

◆ _duration

int QWindowsVistaTransition::_duration

Definition at line 175 of file qwindowsvistastyle_p.h.


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