1
0
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:
krepa098 2015-01-18 12:17:21 +01:00
parent 9df5200fc9
commit 16812633cb
2 changed files with 7 additions and 5 deletions

View File

@ -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();
}

View File

@ -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;
};