Skip to content

Commit 2d19279

Browse files
committed
qMin/qMax -> std::min/max
1 parent 641d78b commit 2d19279

File tree

151 files changed

+452
-452
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+452
-452
lines changed

src/analysis/interpolation/DualEdgeTriangulation.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ int DualEdgeTriangulation::addPoint( QgsPoint *p )
387387
//Take the higher z-Value in case of two equal points
388388
QgsPoint *newPoint = mPointVector[mPointVector.count() - 1];
389389
QgsPoint *existingPoint = mPointVector[mTwiceInsPoint];
390-
existingPoint->setZ( qMax( newPoint->z(), existingPoint->z() ) );
390+
existingPoint->setZ( std::max( newPoint->z(), existingPoint->z() ) );
391391

392392
mPointVector.remove( mPointVector.count() - 1 );
393393
delete newPoint;

src/analysis/interpolation/MathUtils.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ bool MathUtils::inCircle( QgsPoint *testp, QgsPoint *p1, QgsPoint *p2, QgsPoint
253253
double px = testp->x();
254254
double py = testp->y();
255255

256-
double xmin = qMin( qMin( ax, px ), qMin( bx, cx ) );
257-
double ymin = qMin( qMin( ay, py ), qMin( by, cy ) );
256+
double xmin = std::min( std::min( ax, px ), std::min( bx, cx ) );
257+
double ymin = std::min( std::min( ay, py ), std::min( by, cy ) );
258258
ax -= xmin;
259259
bx -= xmin;
260260
cx -= xmin;

src/analysis/raster/qgshillshadefilter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@ float QgsHillshadeFilter::processNineCellWindow( float *x11, float *x21, float *
4949
{
5050
aspect_rad = M_PI + std::atan2( derX, derY );
5151
}
52-
return qMax( 0.0, 255.0 * ( ( std::cos( zenith_rad ) * std::cos( slope_rad ) ) + ( std::sin( zenith_rad ) * std::sin( slope_rad ) * std::cos( azimuth_rad - aspect_rad ) ) ) );
52+
return std::max( 0.0, 255.0 * ( ( std::cos( zenith_rad ) * std::cos( slope_rad ) ) + ( std::sin( zenith_rad ) * std::sin( slope_rad ) * std::cos( azimuth_rad - aspect_rad ) ) ) );
5353
}

src/analysis/raster/qgskde.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ QgsKernelDensityEstimation::Result QgsKernelDensityEstimation::prepare()
8787
if ( mBounds.isNull() )
8888
return InvalidParameters;
8989

90-
int rows = qMax( std::ceil( mBounds.height() / mPixelSize ) + 1, 1.0 );
91-
int cols = qMax( std::ceil( mBounds.width() / mPixelSize ) + 1, 1.0 );
90+
int rows = std::max( std::ceil( mBounds.height() / mPixelSize ) + 1, 1.0 );
91+
int cols = std::max( std::ceil( mBounds.width() / mPixelSize ) + 1, 1.0 );
9292

9393
if ( !createEmptyLayer( driver, mBounds, rows, cols ) )
9494
return FileCreationError;

src/analysis/vector/qgsgeometrysnapper.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ const QgsSnapIndex::Cell *QgsSnapIndex::GridRow::getCell( int col ) const
233233

234234
QList<QgsSnapIndex::SnapItem *> QgsSnapIndex::GridRow::getSnapItems( int colStart, int colEnd ) const
235235
{
236-
colStart = qMax( colStart, mColStartIdx );
237-
colEnd = qMin( colEnd, mColStartIdx + mCells.size() - 1 );
236+
colStart = std::max( colStart, mColStartIdx );
237+
colEnd = std::min( colEnd, mColStartIdx + mCells.size() - 1 );
238238

239239
QList<SnapItem *> items;
240240

@@ -403,8 +403,8 @@ QgsSnapIndex::SnapItem *QgsSnapIndex::getSnapItem( const QgsPoint &pos, double t
403403
int colEnd = std::floor( ( pos.x() + tol - mOrigin.x() ) / mCellSize );
404404
int rowEnd = std::floor( ( pos.y() + tol - mOrigin.y() ) / mCellSize );
405405

406-
rowStart = qMax( rowStart, mRowsStartIdx );
407-
rowEnd = qMin( rowEnd, mRowsStartIdx + mGridRows.size() - 1 );
406+
rowStart = std::max( rowStart, mRowsStartIdx );
407+
rowEnd = std::min( rowEnd, mRowsStartIdx + mGridRows.size() - 1 );
408408

409409
QList<SnapItem *> items;
410410
for ( int row = rowStart; row <= rowEnd; ++row )

src/analysis/vector/qgszonalstatistics.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ class ANALYSIS_EXPORT QgsZonalStatistics
9898
sum += value;
9999
++count;
100100
}
101-
min = qMin( min, value );
102-
max = qMax( max, value );
101+
min = std::min( min, value );
102+
max = std::max( max, value );
103103
if ( mStoreValueCounts )
104104
valueCount.insert( value, valueCount.value( value, 0 ) + 1 );
105105
if ( mStoreValues )

src/app/nodetool/qgsnodetool.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ void QgsNodeTool::deleteNodeEditorSelection()
976976
if ( mSelectedFeature->geometry()->type() == QgsWkbTypes::LineGeometry )
977977
{
978978
// for lines we don't wrap around vertex selection when deleting nodes from end of line
979-
nextVertexToSelect = qMin( nextVertexToSelect, mSelectedFeature->geometry()->geometry()->nCoordinates() - 1 );
979+
nextVertexToSelect = std::min( nextVertexToSelect, mSelectedFeature->geometry()->geometry()->nCoordinates() - 1 );
980980
}
981981

982982
_safeSelectVertex( *mSelectedFeature, nextVertexToSelect );

src/app/qgsaddattrdialog.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void QgsAddAttrDialog::setPrecisionMinMax()
8686
mPrec->setVisible( minPrecType < maxPrecType );
8787
mPrecLabel->setVisible( minPrecType < maxPrecType );
8888
mPrec->setMinimum( minPrecType );
89-
mPrec->setMaximum( qMax( minPrecType, qMin( maxPrecType, mLength->value() ) ) );
89+
mPrec->setMaximum( std::max( minPrecType, std::min( maxPrecType, mLength->value() ) ) );
9090
}
9191

9292
void QgsAddAttrDialog::accept()

src/app/qgsattributetabledialog.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ void QgsAttributeTableDialog::updateTitle()
344344
QWidget *w = mDock ? qobject_cast<QWidget *>( mDock ) : qobject_cast<QWidget *>( this );
345345
w->setWindowTitle( tr( " %1 :: Features Total: %2, Filtered: %3, Selected: %4" )
346346
.arg( mLayer->name() )
347-
.arg( qMax( static_cast< long >( mMainView->featureCount() ), mLayer->featureCount() ) ) // layer count may be estimated, so use larger of the two
347+
.arg( std::max( static_cast< long >( mMainView->featureCount() ), mLayer->featureCount() ) ) // layer count may be estimated, so use larger of the two
348348
.arg( mMainView->filteredFeatureCount() )
349349
.arg( mLayer->selectedFeatureCount() )
350350
);

src/app/qgsdiagramproperties.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ void QgsDiagramProperties::on_mFindMaximumValueButton_clicked()
593593
while ( features.nextFeature( *&feature ) )
594594
{
595595
context.setFeature( feature );
596-
maxValue = qMax( maxValue, exp.evaluate( &context ).toFloat() );
596+
maxValue = std::max( maxValue, exp.evaluate( &context ).toFloat() );
597597
}
598598
}
599599
else
@@ -689,7 +689,7 @@ void QgsDiagramProperties::apply()
689689
bool ok = false;
690690
double val = provider->maximumValue( fld ).toDouble( &ok );
691691
if ( ok )
692-
maxVal = qMax( maxVal, val );
692+
maxVal = std::max( maxVal, val );
693693
}
694694
}
695695
}

