Skip to content

Commit

Permalink
received all PR suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
nastasi-oq committed Mar 11, 2019
1 parent 245e5ba commit ae0e12b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/core/layout/qgslayoutaligner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* *
***************************************************************************/

#include <cmath>

#include "qgslayoutaligner.h"
#include "qgslayoutitem.h"
#include "qgslayout.h"
Expand Down Expand Up @@ -126,13 +124,16 @@ void QgsLayoutAligner::distributeItems( QgsLayout *layout, const QList<QgsLayout
case DistributeHSpace:
case DistributeVSpace:
// not reachable branch, just to avoid compilation warning
return nan( "" );
return std::numeric_limits<double>::quiet_NaN();
}
// no warnings
return itemBBox.left();
};


double minCoord = std::numeric_limits<double>::max();
double maxCoord = std::numeric_limits<double>::lowest();
QMap< double, QgsLayoutItem * > itemCoords;
for ( QgsLayoutItem *item : items )
{
double refCoord = collectReferenceCoord( item );
Expand All @@ -141,7 +142,7 @@ void QgsLayoutAligner::distributeItems( QgsLayout *layout, const QList<QgsLayout
itemCoords.insert( refCoord, item );
}

step = ( maxCoord - minCoord ) / ( items.size() - 1 );
const double step = ( maxCoord - minCoord ) / ( items.size() - 1 );

auto distributeItemToCoord = [layout, distribution]( QgsLayoutItem * item, double refCoord )
{
Expand Down

0 comments on commit ae0e12b

Please sign in to comment.