Skip to content

Commit ae0e12b

Browse files
committedMar 11, 2019
received all PR suggestions
1 parent 245e5ba commit ae0e12b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
 

‎src/core/layout/qgslayoutaligner.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* *
1515
***************************************************************************/
1616

17-
#include <cmath>
18-
1917
#include "qgslayoutaligner.h"
2018
#include "qgslayoutitem.h"
2119
#include "qgslayout.h"
@@ -126,13 +124,16 @@ void QgsLayoutAligner::distributeItems( QgsLayout *layout, const QList<QgsLayout
126124
case DistributeHSpace:
127125
case DistributeVSpace:
128126
// not reachable branch, just to avoid compilation warning
129-
return nan( "" );
127+
return std::numeric_limits<double>::quiet_NaN();
130128
}
131129
// no warnings
132130
return itemBBox.left();
133131
};
134132

135133

134+
double minCoord = std::numeric_limits<double>::max();
135+
double maxCoord = std::numeric_limits<double>::lowest();
136+
QMap< double, QgsLayoutItem * > itemCoords;
136137
for ( QgsLayoutItem *item : items )
137138
{
138139
double refCoord = collectReferenceCoord( item );
@@ -141,7 +142,7 @@ void QgsLayoutAligner::distributeItems( QgsLayout *layout, const QList<QgsLayout
141142
itemCoords.insert( refCoord, item );
142143
}
143144

144-
step = ( maxCoord - minCoord ) / ( items.size() - 1 );
145+
const double step = ( maxCoord - minCoord ) / ( items.size() - 1 );
145146

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

0 commit comments

Comments
 (0)
Please sign in to comment.