You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.7 KiB

6 months ago
#ifndef ANIMATIONSTACKEDWIDGET_H
#define ANIMATIONSTACKEDWIDGET_H
#include <QPainter>
#include <QVariant>
#include <QMouseEvent>
#include <QStackedWidget>
#include <QPropertyAnimation>
class AnimationStackedWidget : public QStackedWidget
{
Q_OBJECT
public:
enum AnimationType
{
TopToBottom,
BottomToTop,
LeftToRight,
RightToLeft
};
explicit AnimationStackedWidget(QWidget *parent = 0);
virtual ~AnimationStackedWidget();
virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseMoveEvent(QMouseEvent *event);
virtual void mouseReleaseEvent(QMouseEvent *event);
void start(int index);
void setNext(bool);
void setLength(int length, AnimationType type);
void setWidgets(QList<QWidget*>);
void setPos(QList<QPoint>);
private slots:
void valueChanged(const QVariant &value);
void animationFinished();
signals:
void sigGetWidgets(int);
protected:
virtual void paintEvent(QPaintEvent *event);
void renderPreviousWidget(QPainter &painter, QTransform &transform);
void renderCurrentWidget(QPainter &painter, QTransform &transform);
private:
bool m_isAnimating;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
float m_currentValue;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4BBAF>ֵ
int m_currentIndex, m_previousIndex;//<2F><>ǰ<EFBFBD><C7B0>ǰһ<C7B0><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int m_iWidth;//<2F><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>
bool m_bRight;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>
AnimationType m_type;
QPropertyAnimation *m_animation;//<2F>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>
QPoint m_startPos;//<2F><><EFBFBD><EFBFBD><EAB0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QList<QWidget*> m_lstWs;//С<><D0A1><EFBFBD>ڵ<EFBFBD>ַ
QList<QPoint> m_lstPos;//<2F><><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool m_bUpdate;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD><EFBFBD><EFBFBD>ػ<EFBFBD><D8BB>¼<EFBFBD>
bool m_Oncepress;//ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EAB0B4>ʱ<EFBFBD><CAB1><EFBFBD>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool m_canMove;//<2F><><EFBFBD><EFBFBD><EAB0B4>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>Ч
int m_savePreviousIndex;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>ʱ<EFBFBD><CAB1>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
};
#endif // ANIMATIONSTACKEDWIDGET_H