Skip to content
Permalink
Browse files
Fix qreal vs double.
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 7db6ae54124a2f2213c0609490904653c6c798af
Showing with 3 additions and 3 deletions.
  1. +1 −1 src/app/gps/qwtpolar-1.0/qwt_polar_curve.cpp
  2. +2 −2 src/app/gps/qwtpolar-1.0/qwt_polar_layout.cpp
@@ -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 );
}
@@ -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 ) )
{
@@ -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 );
}

0 comments on commit 7db6ae5

Please sign in to comment.