mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Ban deprecated qMin/qMax/etc methods
This commit is contained in:
parent
c705670947
commit
da487e2e34
@ -163,7 +163,7 @@ Qgs3DMapScene::Qgs3DMapScene( const Qgs3DMapSettings &map, Qt3DExtras::QForwardR
|
||||
void Qgs3DMapScene::viewZoomFull()
|
||||
{
|
||||
QgsRectangle extent = mMap.terrainGenerator()->extent();
|
||||
float side = qMax( extent.width(), extent.height() );
|
||||
float side = std::max( extent.width(), extent.height() );
|
||||
mCameraController->resetView( side ); // assuming FOV being 45 degrees
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ QgsChunkedEntity::SceneState _sceneState( QgsCameraController *cameraController
|
||||
state.cameraFov = camera->fieldOfView();
|
||||
state.cameraPos = camera->position();
|
||||
QRect rect = cameraController->viewport();
|
||||
state.screenSizePx = qMax( rect.width(), rect.height() ); // TODO: is this correct?
|
||||
state.screenSizePx = std::max( rect.width(), rect.height() ); // TODO: is this correct?
|
||||
state.viewProjectionMatrix = camera->projectionMatrix() * camera->viewMatrix();
|
||||
return state;
|
||||
}
|
||||
|
@ -44,9 +44,9 @@ bool QgsAABB::intersects( float x, float y, float z ) const
|
||||
|
||||
float QgsAABB::distanceFromPoint( float x, float y, float z ) const
|
||||
{
|
||||
float dx = qMax( xMin - x, qMax( 0.f, x - xMax ) );
|
||||
float dy = qMax( yMin - y, qMax( 0.f, y - yMax ) );
|
||||
float dz = qMax( zMin - z, qMax( 0.f, z - zMax ) );
|
||||
float dx = std::max( xMin - x, std::max( 0.f, x - xMax ) );
|
||||
float dy = std::max( yMin - y, std::max( 0.f, y - yMax ) );
|
||||
float dz = std::max( zMin - z, std::max( 0.f, z - zMax ) );
|
||||
return sqrt( dx * dx + dy * dy + dz * dz );
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ QgsTilingScheme::QgsTilingScheme( const QgsRectangle &fullExtent, const QgsCoord
|
||||
: mCrs( crs )
|
||||
{
|
||||
mMapOrigin = QgsPointXY( fullExtent.xMinimum(), fullExtent.yMinimum() );
|
||||
mBaseTileSide = qMax( fullExtent.width(), fullExtent.height() );
|
||||
mBaseTileSide = std::max( fullExtent.width(), fullExtent.height() );
|
||||
}
|
||||
|
||||
QgsPointXY QgsTilingScheme::tileToMap( int x, int y, int z ) const
|
||||
|
@ -44,8 +44,8 @@ static void _heightMapMinMax( const QByteArray &heightMap, float &zMin, float &z
|
||||
zMin = zMax = z;
|
||||
first = false;
|
||||
}
|
||||
zMin = qMin( zMin, z );
|
||||
zMax = qMax( zMax, z );
|
||||
zMin = std::min( zMin, z );
|
||||
zMax = std::max( zMax, z );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ bool gzipDecompress( QByteArray input, QByteArray &output )
|
||||
do
|
||||
{
|
||||
// Determine current chunk size
|
||||
int chunk_size = qMin( GZIP_CHUNK_SIZE, input_data_left );
|
||||
int chunk_size = std::min( GZIP_CHUNK_SIZE, input_data_left );
|
||||
|
||||
// Check for termination
|
||||
if ( chunk_size <= 0 )
|
||||
|
@ -10675,7 +10675,7 @@ void QgisApp::new3DMapCanvas()
|
||||
dock->setMapSettings( map );
|
||||
|
||||
QgsRectangle extent = mMapCanvas->extent();
|
||||
float dist = qMax( extent.width(), extent.height() );
|
||||
float dist = std::max( extent.width(), extent.height() );
|
||||
dock->mapCanvas3D()->setViewFromTop( mMapCanvas->extent().center(), dist, mMapCanvas->rotation() );
|
||||
}
|
||||
#endif
|
||||
|
@ -92,7 +92,7 @@ void QgsPuzzleWidget::mousePressEvent( QMouseEvent *event )
|
||||
int dx = cMouse - cEmpty;
|
||||
int dy = rMouse - rEmpty;
|
||||
|
||||
if ( ( dx == 0 && qAbs( dy ) == 1 ) || ( dy == 0 && qAbs( dx ) == 1 ) )
|
||||
if ( ( dx == 0 && std::abs( dy ) == 1 ) || ( dy == 0 && std::abs( dx ) == 1 ) )
|
||||
{
|
||||
std::swap( mPositions[idxEmpty], mPositions[idxMouse] );
|
||||
updateTilePositions();
|
||||
|
@ -165,7 +165,7 @@ bool QgsMeshVectorRenderer::calcVectorLineEnd(
|
||||
// Flip the Y axis (pixel vs real-world axis)
|
||||
yDist *= -1.0;
|
||||
|
||||
if ( qAbs( xDist ) < 1 && qAbs( yDist ) < 1 )
|
||||
if ( std::abs( xDist ) < 1 && std::abs( yDist ) < 1 )
|
||||
return true;
|
||||
|
||||
// Determine the line coords
|
||||
|
@ -236,7 +236,7 @@ void QgsValueRelationWidgetWrapper::setFeature( const QgsFeature &feature )
|
||||
|
||||
int QgsValueRelationWidgetWrapper::columnCount() const
|
||||
{
|
||||
return qMax( 1, config( QStringLiteral( "NofColumns" ) ).toInt() );
|
||||
return std::max( 1, config( QStringLiteral( "NofColumns" ) ).toInt() );
|
||||
}
|
||||
|
||||
void QgsValueRelationWidgetWrapper::populate( )
|
||||
|
@ -124,7 +124,7 @@ void QgsFilterAlgorithmConfigurationWidget::removeSelectedOutputs()
|
||||
rows.append( index.row() );
|
||||
}
|
||||
|
||||
qSort( rows );
|
||||
std::sort( rows );
|
||||
|
||||
int prev = -1;
|
||||
for ( int i = rows.count() - 1; i >= 0; i -= 1 )
|
||||
|
@ -155,7 +155,7 @@ void QgsGlobeTileUpdateManager::addTile( QgsGlobeTileImage *tile )
|
||||
#ifdef GLOBE_SHOW_TILE_STATS
|
||||
QgsGlobeTileStatistics::instance()->updateQueueTileCount( mTileQueue.size() );
|
||||
#endif
|
||||
qSort( mTileQueue.begin(), mTileQueue.end(), QgsGlobeTileImage::lodSort );
|
||||
std::sort( mTileQueue.begin(), mTileQueue.end(), QgsGlobeTileImage::lodSort );
|
||||
}
|
||||
emit startRendering();
|
||||
}
|
||||
|
@ -1250,7 +1250,7 @@ bool QgsOracleProvider::addFeatures( QgsFeatureList &flist, QgsFeatureSink::Flag
|
||||
|
||||
// look for unique attribute values to place in statement instead of passing as parameter
|
||||
// e.g. for defaults
|
||||
for ( int idx = 0; idx < qMin( attributevec.size(), mAttributeFields.size() ); ++idx )
|
||||
for ( int idx = 0; idx < std::min( attributevec.size(), mAttributeFields.size() ); ++idx )
|
||||
{
|
||||
QVariant v = attributevec[idx];
|
||||
if ( !v.isValid() )
|
||||
@ -1560,7 +1560,7 @@ bool QgsOracleProvider::deleteAttributes( const QgsAttributeIds &ids )
|
||||
qry.finish();
|
||||
|
||||
QList<int> idsList = ids.values();
|
||||
qSort( idsList.begin(), idsList.end(), qGreater<int>() );
|
||||
std::sort( idsList.begin(), idsList.end(), qGreater<int>() );
|
||||
|
||||
Q_FOREACH ( int id, idsList )
|
||||
{
|
||||
|
@ -23,6 +23,21 @@ HINTS[4]="Use the type-safe method std::numeric_limits<int>::min() instead"
|
||||
KEYWORDS[5]="INT_MAX"
|
||||
HINTS[5]="Use the type-safe method std::numeric_limits<int>::max() instead"
|
||||
|
||||
KEYWORDS[6]="\bqMin("
|
||||
HINTS[6]="Use std::min instead"
|
||||
|
||||
KEYWORDS[7]="\bqMax("
|
||||
HINTS[7]="Use std::max instead"
|
||||
|
||||
KEYWORDS[8]="\bqAbs("
|
||||
HINTS[8]="Use std::fabs instead"
|
||||
|
||||
KEYWORDS[9]="\bqRound("
|
||||
HINTS[9]="Use std::round instead"
|
||||
|
||||
KEYWORDS[10]="\bqSort("
|
||||
HINTS[10]="Use std::sort instead"
|
||||
|
||||
RES=
|
||||
DIR=$(git rev-parse --show-toplevel)
|
||||
|
||||
@ -30,7 +45,7 @@ pushd "${DIR}" > /dev/null || exit
|
||||
|
||||
for i in "${!KEYWORDS[@]}"
|
||||
do
|
||||
FOUND=$(git grep "${KEYWORDS[$i]}" -- 'src/*.h' 'src/*.cpp')
|
||||
FOUND=$(git grep "${KEYWORDS[$i]}" -- 'src/*.h' 'src/*.cpp' -- ':!*qtermwidget*')
|
||||
|
||||
if [[ ${FOUND} ]]; then
|
||||
echo "Found source files with banned keyword: ${KEYWORDS[$i]}!"
|
||||
|
Loading…
x
Reference in New Issue
Block a user