src/app/qgsfieldcalculator.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ void QgsFieldCalculator::setPrecisionMinMax()
481481
int maxPrecType = mOutputFieldTypeComboBox->itemData( idx, Qt::UserRole + 5 ).toInt();
482482
mOutputFieldPrecisionSpinBox->setEnabled( minPrecType < maxPrecType );
483483
mOutputFieldPrecisionSpinBox->setMinimum( minPrecType );
484-
mOutputFieldPrecisionSpinBox->setMaximum( qMax( minPrecType, qMin( maxPrecType, mOutputFieldWidthSpinBox->value() ) ) );
484+
mOutputFieldPrecisionSpinBox->setMaximum( std::max( minPrecType, std::min( maxPrecType, mOutputFieldWidthSpinBox->value() ) ) );
485485
}
486486

487487
void QgsFieldCalculator::showHelp()

src/app/qgsidentifyresultsdialog.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ QSize QgsIdentifyResultsWebView::sizeHint() const
234234
// correct size, see #9377.
235235
int max = widget->size().height() * 0.9;
236236
QgsDebugMsg( QString( "parent widget height = %1 max height = %2" ).arg( widget->size().height() ).arg( max ) );
237-
height = qMin( height, max );
237+
height = std::min( height, max );
238238
}
239239
else
240240
{
@@ -243,7 +243,7 @@ QSize QgsIdentifyResultsWebView::sizeHint() const
243243

244244
// Always keep some minimum size, e.g. if page is not yet loaded
245245
// or parent has wrong size
246-
height = qMax( height, 100 );
246+
height = std::max( height, 100 );
247247

248248
s = QSize( size().width(), height );
249249
QgsDebugMsg( QString( "size: %1 x %2" ).arg( s.width() ).arg( s.height() ) );

src/app/qgsmeasuredialog.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ QString QgsMeasureDialog::formatDistance( double distance, bool convertUnits ) c
281281
// special handling for degrees - because we can't use smaller units (eg m->mm), we need to make sure there's
282282
// enough decimal places to show a usable measurement value
283283
int minPlaces = std::round( std::log10( 1.0 / distance ) ) + 1;
284-
decimals = qMax( decimals, minPlaces );
284+
decimals = std::max( decimals, minPlaces );
285285
}
286286
return QgsDistanceArea::formatDistance( distance, decimals, mDistanceUnits, baseUnit );
287287
}

