Fix clang-tidy warning

This commit is contained in:
Nyall Dawson 2024-08-05 08:54:45 +10:00
parent 5b084d39f4
commit dbafe6c702
4 changed files with 17 additions and 17 deletions

View File

@ -121,7 +121,7 @@ Set to an invalid color to avoid drawing the secondary stroke.
Returns the current secondary stroke color. Returns the current secondary stroke color.
%End %End
void setWidth( int width ); void setWidth( double width );
%Docstring %Docstring
Sets the width of the line. Stroke width for polygon. Sets the width of the line. Stroke width for polygon.
@ -157,12 +157,12 @@ Calling this function automatically calls setIcon(ICON_SVG)
Returns the current icon type to highlight point geometries. Returns the current icon type to highlight point geometries.
%End %End
void setIconSize( int iconSize ); void setIconSize( double iconSize );
%Docstring %Docstring
Sets the size of the point icons Sets the size of the point icons
%End %End
int iconSize() const; double iconSize() const;
%Docstring %Docstring
Returns the current icon size of the point icons. Returns the current icon size of the point icons.
%End %End

View File

@ -121,7 +121,7 @@ Set to an invalid color to avoid drawing the secondary stroke.
Returns the current secondary stroke color. Returns the current secondary stroke color.
%End %End
void setWidth( int width ); void setWidth( double width );
%Docstring %Docstring
Sets the width of the line. Stroke width for polygon. Sets the width of the line. Stroke width for polygon.
@ -157,12 +157,12 @@ Calling this function automatically calls setIcon(ICON_SVG)
Returns the current icon type to highlight point geometries. Returns the current icon type to highlight point geometries.
%End %End
void setIconSize( int iconSize ); void setIconSize( double iconSize );
%Docstring %Docstring
Sets the size of the point icons Sets the size of the point icons
%End %End
int iconSize() const; double iconSize() const;
%Docstring %Docstring
Returns the current icon size of the point icons. Returns the current icon size of the point icons.
%End %End

View File

@ -75,9 +75,9 @@ void QgsRubberBand::setSecondaryStrokeColor( const QColor &color )
mSecondaryPen.setColor( color ); mSecondaryPen.setColor( color );
} }
void QgsRubberBand::setWidth( int width ) void QgsRubberBand::setWidth( double width )
{ {
mPen.setWidth( width ); mPen.setWidthF( width );
} }
void QgsRubberBand::setIcon( IconType icon ) void QgsRubberBand::setIcon( IconType icon )
@ -92,7 +92,7 @@ void QgsRubberBand::setSvgIcon( const QString &path, QPoint drawOffset )
mSvgOffset = drawOffset; mSvgOffset = drawOffset;
} }
void QgsRubberBand::setIconSize( int iconSize ) void QgsRubberBand::setIconSize( double iconSize )
{ {
mIconSize = iconSize; mIconSize = iconSize;
} }
@ -508,7 +508,7 @@ void QgsRubberBand::paint( QPainter *p )
if ( i == 0 && iterations > 1 ) if ( i == 0 && iterations > 1 )
{ {
// first iteration with multi-pen painting, so use secondary pen // first iteration with multi-pen painting, so use secondary pen
mSecondaryPen.setWidth( mPen.width() + QgsGuiUtils::scaleIconSize( 2 ) ); mSecondaryPen.setWidthF( mPen.widthF() + QgsGuiUtils::scaleIconSize( 2 ) );
p->setBrush( Qt::NoBrush ); p->setBrush( Qt::NoBrush );
p->setPen( mSecondaryPen ); p->setPen( mSecondaryPen );
} }
@ -587,11 +587,11 @@ void QgsRubberBand::drawShape( QPainter *p, const QVector<QPointF> &pts )
break; break;
case ICON_FULL_BOX: case ICON_FULL_BOX:
p->drawRect( static_cast< int>( x - s ), static_cast< int >( y - s ), mIconSize, mIconSize ); p->drawRect( QRectF( static_cast< int>( x - s ), static_cast< int >( y - s ), mIconSize, mIconSize ) );
break; break;
case ICON_CIRCLE: case ICON_CIRCLE:
p->drawEllipse( static_cast< int >( x - s ), static_cast< int >( y - s ), mIconSize, mIconSize ); p->drawEllipse( QRectF( static_cast< int >( x - s ), static_cast< int >( y - s ), mIconSize, mIconSize ) );
break; break;
case ICON_DIAMOND: case ICON_DIAMOND:
@ -654,7 +654,7 @@ void QgsRubberBand::updateRect()
} }
#endif #endif
qreal w = ( ( mIconSize - 1 ) / 2 + mPen.width() ); // in canvas units qreal w = ( ( mIconSize - 1 ) / 2 + mPen.widthF() ); // in canvas units
QgsRectangle r; // in canvas units QgsRectangle r; // in canvas units
for ( const QgsPolygonXY &poly : std::as_const( mPoints ) ) for ( const QgsPolygonXY &poly : std::as_const( mPoints ) )

View File

@ -187,7 +187,7 @@ class GUI_EXPORT QgsRubberBand : public QgsMapCanvasItem
* Sets the width of the line. Stroke width for polygon. * Sets the width of the line. Stroke width for polygon.
* \param width The width for any lines painted for this rubberband * \param width The width for any lines painted for this rubberband
*/ */
void setWidth( int width ); void setWidth( double width );
/** /**
* Returns the current width of the line or stroke width for polygon. * Returns the current width of the line or stroke width for polygon.
@ -218,12 +218,12 @@ class GUI_EXPORT QgsRubberBand : public QgsMapCanvasItem
/** /**
* Sets the size of the point icons * Sets the size of the point icons
*/ */
void setIconSize( int iconSize ); void setIconSize( double iconSize );
/** /**
* Returns the current icon size of the point icons. * Returns the current icon size of the point icons.
*/ */
int iconSize() const { return mIconSize; } double iconSize() const { return mIconSize; }
/** /**
* Sets the style of the line * Sets the style of the line
@ -449,7 +449,7 @@ class GUI_EXPORT QgsRubberBand : public QgsMapCanvasItem
QPen mSecondaryPen; QPen mSecondaryPen;
//! The size of the icon for points. //! The size of the icon for points.
int mIconSize = 5; double mIconSize = 5;
//! Icon to be shown. //! Icon to be shown.
IconType mIconType = ICON_CIRCLE; IconType mIconType = ICON_CIRCLE;