mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
extended spinner class
This commit is contained in:
parent
9df5200fc9
commit
16812633cb
|
@ -19,10 +19,11 @@
|
|||
#include <QPainter>
|
||||
#include <QDebug>
|
||||
|
||||
Spinner::Spinner(QSizeF Size)
|
||||
Spinner::Spinner(const QString &img, QSizeF Size, qreal speed)
|
||||
: size(Size)
|
||||
, rotSpeed(speed)
|
||||
{
|
||||
pmap.load(":/ui/chatArea/spinner.png");
|
||||
pmap.load(img);
|
||||
|
||||
timer.setInterval(33); // 30Hz
|
||||
timer.setSingleShot(false);
|
||||
|
@ -77,6 +78,6 @@ qreal Spinner::getAscent() const
|
|||
|
||||
void Spinner::timeout()
|
||||
{
|
||||
rot += 8;
|
||||
rot += rotSpeed;
|
||||
update();
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ class Spinner : public QObject, public ChatLineContent
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Spinner(QSizeF size);
|
||||
Spinner(const QString& img, QSizeF size, qreal speed);
|
||||
|
||||
virtual QRectF boundingRect() const override;
|
||||
virtual QRectF boundingSceneRect() const override;
|
||||
|
@ -41,7 +41,8 @@ private slots:
|
|||
private:
|
||||
QSizeF size;
|
||||
QPixmap pmap;
|
||||
qreal rot;
|
||||
qreal rot = 0.0;
|
||||
qreal rotSpeed;
|
||||
QTimer timer;
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user