Merge pull request #39 from MartinDelille/fix-warnings

Fix warnings nullptr / floats
This commit is contained in:
Rick Blommers 2021-12-07 12:18:14 +01:00 committed by GitHub
commit 5283c11a12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

View File

@ -826,7 +826,7 @@ Q_OBJECT
public: public:
explicit QtAwesome(QObject *parent = 0); explicit QtAwesome(QObject *parent = QTAWESOME_NULL);
virtual ~QtAwesome(); virtual ~QtAwesome();
void init( const QString& fontname ); void init( const QString& fontname );

View File

@ -9,7 +9,7 @@
QtAwesomeAnimation::QtAwesomeAnimation(QWidget *parentWidget, int interval, int step) QtAwesomeAnimation::QtAwesomeAnimation(QWidget *parentWidget, int interval, int step)
: parentWidgetRef_( parentWidget ) : parentWidgetRef_( parentWidget )
, timer_( 0 ) , timer_( QTAWESOME_NULL )
, interval_( interval ) , interval_( interval )
, step_( step ) , step_( step )
, angle_( 0.0f ) , angle_( 0.0f )
@ -29,8 +29,8 @@ void QtAwesomeAnimation::setup( QPainter &painter, const QRect &rect)
else else
{ {
//timer, angle, self.step = self.info[self.parent_widget] //timer, angle, self.step = self.info[self.parent_widget]
float x_center = rect.width() * 0.5; float x_center = rect.width() * 0.5f;
float y_center = rect.height() * 0.5; float y_center = rect.height() * 0.5f;
painter.translate(x_center, y_center); painter.translate(x_center, y_center);
painter.rotate(angle_); painter.rotate(angle_);
painter.translate(-x_center, -y_center); painter.translate(-x_center, -y_center);

View File

@ -1,6 +1,12 @@
#ifndef QTAWESOMEANIMATION_H #ifndef QTAWESOMEANIMATION_H
#define QTAWESOMEANIMATION_H #define QTAWESOMEANIMATION_H
#if __cplusplus <= 199711L
#define QTAWESOME_NULL NULL
#else
#define QTAWESOME_NULL nullptr
#endif
#include <QObject> #include <QObject>
class QPainter; class QPainter;