TTKMusicPlayer  4.3.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
Public Types | Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
MusicAnimationStackedWidget Class Reference

The class of the statckwidget switch animation. More...

#include <musicanimationstackedwidget.h>

+ Inheritance diagram for MusicAnimationStackedWidget:

Public Types

enum  Module { Module::LeftToRight, Module::RightToLeft, Module::TopToBottom, Module::BottomToTop }
 

Public Member Functions

 MusicAnimationStackedWidget (QWidget *parent=nullptr)
 
 ~MusicAnimationStackedWidget ()
 
void start (int current)
 
void start (int previous, int current)
 
void setLength (int length, Module type)
 
int previousIndex () const noexcept
 
int currentIndex () const noexcept
 
void setDuration (int duration)
 
int duration () const
 

Private Slots

void valueChanged (const QVariant &value)
 
void animationFinished ()
 

Private Member Functions

virtual void paintEvent (QPaintEvent *event) overridefinal
 
void renderPreviousWidget (QPainter *painter)
 
void renderCurrentWidget (QPainter *painter)
 

Private Attributes

bool m_isAnimating
 
float m_currentValue
 
int m_currentIndex
 
int m_previousIndex
 
Module m_type
 
QPropertyAnimation * m_animation
 

Detailed Description

The class of the statckwidget switch animation.

Author
Greedysky greed.nosp@m.ysky.nosp@m.@163..nosp@m.com

Definition at line 29 of file musicanimationstackedwidget.h.

Member Enumeration Documentation

Enumerator
LeftToRight 

Animation from left to right

RightToLeft 

Animation from right to left

TopToBottom 

Animation from top to bottom

BottomToTop 

Animation from bottom to top

Definition at line 33 of file musicanimationstackedwidget.h.

Constructor & Destructor Documentation

MusicAnimationStackedWidget::MusicAnimationStackedWidget ( QWidget *  parent = nullptr)
explicit

Object constructor.

Definition at line 5 of file musicanimationstackedwidget.cpp.

References animationFinished(), m_animation, and valueChanged().

MusicAnimationStackedWidget::~MusicAnimationStackedWidget ( )

Object destructor.

Definition at line 23 of file musicanimationstackedwidget.cpp.

References m_animation.

Member Function Documentation

void MusicAnimationStackedWidget::animationFinished ( )
privateslot

Animation finished.

Definition at line 146 of file musicanimationstackedwidget.cpp.

References m_currentIndex, m_currentValue, and m_isAnimating.

Referenced by MusicAnimationStackedWidget().

int MusicAnimationStackedWidget::currentIndex ( ) const
noexcept

Get current index.

Definition at line 125 of file musicanimationstackedwidget.cpp.

References m_currentIndex.

int MusicAnimationStackedWidget::duration ( ) const

Get animation duration.

Definition at line 135 of file musicanimationstackedwidget.cpp.

References m_animation.

void MusicAnimationStackedWidget::paintEvent ( QPaintEvent *  event)
finaloverrideprivatevirtual

Override the widget event.

Definition at line 28 of file musicanimationstackedwidget.cpp.

References m_isAnimating, renderCurrentWidget(), and renderPreviousWidget().

int MusicAnimationStackedWidget::previousIndex ( ) const
noexcept

Get previoud index.

Definition at line 120 of file musicanimationstackedwidget.cpp.

References m_previousIndex.

void MusicAnimationStackedWidget::renderCurrentWidget ( QPainter *  painter)
private

Render current widget.

Definition at line 64 of file musicanimationstackedwidget.cpp.

References BottomToTop, LeftToRight, m_currentIndex, m_type, RightToLeft, and TopToBottom.

Referenced by paintEvent().

void MusicAnimationStackedWidget::renderPreviousWidget ( QPainter *  painter)
private

Render previous widget.

Definition at line 43 of file musicanimationstackedwidget.cpp.

References BottomToTop, LeftToRight, m_currentValue, m_previousIndex, m_type, RightToLeft, and TopToBottom.

Referenced by paintEvent().

void MusicAnimationStackedWidget::setDuration ( int  duration)

Set animation duration.

Definition at line 130 of file musicanimationstackedwidget.cpp.

References m_animation.

void MusicAnimationStackedWidget::setLength ( int  length,
Module  type 
)

Set animation start and end pos distance and animation type.

Definition at line 113 of file musicanimationstackedwidget.cpp.

References m_animation, and m_type.

void MusicAnimationStackedWidget::start ( int  current)

Start to anmiation by current index.

Definition at line 83 of file musicanimationstackedwidget.cpp.

References m_currentIndex.

Referenced by MusicConnectLocalWidget::changeStatckedWidgetFirst(), and MusicConnectLocalWidget::changeStatckedWidgetSecond().

void MusicAnimationStackedWidget::start ( int  previous,
int  current 
)

Start to anmiation by previoud and current index.

Definition at line 88 of file musicanimationstackedwidget.cpp.

References m_animation, m_currentIndex, m_isAnimating, and m_previousIndex.

void MusicAnimationStackedWidget::valueChanged ( const QVariant &  value)
privateslot

Animation value changed.

Definition at line 140 of file musicanimationstackedwidget.cpp.

References m_currentValue.

Referenced by MusicAnimationStackedWidget().

Member Data Documentation

QPropertyAnimation* MusicAnimationStackedWidget::m_animation
private
int MusicAnimationStackedWidget::m_currentIndex
private
float MusicAnimationStackedWidget::m_currentValue
private
bool MusicAnimationStackedWidget::m_isAnimating
private

Definition at line 106 of file musicanimationstackedwidget.h.

Referenced by animationFinished(), paintEvent(), and start().

int MusicAnimationStackedWidget::m_previousIndex
private

Definition at line 108 of file musicanimationstackedwidget.h.

Referenced by previousIndex(), renderPreviousWidget(), and start().

Module MusicAnimationStackedWidget::m_type
private

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