Skip to content

Commit

Permalink
Fix qreal vs double.
Browse files Browse the repository at this point in the history
In qt4 on arm architectures qreal is defined as float while on other
architectures it is defined as double. This can cause problems if qreal
and double are carelessly mixed.

In this particular case the problem is that qMin/qMax are templates defined
to take two parameters of the same type. If two different types are passed
in then C++ can't resolve what type the template parameter should be and
bails out. The fix is simple, typecast one of the parameters so they
match.

Author: Peter Michael Green <plugwash@debian.org>
Bug-Debian: http://bugs.debian.org/737814
  • Loading branch information
sebastic committed Mar 28, 2014
1 parent 03b028d commit 7db6ae5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/gps/qwtpolar-1.0/qwt_polar_curve.cpp
Expand Up @@ -433,7 +433,7 @@ void QwtPolarCurve::drawLines( QPainter *painter,

if ( !clipRect.isEmpty() )
{
double off = qCeil( qMax( 1.0, painter->pen().widthF() ) );
double off = qCeil( qMax((qreal)1.0,painter->pen().widthF() ) );
clipRect = clipRect.toRect().adjusted( -off, -off, off, off );
polyline = QwtClipper::clipPolygonF( clipRect, polyline );
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/gps/qwtpolar-1.0/qwt_polar_layout.cpp
Expand Up @@ -278,7 +278,7 @@ QRectF QwtPolarLayout::layoutLegend( Options options, QRectF &rect ) const
// We don't allow vertical legends to take more than
// half of the available space.

dim = qMin( hint.width(), rect.width() * d_data->legendRatio );
dim = qMin( hint.width(), (qreal)(rect.width() * d_data->legendRatio) );

if ( !( options & IgnoreScrollbars ) )
{
Expand All @@ -293,7 +293,7 @@ QRectF QwtPolarLayout::layoutLegend( Options options, QRectF &rect ) const
}
else
{
dim = qMin( hint.height(), rect.height() * d_data->legendRatio );
dim = qMin( hint.height(), (qreal)(rect.height() * d_data->legendRatio) );
dim = qMax( dim, d_data->layoutData.legend.hScrollBarHeight );
}

Expand Down

0 comments on commit 7db6ae5

Please sign in to comment.