Skip to content

Commit

Permalink
Thanks clang-tidy!
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Apr 6, 2024
1 parent 9854cc3 commit efb51b8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/core/drawingcanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

#include <cmath>

DrawingCanvas::DrawingCanvas()
: QQuickPaintedItem()
DrawingCanvas::DrawingCanvas( QQuickItem *parent )
: QQuickPaintedItem( parent )
{
setOpaquePainting( true );
}
Expand Down Expand Up @@ -88,7 +88,7 @@ QString DrawingCanvas::save() const
painter.drawImage( 0, 0, mBackgroundImage );
painter.drawImage( 0, 0, mDrawingImage );

const QString path = QStandardPaths::writableLocation( QStandardPaths::TempLocation ) + "/sketch.png";
QString path = QStandardPaths::writableLocation( QStandardPaths::TempLocation ) + "/sketch.png";
image.save( path );

return path;
Expand Down Expand Up @@ -221,7 +221,7 @@ void DrawingCanvas::strokeBegin( const QPointF &point, const QColor color )
{
mCurrentStroke.points.clear();
mCurrentStroke.color = color;
mCurrentStroke.width = 5 / mZoomFactor;
mCurrentStroke.width = DEFAULT_STROKE_WIDTH / mZoomFactor;
mCurrentStroke.points << itemToCanvas( point );
}

Expand Down
4 changes: 3 additions & 1 deletion src/core/drawingcanvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include <QObject>
#include <QQuickPaintedItem>

#define DEFAULT_STROKE_WIDTH 5

class DrawingCanvas : public QQuickPaintedItem
{
Q_OBJECT
Expand Down Expand Up @@ -54,7 +56,7 @@ class DrawingCanvas : public QQuickPaintedItem
Q_PROPERTY( QPointF offset READ offset WRITE setOffset NOTIFY offsetChanged )

public:
DrawingCanvas();
DrawingCanvas( QQuickItem *parent = nullptr );
~DrawingCanvas() = default;

void paint( QPainter *painter ) override;
Expand Down
8 changes: 6 additions & 2 deletions src/core/drawingtemplatemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,19 @@ void DrawingTemplateModel::reloadModel()
int DrawingTemplateModel::rowCount( const QModelIndex &parent ) const
{
if ( !parent.isValid() )
{
return mTemplates.size();
else
return 0;
}

return 0;
}

QVariant DrawingTemplateModel::data( const QModelIndex &index, int role ) const
{
if ( index.row() >= mTemplates.size() || index.row() < 0 )
{
return QVariant();
}

switch ( static_cast<Role>( role ) )
{
Expand Down

0 comments on commit efb51b8

Please sign in to comment.