src/app/qgsrasterlayerproperties.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1281,8 +1281,8 @@ void QgsRasterLayerProperties::adjustTransparencyCellWidth( int row, int column
12811281
QLineEdit *lineEdit = dynamic_cast<QLineEdit *>( tableTransparency->cellWidget( row, column ) );
12821282
if ( !lineEdit ) return;
12831283

1284-
int width = qMax( lineEdit->fontMetrics().width( lineEdit->text() ) + 10, 100 );
1285-
width = qMax( width, tableTransparency->columnWidth( column ) );
1284+
int width = std::max( lineEdit->fontMetrics().width( lineEdit->text() ) + 10, 100 );
1285+
width = std::max( width, tableTransparency->columnWidth( column ) );
12861286

12871287
lineEdit->setFixedWidth( width );
12881288
}
@@ -1850,4 +1850,4 @@ void QgsRasterLayerProperties::onCancel()
18501850
void QgsRasterLayerProperties::showHelp()
18511851
{
18521852
QgsHelp::openHelp( QStringLiteral( "working_with_raster/raster_properties.html" ) );
1853-
}
1853+
}

src/app/qgsrulebasedlabelingwidget.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,8 @@ QgsLabelingRulePropsWidget::QgsLabelingRulePropsWidget( QgsRuleBasedLabeling::Ru
587587
{
588588
groupScale->setChecked( true );
589589
// caution: rule uses scale denom, scale widget uses true scales
590-
mScaleRangeWidget->setMaximumScale( qMax( rule->maximumScale(), 0.0 ) );
591-
mScaleRangeWidget->setMinimumScale( qMax( rule->minimumScale(), 0.0 ) );
590+
mScaleRangeWidget->setMaximumScale( std::max( rule->maximumScale(), 0.0 ) );
591+
mScaleRangeWidget->setMinimumScale( std::max( rule->minimumScale(), 0.0 ) );
592592
}
593593
mScaleRangeWidget->setMapCanvas( mMapCanvas );
594594

src/app/qgsvariantdelegate.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,10 @@ void QgsVariantDelegate::setModelData( QWidget *editor, QAbstractItemModel *mode
190190
break;
191191
case QVariant::Color:
192192
( void )mColorExp.exactMatch( text );
193-
value = QColor( qMin( mColorExp.cap( 1 ).toInt(), 255 ),
194-
qMin( mColorExp.cap( 2 ).toInt(), 255 ),
195-
qMin( mColorExp.cap( 3 ).toInt(), 255 ),
196-
qMin( mColorExp.cap( 4 ).toInt(), 255 ) );
193+
value = QColor( std::min( mColorExp.cap( 1 ).toInt(), 255 ),
194+
std::min( mColorExp.cap( 2 ).toInt(), 255 ),
195+
std::min( mColorExp.cap( 3 ).toInt(), 255 ),
196+
std::min( mColorExp.cap( 4 ).toInt(), 255 ) );
197197
break;
198198
case QVariant::Date:
199199
{

src/app/qgswelcomepageitemsmodel.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ QSize QgsWelcomePageItemDelegate::sizeHint( const QStyleOptionViewItem &option,
117117
index.data( QgsWelcomePageItemsModel::CrsRole ).toString() ) );
118118
doc.setTextWidth( width - ( !icon.isNull() ? icon.width() + 35 : 35 ) );
119119

120-
return QSize( width, qMax( ( double ) doc.size().height() + 10, ( double )icon.height() ) + 20 );
120+
return QSize( width, std::max( ( double ) doc.size().height() + 10, ( double )icon.height() ) + 20 );
121121
}
122122

123123
QgsWelcomePageItemsModel::QgsWelcomePageItemsModel( QObject *parent )

src/core/composer/qgscomposerarrow.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,8 @@ double QgsComposerArrow::computeMarkerMargin() const
380380
}
381381
else if ( mMarkerMode == SVGMarker )
382382
{
383-
double maxArrowHeight = qMax( mStartArrowHeadHeight, mStopArrowHeadHeight );
384-
margin = mPen.widthF() / 2 + qMax( mArrowHeadWidth / 2.0, maxArrowHeight / 2.0 );
383+
double maxArrowHeight = std::max( mStartArrowHeadHeight, mStopArrowHeadHeight );
384+
margin = mPen.widthF() / 2 + std::max( mArrowHeadWidth / 2.0, maxArrowHeight / 2.0 );
385385
}
386386
}
387387
else
@@ -398,8 +398,8 @@ double QgsComposerArrow::computeMarkerMargin() const
398398
{
399399
double startMarkerMargin = std::sqrt( 0.25 * ( mStartArrowHeadHeight * mStartArrowHeadHeight + mArrowHeadWidth * mArrowHeadWidth ) );
400400
double stopMarkerMargin = std::sqrt( 0.25 * ( mStopArrowHeadHeight * mStopArrowHeadHeight + mArrowHeadWidth * mArrowHeadWidth ) );
401-
double markerMargin = qMax( startMarkerMargin, stopMarkerMargin );
402-
margin = qMax( mPen.widthF() / std::sqrt( 2.0 ), markerMargin );
401+
double markerMargin = std::max( startMarkerMargin, stopMarkerMargin );
402+
margin = std::max( mPen.widthF() / std::sqrt( 2.0 ), markerMargin );
403403
}
404404
}
405405
return margin;
@@ -408,7 +408,7 @@ double QgsComposerArrow::computeMarkerMargin() const
408408
void QgsComposerArrow::adaptItemSceneRect()
409409
{
410410
//rectangle containing start and end point
411-
QRectF rect = QRectF( qMin( mStartPoint.x(), mStopPoint.x() ), qMin( mStartPoint.y(), mStopPoint.y() ),
411+
QRectF rect = QRectF( std::min( mStartPoint.x(), mStopPoint.x() ), std::min( mStartPoint.y(), mStopPoint.y() ),
412412
std::fabs( mStopPoint.x() - mStartPoint.x() ), std::fabs( mStopPoint.y() - mStartPoint.y() ) );
413413
double enlarge = computeMarkerMargin();
414414
rect.adjust( -enlarge, -enlarge, enlarge, enlarge );

src/core/composer/qgscomposerattributetablemodelv2.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ bool QgsComposerAttributeTableColumnModelV2::removeRows( int row, int count, con
263263
{
264264
Q_UNUSED( parent );
265265

266-
int maxRow = qMin( row + count - 1, mComposerTable->columns()->length() - 1 );
266+
int maxRow = std::min( row + count - 1, mComposerTable->columns()->length() - 1 );
267267
beginRemoveRows( QModelIndex(), row, maxRow );
268268
//move backwards through rows, removing each corresponding QgsComposerTableColumn
269269
for ( int i = maxRow; i >= row; --i )
@@ -357,7 +357,7 @@ void QgsComposerAttributeTableColumnModelV2::setColumnAsSorted( QgsComposerTable
357357
QList<QgsComposerTableColumn *>::const_iterator columnIt = mComposerTable->columns()->constBegin();
358358
for ( ; columnIt != mComposerTable->columns()->constEnd(); ++columnIt )
359359
{
360-
highestRank = qMax( highestRank, ( *columnIt )->sortByRank() );
360+
highestRank = std::max( highestRank, ( *columnIt )->sortByRank() );
361361
}
362362

363363
column->setSortByRank( highestRank + 1 );

src/core/composer/qgscomposerframe.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ void QgsComposerFrame::setSceneRect( const QRectF &rectangle )
160160

161161
//check minimum size
162162
QSizeF minSize = mMultiFrame->minFrameSize( frameIndex );
163-
fixedRect.setWidth( qMax( minSize.width(), fixedRect.width() ) );
164-
fixedRect.setHeight( qMax( minSize.height(), fixedRect.height() ) );
163+
fixedRect.setWidth( std::max( minSize.width(), fixedRect.width() ) );
164+
fixedRect.setHeight( std::max( minSize.height(), fixedRect.height() ) );
165165
}
166166

167167
QgsComposerItem::setSceneRect( fixedRect );

src/core/composer/qgscomposerhtml.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ double QgsComposerHtml::maxFrameWidth() const
231231
QList<QgsComposerFrame *>::const_iterator frameIt = mFrameItems.constBegin();
232232
for ( ; frameIt != mFrameItems.constEnd(); ++frameIt )
233233
{
234-
maxWidth = qMax( maxWidth, static_cast< double >( ( *frameIt )->boundingRect().width() ) );
234+
maxWidth = std::max( maxWidth, static_cast< double >( ( *frameIt )->boundingRect().width() ) );
235235
}
236236

237237
return maxWidth;
@@ -379,7 +379,7 @@ double QgsComposerHtml::findNearbyPageBreak( double yPos )
379379
bool previousPixelTransparent = false;
380380
QRgb pixelColor;
381381
QList< QPair<int, int> > candidates;
382-
int minRow = qMax( idealPos - maxSearchDistance, 0 );
382+
int minRow = std::max( idealPos - maxSearchDistance, 0 );
383383
for ( int candidateRow = idealPos; candidateRow >= minRow; --candidateRow )
384384
{
385385
changes = 0;

src/core/composer/qgscomposerlabel.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ void QgsComposerLabel::itemShiftAdjustSize( double newWidth, double newHeight, d
609609
QUrl QgsComposerLabel::createStylesheetUrl() const
610610
{
611611
QString stylesheet;
612-
stylesheet += QStringLiteral( "body { margin: %1 %2;" ).arg( qMax( mMarginY * mHtmlUnitsToMM, 0.0 ) ).arg( qMax( mMarginX * mHtmlUnitsToMM, 0.0 ) );
612+
stylesheet += QStringLiteral( "body { margin: %1 %2;" ).arg( std::max( mMarginY * mHtmlUnitsToMM, 0.0 ) ).arg( std::max( mMarginX * mHtmlUnitsToMM, 0.0 ) );
613613
stylesheet += QgsFontUtils::asCSS( mFont, 0.352778 * mHtmlUnitsToMM );
614614
stylesheet += QStringLiteral( "color: %1;" ).arg( mFontColor.name() );
615615
stylesheet += QStringLiteral( "text-align: %1; }" ).arg( mHAlignment == Qt::AlignLeft ? "left" : mHAlignment == Qt::AlignRight ? "right" : "center" );

src/core/composer/qgscomposermap.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1584,10 +1584,10 @@ void QgsComposerMap::updateBoundingRect()
15841584
if ( mGridStack )
15851585
mGridStack->calculateMaxGridExtension( topExtension, rightExtension, bottomExtension, leftExtension );
15861586

1587-
topExtension = qMax( topExtension, frameExtension );
1588-
rightExtension = qMax( rightExtension, frameExtension );
1589-
bottomExtension = qMax( bottomExtension, frameExtension );
1590-
leftExtension = qMax( leftExtension, frameExtension );
1587+
topExtension = std::max( topExtension, frameExtension );
1588+
rightExtension = std::max( rightExtension, frameExtension );
1589+
bottomExtension = std::max( bottomExtension, frameExtension );
1590+
leftExtension = std::max( leftExtension, frameExtension );
15911591

15921592
rectangle.setLeft( rectangle.left() - leftExtension );
15931593
rectangle.setRight( rectangle.right() + rightExtension );

0 commit comments

Comments
 (0)