mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Replace deprecated qSort/qStableSort/qGreater/qLess with std:: algs
This commit is contained in:
parent
8408777448
commit
3ed6f5b72a
@ -233,7 +233,7 @@ void QgsVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, const
|
||||
|
||||
QgsPointCompare pointCompare( builder->topologyTolerance() );
|
||||
|
||||
qSort( points.begin(), points.end(), pointCompare );
|
||||
std::sort( points.begin(), points.end(), pointCompare );
|
||||
QVector< QgsPoint >::iterator tmp = std::unique( points.begin(), points.end() );
|
||||
points.resize( tmp - points.begin() );
|
||||
|
||||
@ -243,7 +243,7 @@ void QgsVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, const
|
||||
for ( i = 0; i < snappedPoints.size() ; ++i )
|
||||
snappedPoints[ i ] = *( my_binary_search( points.begin(), points.end(), snappedPoints[ i ], pointCompare ) );
|
||||
|
||||
qSort( pointLengthMap.begin(), pointLengthMap.end(), TiePointInfoCompare );
|
||||
std::sort( pointLengthMap.begin(), pointLengthMap.end(), TiePointInfoCompare );
|
||||
|
||||
{
|
||||
// fill attribute list 'la'
|
||||
@ -264,7 +264,7 @@ void QgsVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, const
|
||||
tmpAttr.push_back( *it2 );
|
||||
}
|
||||
}
|
||||
qSort( tmpAttr.begin(), tmpAttr.end() );
|
||||
std::sort( tmpAttr.begin(), tmpAttr.end() );
|
||||
|
||||
int lastAttrId = -1;
|
||||
for ( it2 = tmpAttr.begin(); it2 != tmpAttr.end(); ++it2 )
|
||||
|
@ -277,7 +277,7 @@ int QgsZonalStatistics::calculateStatistics( QProgressDialog* p )
|
||||
changeAttributeMap.insert( meanIndex, QVariant( mean ) );
|
||||
if ( mStatistics & QgsZonalStatistics::Median )
|
||||
{
|
||||
qSort( featureStats.values.begin(), featureStats.values.end() );
|
||||
std::sort( featureStats.values.begin(), featureStats.values.end() );
|
||||
int size = featureStats.values.count();
|
||||
bool even = ( size % 2 ) < 1;
|
||||
double medianValue;
|
||||
@ -311,7 +311,7 @@ int QgsZonalStatistics::calculateStatistics( QProgressDialog* p )
|
||||
if ( mStatistics & QgsZonalStatistics::Minority || mStatistics & QgsZonalStatistics::Majority )
|
||||
{
|
||||
QList<int> vals = featureStats.valueCount.values();
|
||||
qSort( vals.begin(), vals.end() );
|
||||
std::sort( vals.begin(), vals.end() );
|
||||
if ( mStatistics & QgsZonalStatistics::Minority )
|
||||
{
|
||||
float minorityKey = featureStats.valueCount.key( vals.first() );
|
||||
|
@ -3984,7 +3984,7 @@ void QgsComposer::populatePrintComposersMenu()
|
||||
if ( acts.size() > 1 )
|
||||
{
|
||||
// sort actions in case main app's aboutToShow slot has not yet
|
||||
qSort( acts.begin(), acts.end(), cmpByText_ );
|
||||
std::sort( acts.begin(), acts.end(), cmpByText_ );
|
||||
}
|
||||
mPrintComposersMenu->addActions( acts );
|
||||
}
|
||||
|
@ -726,7 +726,7 @@ void QgsComposerLegendWidget::on_mRemoveToolButton_clicked()
|
||||
Q_FOREACH ( QgsLayerTreeLayer* nodeLayer, nodesWithRemoval.keys() )
|
||||
{
|
||||
QList<int> toDelete = nodesWithRemoval[nodeLayer];
|
||||
qSort( toDelete.begin(), toDelete.end(), qGreater<int>() );
|
||||
std::sort( toDelete.begin(), toDelete.end(), std::greater<int>() );
|
||||
QList<int> order = QgsMapLayerLegendUtils::legendNodeOrder( nodeLayer );
|
||||
|
||||
Q_FOREACH ( int i, toDelete )
|
||||
|
@ -1553,7 +1553,7 @@ void QgisApp::readSettings()
|
||||
{
|
||||
projectKeys.append( key.toInt() );
|
||||
}
|
||||
qSort( projectKeys );
|
||||
std::sort( projectKeys.begin(), projectKeys.end() );
|
||||
|
||||
Q_FOREACH ( int key, projectKeys )
|
||||
{
|
||||
@ -2108,7 +2108,7 @@ void QgisApp::createToolBars()
|
||||
}
|
||||
|
||||
// sort actions in toolbar menu
|
||||
qSort( toolbarMenuActions.begin(), toolbarMenuActions.end(), cmpByText_ );
|
||||
std::sort( toolbarMenuActions.begin(), toolbarMenuActions.end(), cmpByText_ );
|
||||
|
||||
mToolbarMenu->addActions( toolbarMenuActions );
|
||||
|
||||
@ -6930,7 +6930,7 @@ void QgisApp::on_mPrintComposersMenu_aboutToShow()
|
||||
if ( acts.size() > 1 )
|
||||
{
|
||||
// sort actions by text
|
||||
qSort( acts.begin(), acts.end(), cmpByText_ );
|
||||
std::sort( acts.begin(), acts.end(), cmpByText_ );
|
||||
}
|
||||
mPrintComposersMenu->addActions( acts );
|
||||
}
|
||||
@ -12040,7 +12040,7 @@ QMenu* QgisApp::createPopupMenu()
|
||||
}
|
||||
}
|
||||
|
||||
qSort( panels.begin(), panels.end(), cmpByText_ );
|
||||
std::sort( panels.begin(), panels.end(), cmpByText_ );
|
||||
QWidgetAction* panelstitle = new QWidgetAction( menu );
|
||||
QLabel* plabel = new QLabel( QStringLiteral( "<b>%1</b>" ).arg( tr( "Panels" ) ) );
|
||||
plabel->setMargin( 3 );
|
||||
@ -12058,7 +12058,7 @@ QMenu* QgisApp::createPopupMenu()
|
||||
tlabel->setAlignment( Qt::AlignHCenter );
|
||||
toolbarstitle->setDefaultWidget( tlabel );
|
||||
menu->addAction( toolbarstitle );
|
||||
qSort( toolbars.begin(), toolbars.end(), cmpByText_ );
|
||||
std::sort( toolbars.begin(), toolbars.end(), cmpByText_ );
|
||||
Q_FOREACH ( QAction* a, toolbars )
|
||||
{
|
||||
menu->addAction( a );
|
||||
|
@ -134,7 +134,7 @@ void QgsAttributeActionDialog::insertRow( int row, const QgsAction& action )
|
||||
item = new QTableWidgetItem();
|
||||
item->setFlags( item->flags() & ~( Qt::ItemIsEditable ) );
|
||||
QStringList actionScopes = action.actionScopes().toList();
|
||||
qSort( actionScopes );
|
||||
std::sort( actionScopes.begin(), actionScopes.end() );
|
||||
item->setText( actionScopes.join( QStringLiteral( ", " ) ) );
|
||||
item->setData( Qt::UserRole, QVariant::fromValue<QSet<QString>>( action.actionScopes() ) );
|
||||
mAttributeActionTable->setItem( row, ActionScopes, item );
|
||||
@ -338,7 +338,7 @@ void QgsAttributeActionDialog::itemDoubleClicked( QTableWidgetItem* item )
|
||||
|
||||
QTableWidgetItem* item = mAttributeActionTable->item( row, ActionScopes );
|
||||
QStringList actionScopes = actionProperties.actionScopes().toList();
|
||||
qSort( actionScopes );
|
||||
std::sort( actionScopes.begin(), actionScopes.end() );
|
||||
item->setText( actionScopes.join( QStringLiteral( ", " ) ) );
|
||||
item->setData( Qt::UserRole, QVariant::fromValue<QSet<QString>>( actionProperties.actionScopes() ) );
|
||||
|
||||
|
@ -551,7 +551,7 @@ void QgsBrowserDockWidget::addSelectedLayers()
|
||||
|
||||
// get a sorted list of selected indexes
|
||||
QModelIndexList list = mBrowserView->selectionModel()->selectedIndexes();
|
||||
qSort( list );
|
||||
std::sort( list.begin(), list.end() );
|
||||
|
||||
// If any of the layer items are QGIS we just open and exit the loop
|
||||
Q_FOREACH ( const QModelIndex& index, list )
|
||||
|
@ -202,7 +202,7 @@ int QgsAtlasComposition::updateFeatures()
|
||||
if ( !mFeatureKeys.isEmpty() )
|
||||
{
|
||||
FieldSorter sorter( mFeatureKeys, mSortAscending );
|
||||
qSort( mFeatureIds.begin(), mFeatureIds.end(), sorter );
|
||||
std::sort( mFeatureIds.begin(), mFeatureIds.end(), sorter );
|
||||
}
|
||||
|
||||
emit numberFeaturesChanged( mFeatureIds.size() );
|
||||
@ -750,7 +750,7 @@ void QgsAtlasComposition::setPredefinedScales( const QVector<qreal>& scales )
|
||||
{
|
||||
mPredefinedScales = scales;
|
||||
// make sure the list is sorted
|
||||
qSort( mPredefinedScales.begin(), mPredefinedScales.end() );
|
||||
std::sort( mPredefinedScales.begin(), mPredefinedScales.end() );
|
||||
}
|
||||
|
||||
QgsGeometry QgsAtlasComposition::currentGeometry( const QgsCoordinateReferenceSystem& crs ) const
|
||||
|
@ -406,7 +406,7 @@ bool QgsComposerAttributeTableColumnModelV2::moveColumnInSortRank( QgsComposerTa
|
||||
sortedColumns.append( currentColumn );
|
||||
}
|
||||
}
|
||||
qStableSort( sortedColumns.begin(), sortedColumns.end(), columnsBySortRank );
|
||||
std::stable_sort( sortedColumns.begin(), sortedColumns.end(), columnsBySortRank );
|
||||
int columnPos = sortedColumns.indexOf( column );
|
||||
|
||||
if (( columnPos == 0 && direction == ShiftUp )
|
||||
|
@ -526,7 +526,7 @@ bool QgsComposerAttributeTableV2::getTableContents( QgsComposerTableContents &co
|
||||
{
|
||||
c.setSortColumn( sortColumns.at( i ).first );
|
||||
c.setAscending( sortColumns.at( i ).second );
|
||||
qStableSort( contents.begin(), contents.end(), c );
|
||||
std::stable_sort( contents.begin(), contents.end(), c );
|
||||
}
|
||||
|
||||
recalculateTableSize();
|
||||
@ -608,7 +608,7 @@ QList<QPair<int, bool> > QgsComposerAttributeTableV2::sortAttributes() const
|
||||
}
|
||||
|
||||
//sort columns by rank
|
||||
qSort( sortedColumns.begin(), sortedColumns.end(), columnsBySortRank );
|
||||
std::sort( sortedColumns.begin(), sortedColumns.end(), columnsBySortRank );
|
||||
|
||||
//generate list of column index, bool for sort direction (to match 2.0 api)
|
||||
QList<QPair<int, bool> > attributesBySortRank;
|
||||
|
@ -405,7 +405,7 @@ double QgsComposerHtml::findNearbyPageBreak( double yPos )
|
||||
}
|
||||
|
||||
//sort candidate rows by number of changes ascending, row number descending
|
||||
qSort( candidates.begin(), candidates.end(), candidateSort );
|
||||
std::sort( candidates.begin(), candidates.end(), candidateSort );
|
||||
//first candidate is now the largest row with smallest number of changes
|
||||
|
||||
//ok, now take the mid point of the best candidate position
|
||||
|
@ -1974,7 +1974,7 @@ QgsComposerMapGrid::BorderSide QgsComposerMapGrid::borderForLineCoord( QPointF p
|
||||
distanceToSide << qMakePair( p.y(), QgsComposerMapGrid::Top );
|
||||
distanceToSide << qMakePair( mComposerMap->rect().height() - p.y(), QgsComposerMapGrid::Bottom );
|
||||
|
||||
qSort( distanceToSide.begin(), distanceToSide.end(), sortByDistance );
|
||||
std::sort( distanceToSide.begin(), distanceToSide.end(), sortByDistance );
|
||||
return distanceToSide.at( 0 ).second;
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,7 @@ bool QgsComposerModel::dropMimeData( const QMimeData *data,
|
||||
//move dropped items
|
||||
|
||||
//first sort them by z-order
|
||||
qSort( droppedItems.begin(), droppedItems.end(), zOrderDescending );
|
||||
std::sort( droppedItems.begin(), droppedItems.end(), zOrderDescending );
|
||||
|
||||
//calculate position in z order list to drop items at
|
||||
int destPos = 0;
|
||||
|
@ -137,11 +137,11 @@ QgsValueRelationFieldFormatter::ValueRelationCache QgsValueRelationFieldFormatte
|
||||
|
||||
if ( config.value( "OrderByValue" ).toBool() )
|
||||
{
|
||||
qSort( cache.begin(), cache.end(), orderByValueLessThan );
|
||||
std::sort( cache.begin(), cache.end(), orderByValueLessThan );
|
||||
}
|
||||
else
|
||||
{
|
||||
qSort( cache.begin(), cache.end(), orderByKeyLessThan );
|
||||
std::sort( cache.begin(), cache.end(), orderByKeyLessThan );
|
||||
}
|
||||
|
||||
return cache;
|
||||
|
@ -1005,7 +1005,7 @@ QMimeData* QgsLayerTreeModel::mimeData( const QModelIndexList& indexes ) const
|
||||
{
|
||||
// Sort the indexes. Depending on how the user selected the items, the indexes may be unsorted.
|
||||
QModelIndexList sortedIndexes = indexes;
|
||||
qSort( sortedIndexes.begin(), sortedIndexes.end(), qLess<QModelIndex>() );
|
||||
std::sort( sortedIndexes.begin(), sortedIndexes.end(), std::less<QModelIndex>() );
|
||||
|
||||
QList<QgsLayerTreeNode*> nodesFinal = indexes2nodes( sortedIndexes, true );
|
||||
|
||||
|
@ -109,7 +109,7 @@ void CostCalculator::setPolygonCandidatesCost( int nblp, QList< LabelPosition* >
|
||||
{
|
||||
toSort << lPos.at( i );
|
||||
}
|
||||
qSort( toSort.begin(), toSort.end(), candidateSortShrink );
|
||||
std::sort( toSort.begin(), toSort.end(), candidateSortShrink );
|
||||
for ( int i = 0; i < nblp; ++i )
|
||||
{
|
||||
lPos[i] = toSort.at( i );
|
||||
@ -181,7 +181,7 @@ int CostCalculator::finalizeCandidatesCosts( Feats* feat, int max_p, RTree <Feat
|
||||
max_p = feat->lPos.count();
|
||||
//
|
||||
// sort candidates list, best label to worst
|
||||
qSort( feat->lPos.begin(), feat->lPos.end(), candidateSortGrow );
|
||||
std::sort( feat->lPos.begin(), feat->lPos.end(), candidateSortGrow );
|
||||
|
||||
// try to exclude all conflitual labels (good ones have cost < 1 by pruning)
|
||||
double discrim = 0.0;
|
||||
|
@ -1601,7 +1601,7 @@ int FeaturePart::createCandidates( QList< LabelPosition*>& lPos,
|
||||
}
|
||||
}
|
||||
|
||||
qSort( lPos.begin(), lPos.end(), CostCalculator::candidateSortGrow );
|
||||
std::sort( lPos.begin(), lPos.end(), CostCalculator::candidateSortGrow );
|
||||
return lPos.count();
|
||||
}
|
||||
|
||||
|
@ -2277,7 +2277,7 @@ QList<LabelPosition*> * Problem::getSolution( bool returnInactive )
|
||||
// if features collide, order by size, so smaller ones appear on top
|
||||
if ( returnInactive )
|
||||
{
|
||||
qSort( solList->begin(), solList->end(), compareLabelArea );
|
||||
std::sort( solList->begin(), solList->end(), compareLabelArea );
|
||||
}
|
||||
|
||||
return solList;
|
||||
|
@ -153,7 +153,7 @@ void QgsBrowserModel::addRootItems()
|
||||
QList<QgsDataItem *> providerGroup = providerMap.values( key );
|
||||
if ( providerGroup.size() > 1 )
|
||||
{
|
||||
qSort( providerGroup.begin(), providerGroup.end(), cmpByDataItemName_ );
|
||||
std::sort( providerGroup.begin(), providerGroup.end(), cmpByDataItemName_ );
|
||||
}
|
||||
|
||||
Q_FOREACH ( QgsDataItem * ditem, providerGroup )
|
||||
|
@ -273,7 +273,7 @@ void QgsGradientColorRamp::setStops( const QgsGradientStopsList &stops )
|
||||
mStops = stops;
|
||||
|
||||
//sort stops by offset
|
||||
qSort( mStops.begin(), mStops.end(), stopLessThan );
|
||||
std::sort( mStops.begin(), mStops.end(), stopLessThan );
|
||||
}
|
||||
|
||||
void QgsGradientColorRamp::addStopsToGradient( QGradient* gradient, double alpha )
|
||||
|
@ -166,7 +166,7 @@ QStringList QgsExpressionContextScope::filteredVariableNames() const
|
||||
filtered << variable;
|
||||
}
|
||||
QgsExpressionContextVariableCompare cmp( *this );
|
||||
qSort( filtered.begin(), filtered.end(), cmp );
|
||||
std::sort( filtered.begin(), filtered.end(), cmp );
|
||||
|
||||
return filtered;
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ void QgsAbstractFeatureIterator::setupOrderBy( const QList<QgsFeatureRequest::Or
|
||||
mCachedFeatures.append( indexedFeature );
|
||||
}
|
||||
|
||||
qSort( mCachedFeatures.begin(), mCachedFeatures.end(), QgsExpressionSorter( preparedOrderBys ) );
|
||||
std::sort( mCachedFeatures.begin(), mCachedFeatures.end(), QgsExpressionSorter( preparedOrderBys ) );
|
||||
|
||||
mFeatureIterator = mCachedFeatures.constBegin();
|
||||
mUseCachedFeatures = true;
|
||||
|
@ -31,7 +31,7 @@ QgsHistogram::QgsHistogram()
|
||||
|
||||
void QgsHistogram::prepareValues()
|
||||
{
|
||||
qSort( mValues.begin(), mValues.end() );
|
||||
std::sort( mValues.begin(), mValues.end() );
|
||||
|
||||
QgsStatisticalSummary s;
|
||||
s.setStatistics( QgsStatisticalSummary::Max | QgsStatisticalSummary::Min | QgsStatisticalSummary::InterQuartileRange );
|
||||
|
@ -327,7 +327,7 @@ void QgsLabelingEngine::run( QgsRenderContext& context )
|
||||
painter->setRenderHint( QPainter::Antialiasing );
|
||||
|
||||
// sort labels
|
||||
qSort( labels->begin(), labels->end(), QgsLabelSorter( mMapSettings ) );
|
||||
std::sort( labels->begin(), labels->end(), QgsLabelSorter( mMapSettings ) );
|
||||
|
||||
// draw the labels
|
||||
QList<pal::LabelPosition*>::iterator it = labels->begin();
|
||||
|
@ -383,7 +383,7 @@ void QgsMapRendererJob::logRenderingTime( const LayerRenderJobs& jobs )
|
||||
elapsed.insert( job.renderingTime, job.layer ? job.layer->id() : QString() );
|
||||
|
||||
QList<int> tt( elapsed.uniqueKeys() );
|
||||
qSort( tt.begin(), tt.end(), qGreater<int>() );
|
||||
std::sort( tt.begin(), tt.end(), std::greater<int>() );
|
||||
Q_FOREACH ( int t, tt )
|
||||
{
|
||||
QgsMessageLog::logMessage( tr( "%1 ms: %2" ).arg( t ).arg( QStringList( elapsed.values( t ) ).join( QStringLiteral( ", " ) ) ), tr( "Rendering" ) );
|
||||
|
@ -135,7 +135,7 @@ void QgsStatisticalSummary::finalize()
|
||||
|| mStatistics & QgsStatisticalSummary::ThirdQuartile
|
||||
|| mStatistics & QgsStatisticalSummary::InterQuartileRange )
|
||||
{
|
||||
qSort( mValues.begin(), mValues.end() );
|
||||
std::sort( mValues.begin(), mValues.end() );
|
||||
bool even = ( mCount % 2 ) < 1;
|
||||
if ( even )
|
||||
{
|
||||
@ -212,7 +212,7 @@ void QgsStatisticalSummary::finalize()
|
||||
if ( mStatistics & QgsStatisticalSummary::Minority || mStatistics & QgsStatisticalSummary::Majority )
|
||||
{
|
||||
QList<int> valueCounts = mValueCount.values();
|
||||
qSort( valueCounts.begin(), valueCounts.end() );
|
||||
std::sort( valueCounts.begin(), valueCounts.end() );
|
||||
if ( mStatistics & QgsStatisticalSummary::Minority )
|
||||
{
|
||||
mMinority = mValueCount.key( valueCounts.first() );
|
||||
|
@ -670,7 +670,7 @@ QStringList QgsVectorDataProvider::availableEncodings()
|
||||
}
|
||||
|
||||
// Do case-insensitive sorting of encodings
|
||||
qSort( sEncodings.begin(), sEncodings.end(), _compareEncodings );
|
||||
std::sort( sEncodings.begin(), sEncodings.end(), _compareEncodings );
|
||||
|
||||
return sEncodings;
|
||||
}
|
||||
|
@ -2327,7 +2327,7 @@ bool QgsVectorLayer::deleteAttributes( QList<int> attrs )
|
||||
// Remove multiple occurrences of same attribute
|
||||
attrs = attrs.toSet().toList();
|
||||
|
||||
qSort( attrs.begin(), attrs.end(), qGreater<int>() );
|
||||
std::sort( attrs.begin(), attrs.end(), std::greater<int>() );
|
||||
|
||||
Q_FOREACH ( int attr, attrs )
|
||||
{
|
||||
|
@ -678,7 +678,7 @@ void QgsVectorLayerEditBuffer::handleAttributeAdded( int index )
|
||||
// go through renamed attributes and adapt
|
||||
QList< int > sortedRenamedIndices = mRenamedAttributes.keys();
|
||||
//sort keys
|
||||
qSort( sortedRenamedIndices.begin(), sortedRenamedIndices.end(), qGreater< int >() );
|
||||
std::sort( sortedRenamedIndices.begin(), sortedRenamedIndices.end(), std::greater< int >() );
|
||||
Q_FOREACH ( int renameIndex, sortedRenamedIndices )
|
||||
{
|
||||
if ( renameIndex >= index )
|
||||
@ -717,7 +717,7 @@ void QgsVectorLayerEditBuffer::handleAttributeDeleted( int index )
|
||||
// go through rename attributes and adapt
|
||||
QList< int > sortedRenamedIndices = mRenamedAttributes.keys();
|
||||
//sort keys
|
||||
qSort( sortedRenamedIndices.begin(), sortedRenamedIndices.end() );
|
||||
std::sort( sortedRenamedIndices.begin(), sortedRenamedIndices.end() );
|
||||
int last = -1;
|
||||
mRenamedAttributes.remove( index );
|
||||
Q_FOREACH ( int renameIndex, sortedRenamedIndices )
|
||||
|
@ -417,7 +417,7 @@ void QgsVectorLayerUndoCommandDeleteAttribute::redo()
|
||||
if ( mProviderField )
|
||||
{
|
||||
mBuffer->mDeletedAttributeIds.append( mOriginIndex );
|
||||
qSort( mBuffer->mDeletedAttributeIds ); // keep it sorted
|
||||
std::sort( mBuffer->mDeletedAttributeIds.begin(), mBuffer->mDeletedAttributeIds.end() ); // keep it sorted
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -297,7 +297,7 @@ void QgsColorRampShader::classifyColorRamp( const int classes, const int band, c
|
||||
colorRampItems.append( newColorRampItem );
|
||||
}
|
||||
|
||||
qSort( colorRampItems );
|
||||
std::sort( colorRampItems.begin(), colorRampItems.end() );
|
||||
setColorRampItemList( colorRampItems );
|
||||
}
|
||||
|
||||
|
@ -352,11 +352,11 @@ void QgsCategorizedSymbolRenderer::sortByValue( Qt::SortOrder order )
|
||||
{
|
||||
if ( order == Qt::AscendingOrder )
|
||||
{
|
||||
qSort( mCategories.begin(), mCategories.end(), valueLessThan );
|
||||
std::sort( mCategories.begin(), mCategories.end(), valueLessThan );
|
||||
}
|
||||
else
|
||||
{
|
||||
qSort( mCategories.begin(), mCategories.end(), valueGreaterThan );
|
||||
std::sort( mCategories.begin(), mCategories.end(), valueGreaterThan );
|
||||
}
|
||||
}
|
||||
|
||||
@ -374,11 +374,11 @@ void QgsCategorizedSymbolRenderer::sortByLabel( Qt::SortOrder order )
|
||||
{
|
||||
if ( order == Qt::AscendingOrder )
|
||||
{
|
||||
qSort( mCategories.begin(), mCategories.end(), labelLessThan );
|
||||
std::sort( mCategories.begin(), mCategories.end(), labelLessThan );
|
||||
}
|
||||
else
|
||||
{
|
||||
qSort( mCategories.begin(), mCategories.end(), labelGreaterThan );
|
||||
std::sort( mCategories.begin(), mCategories.end(), labelGreaterThan );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -573,7 +573,7 @@ static QList<double> _calcQuantileBreaks( QList<double> values, int classes )
|
||||
// (indices of X: 1...n)
|
||||
|
||||
// sort the values first
|
||||
qSort( values );
|
||||
std::sort( values.begin(), values.end() );
|
||||
|
||||
QList<double> breaks;
|
||||
|
||||
@ -709,7 +709,7 @@ static QList<double> _calcJenksBreaks( QList<double> values, int classes,
|
||||
int n = sample.size();
|
||||
|
||||
// sort the sample values
|
||||
qSort( sample );
|
||||
std::sort( sample.begin(), sample.end() );
|
||||
|
||||
QVector< QVector<int> > matrixOne( n + 1 );
|
||||
QVector< QVector<double> > matrixTwo( n + 1 );
|
||||
@ -828,7 +828,7 @@ void QgsGraduatedSymbolRenderer::updateClasses( QgsVectorLayer* vlayer, Mode mod
|
||||
if ( !ok || values.isEmpty() )
|
||||
return;
|
||||
|
||||
qSort( values ); // vmora: is wondering if O( n log(n) ) is really necessary here, min and max are O( n )
|
||||
std::sort( values.begin(), values.end() ); // vmora: is wondering if O( n log(n) ) is really necessary here, min and max are O( n )
|
||||
minimum = values.first();
|
||||
maximum = values.last();
|
||||
valuesLoaded = true;
|
||||
@ -1518,18 +1518,18 @@ void QgsGraduatedSymbolRenderer::sortByValue( Qt::SortOrder order )
|
||||
{
|
||||
if ( order == Qt::AscendingOrder )
|
||||
{
|
||||
qSort( mRanges.begin(), mRanges.end(), valueLessThan );
|
||||
std::sort( mRanges.begin(), mRanges.end(), valueLessThan );
|
||||
}
|
||||
else
|
||||
{
|
||||
qSort( mRanges.begin(), mRanges.end(), valueGreaterThan );
|
||||
std::sort( mRanges.begin(), mRanges.end(), valueGreaterThan );
|
||||
}
|
||||
}
|
||||
|
||||
bool QgsGraduatedSymbolRenderer::rangesOverlap() const
|
||||
{
|
||||
QgsRangeList sortedRanges = mRanges;
|
||||
qSort( sortedRanges.begin(), sortedRanges.end(), valueLessThan );
|
||||
std::sort( sortedRanges.begin(), sortedRanges.end(), valueLessThan );
|
||||
|
||||
QgsRangeList::const_iterator it = sortedRanges.constBegin();
|
||||
if ( it == sortedRanges.constEnd() )
|
||||
@ -1557,7 +1557,7 @@ bool QgsGraduatedSymbolRenderer::rangesOverlap() const
|
||||
bool QgsGraduatedSymbolRenderer::rangesHaveGaps() const
|
||||
{
|
||||
QgsRangeList sortedRanges = mRanges;
|
||||
qSort( sortedRanges.begin(), sortedRanges.end(), valueLessThan );
|
||||
std::sort( sortedRanges.begin(), sortedRanges.end(), valueLessThan );
|
||||
|
||||
QgsRangeList::const_iterator it = sortedRanges.constBegin();
|
||||
if ( it == sortedRanges.constEnd() )
|
||||
@ -1590,11 +1590,11 @@ void QgsGraduatedSymbolRenderer::sortByLabel( Qt::SortOrder order )
|
||||
{
|
||||
if ( order == Qt::AscendingOrder )
|
||||
{
|
||||
qSort( mRanges.begin(), mRanges.end(), labelLessThan );
|
||||
std::sort( mRanges.begin(), mRanges.end(), labelLessThan );
|
||||
}
|
||||
else
|
||||
{
|
||||
qSort( mRanges.begin(), mRanges.end(), labelGreaterThan );
|
||||
std::sort( mRanges.begin(), mRanges.end(), labelGreaterThan );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -847,7 +847,7 @@ void QgsRuleBasedRenderer::startRender( QgsRenderContext& context, const QgsFiel
|
||||
|
||||
QSet<int> symbolZLevelsSet = mRootRule->collectZLevels();
|
||||
QList<int> symbolZLevels = symbolZLevelsSet.toList();
|
||||
qSort( symbolZLevels );
|
||||
std::sort( symbolZLevels.begin(), symbolZLevels.end() );
|
||||
|
||||
// create mapping from unnormalized levels [unlimited range] to normalized levels [0..N-1]
|
||||
// and prepare rendering queue
|
||||
@ -1152,7 +1152,7 @@ void QgsRuleBasedRenderer::refineRuleRanges( QgsRuleBasedRenderer::Rule* initial
|
||||
|
||||
void QgsRuleBasedRenderer::refineRuleScales( QgsRuleBasedRenderer::Rule* initialRule, QList<int> scales )
|
||||
{
|
||||
qSort( scales ); // make sure the scales are in ascending order
|
||||
std::sort( scales.begin(), scales.end() ); // make sure the scales are in ascending order
|
||||
int oldScale = initialRule->scaleMinDenom();
|
||||
int maxDenom = initialRule->scaleMaxDenom();
|
||||
QgsSymbol* symbol = initialRule->symbol();
|
||||
|
@ -3444,13 +3444,13 @@ void QgsSymbolLayerUtils::sortVariantList( QList<QVariant>& list, Qt::SortOrder
|
||||
{
|
||||
if ( order == Qt::AscendingOrder )
|
||||
{
|
||||
//qSort( list.begin(), list.end(), _QVariantLessThan );
|
||||
qSort( list.begin(), list.end(), qgsVariantLessThan );
|
||||
//std::sort( list.begin(), list.end(), _QVariantLessThan );
|
||||
std::sort( list.begin(), list.end(), qgsVariantLessThan );
|
||||
}
|
||||
else // Qt::DescendingOrder
|
||||
{
|
||||
//qSort( list.begin(), list.end(), _QVariantGreaterThan );
|
||||
qSort( list.begin(), list.end(), qgsVariantGreaterThan );
|
||||
//std::sort( list.begin(), list.end(), _QVariantGreaterThan );
|
||||
std::sort( list.begin(), list.end(), qgsVariantGreaterThan );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ void QgsAttributeTableModel::featuresDeleted( const QgsFeatureIds& fids )
|
||||
rows << row;
|
||||
}
|
||||
|
||||
qSort( rows );
|
||||
std::sort( rows.begin(), rows.end() );
|
||||
|
||||
int lastRow = -1;
|
||||
int beginRow = -1;
|
||||
|
@ -477,7 +477,7 @@ void QgsRelationReferenceWidget::init()
|
||||
QVariant nullValue = QgsApplication::nullRepresentation();
|
||||
cb->addItem( nullValue.toString(), QVariant( mReferencedLayer->fields().at( idx ).type() ) );
|
||||
|
||||
qSort( uniqueValues.begin(), uniqueValues.end(), qgsVariantLessThan );
|
||||
std::sort( uniqueValues.begin(), uniqueValues.end(), qgsVariantLessThan );
|
||||
Q_FOREACH ( const QVariant& v, uniqueValues )
|
||||
{
|
||||
cb->addItem( v.toString(), v );
|
||||
|
@ -88,8 +88,8 @@ void QgsLayerTreeMapCanvasBridge::setCustomLayerOrder( const QStringList& order
|
||||
QStringList defOrder( defaultLayerOrder() );
|
||||
QStringList newOrder( order );
|
||||
QStringList sortedNewOrder( order );
|
||||
qSort( defOrder );
|
||||
qSort( sortedNewOrder );
|
||||
std::sort( defOrder.begin(), defOrder.end() );
|
||||
std::sort( sortedNewOrder.begin(), sortedNewOrder.end() );
|
||||
|
||||
if ( defOrder.size() < sortedNewOrder.size() )
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ void QgsColorSchemeList::removeSelection()
|
||||
QList<int> rowsToRemove = QList<int>::fromSet( rows.toSet() );
|
||||
|
||||
//remove rows in descending order
|
||||
qSort( rowsToRemove.begin(), rowsToRemove.end(), qGreater<int>() );
|
||||
std::sort( rowsToRemove.begin(), rowsToRemove.end(), std::greater<int>() );
|
||||
Q_FOREACH ( int row, rowsToRemove )
|
||||
{
|
||||
mModel->removeRow( row );
|
||||
@ -204,7 +204,7 @@ void QgsColorSchemeList::keyPressEvent( QKeyEvent *event )
|
||||
QList<int> rowsToRemove = QList<int>::fromSet( rows.toSet() );
|
||||
|
||||
//remove rows in descending order
|
||||
qSort( rowsToRemove.begin(), rowsToRemove.end(), qGreater<int>() );
|
||||
std::sort( rowsToRemove.begin(), rowsToRemove.end(), std::greater<int>() );
|
||||
Q_FOREACH ( int row, rowsToRemove )
|
||||
{
|
||||
mModel->removeRow( row );
|
||||
|
@ -523,10 +523,10 @@ void QgsGradientColorRampDialog::updatePlot()
|
||||
alphaPoints << QPointF( 1.0, mRamp.color2().alphaF() );
|
||||
addMarkersForColor( 1.0, mRamp.color2(), mCurrentPlotMarkerIndex == i );
|
||||
|
||||
qSort( lightnessPoints.begin(), lightnessPoints.end(), byX );
|
||||
qSort( huePoints.begin(), huePoints.end(), byX );
|
||||
qSort( saturationPoints.begin(), saturationPoints.end(), byX );
|
||||
qSort( alphaPoints.begin(), alphaPoints.end(), byX );
|
||||
std::sort( lightnessPoints.begin(), lightnessPoints.end(), byX );
|
||||
std::sort( huePoints.begin(), huePoints.end(), byX );
|
||||
std::sort( saturationPoints.begin(), saturationPoints.end(), byX );
|
||||
std::sort( alphaPoints.begin(), alphaPoints.end(), byX );
|
||||
|
||||
#if defined(QWT_VERSION) && QWT_VERSION>=0x060000
|
||||
mLightnessCurve->setSamples( lightnessPoints );
|
||||
|
@ -98,7 +98,7 @@ static bool _rangesByLower( const QgsRendererRange& a, const QgsRendererRange& b
|
||||
void QgsHistogramWidget::setGraduatedRanges( const QgsRangeList &ranges )
|
||||
{
|
||||
mRanges = ranges;
|
||||
qSort( mRanges.begin(), mRanges.end(), _rangesByLower );
|
||||
std::sort( mRanges.begin(), mRanges.end(), _rangesByLower );
|
||||
}
|
||||
|
||||
void QgsHistogramWidget::refreshValues()
|
||||
@ -120,7 +120,7 @@ void QgsHistogramWidget::refreshValues()
|
||||
}
|
||||
|
||||
|
||||
qSort( mValues.begin(), mValues.end() );
|
||||
std::sort( mValues.begin(), mValues.end() );
|
||||
mHistogram.setValues( mValues );
|
||||
mBinsSpinBox->blockSignals( true );
|
||||
mBinsSpinBox->setValue( qMax( mHistogram.optimalNumberBins(), 30 ) );
|
||||
|
@ -175,7 +175,7 @@ void QgsRasterFormatSaveOptionsWidget::updateProfiles()
|
||||
}
|
||||
}
|
||||
}
|
||||
qSort( profileKeys );
|
||||
std::sort( profileKeys.begin(), profileKeys.end() );
|
||||
|
||||
// populate mOptionsMap and mProfileComboBox
|
||||
mOptionsMap.clear();
|
||||
|
@ -160,7 +160,7 @@ QgsRasterRenderer* QgsSingleBandPseudoColorRendererWidget::renderer()
|
||||
colorRampItems.append( newColorRampItem );
|
||||
}
|
||||
// sort the shader items
|
||||
qSort( colorRampItems );
|
||||
std::sort( colorRampItems.begin(), colorRampItems.end() );
|
||||
colorRampShader->setColorRampItemList( colorRampItems );
|
||||
|
||||
if ( !btnColorRamp->isNull() )
|
||||
|
@ -319,7 +319,7 @@ bool QgsCategorizedSymbolRendererModel::dropMimeData( const QMimeData *data, Qt:
|
||||
|
||||
void QgsCategorizedSymbolRendererModel::deleteRows( QList<int> rows )
|
||||
{
|
||||
qSort( rows ); // list might be unsorted, depending on how the user selected the rows
|
||||
std::sort( rows.begin(), rows.end() ); // list might be unsorted, depending on how the user selected the rows
|
||||
for ( int i = rows.size() - 1; i >= 0; i-- )
|
||||
{
|
||||
beginRemoveRows( QModelIndex(), rows[i], rows[i] );
|
||||
|
@ -61,7 +61,7 @@ void QgsGeometryDuplicateCheck::collectErrors( QList<QgsGeometryCheckError*>& er
|
||||
}
|
||||
if ( !duplicates.isEmpty() )
|
||||
{
|
||||
qSort( duplicates );
|
||||
std::sort( duplicates.begin(), duplicates.end() );
|
||||
errors.append( new QgsGeometryDuplicateCheckError( this, featureid, feature.geometry().geometry()->centroid(), duplicates ) );
|
||||
}
|
||||
delete geomEngine;
|
||||
|
@ -1386,7 +1386,7 @@ void QgsGrassModuleSelection::onLayerSelectionChanged()
|
||||
{
|
||||
cats << QgsGrassFeatureIterator::catFromFid( fid );
|
||||
}
|
||||
qSort( cats );
|
||||
std::sort( cats.begin(), cats.end() );
|
||||
QString list;
|
||||
// make ranges of cats
|
||||
int last = -1;
|
||||
|
@ -80,7 +80,7 @@ QgsDelimitedTextFeatureIterator::QgsDelimitedTextFeatureIterator( QgsDelimitedTe
|
||||
{
|
||||
mFeatureIds = mSource->mSpatialIndex->intersects( rect );
|
||||
// Sort for efficient sequential retrieval
|
||||
qSort( mFeatureIds.begin(), mFeatureIds.end() );
|
||||
std::sort( mFeatureIds.begin(), mFeatureIds.end() );
|
||||
QgsDebugMsg( QString( "Layer has spatial index - selected %1 features from index" ).arg( mFeatureIds.size() ) );
|
||||
mMode = FeatureIds;
|
||||
mTestSubset = false;
|
||||
|
@ -291,7 +291,7 @@ QgsGPSData::TrackIterator QgsGPSData::addTrack( const QgsTrack &trk )
|
||||
void QgsGPSData::removeWaypoints( const QgsFeatureIds &ids )
|
||||
{
|
||||
QList<QgsFeatureId> ids2 = ids.toList();
|
||||
qSort( ids2 );
|
||||
std::sort( ids2.begin(), ids2.end() );
|
||||
QList<QgsFeatureId>::const_iterator iter = ids2.begin();
|
||||
WaypointIterator wIter;
|
||||
for ( wIter = waypoints.begin();
|
||||
@ -312,7 +312,7 @@ void QgsGPSData::removeWaypoints( const QgsFeatureIds &ids )
|
||||
void QgsGPSData::removeRoutes( const QgsFeatureIds &ids )
|
||||
{
|
||||
QList<QgsFeatureId> ids2 = ids.toList();
|
||||
qSort( ids2 );
|
||||
std::sort( ids2.begin(), ids2.end() );
|
||||
QList<QgsFeatureId>::const_iterator iter = ids2.begin();
|
||||
RouteIterator rIter;
|
||||
for ( rIter = routes.begin(); rIter != routes.end() && iter != ids2.end(); )
|
||||
@ -332,7 +332,7 @@ void QgsGPSData::removeRoutes( const QgsFeatureIds &ids )
|
||||
void QgsGPSData::removeTracks( const QgsFeatureIds &ids )
|
||||
{
|
||||
QList<QgsFeatureId> ids2 = ids.toList();
|
||||
qSort( ids2 );
|
||||
std::sort( ids2.begin(), ids2.end() );
|
||||
QList<QgsFeatureId>::const_iterator iter = ids2.begin();
|
||||
TrackIterator tIter;
|
||||
for ( tIter = tracks.begin(); tIter != tracks.end() && iter != ids2.end(); )
|
||||
|
@ -1949,7 +1949,7 @@ void QgsGrassProvider::onUndoIndexChanged( int currentIndex )
|
||||
QgsDebugMsg( QString( "currentIndex = %1" ).arg( currentIndex ) );
|
||||
// multiple commands maybe undone with single undoIndexChanged signal
|
||||
QList<int> indexes = mLayer->map()->undoCommands().keys();
|
||||
qSort( indexes );
|
||||
std::sort( indexes.begin(), indexes.end() );
|
||||
for ( int i = indexes.size() - 1; i >= 0; i-- )
|
||||
{
|
||||
int index = indexes[i];
|
||||
|
@ -401,7 +401,7 @@ bool QgsMemoryProvider::renameAttributes( const QgsFieldNameMap& renamedAttribut
|
||||
bool QgsMemoryProvider::deleteAttributes( const QgsAttributeIds& attributes )
|
||||
{
|
||||
QList<int> attrIdx = attributes.toList();
|
||||
qSort( attrIdx.begin(), attrIdx.end(), qGreater<int>() );
|
||||
std::sort( attrIdx.begin(), attrIdx.end(), std::greater<int>() );
|
||||
|
||||
// delete attributes one-by-one with decreasing index
|
||||
for ( QList<int>::const_iterator it = attrIdx.constBegin(); it != attrIdx.constEnd(); ++it )
|
||||
|
@ -1447,7 +1447,7 @@ bool QgsOgrProvider::deleteAttributes( const QgsAttributeIds &attributes )
|
||||
bool res = true;
|
||||
QList<int> attrsLst = attributes.toList();
|
||||
// sort in descending order
|
||||
qSort( attrsLst.begin(), attrsLst.end(), qGreater<int>() );
|
||||
std::sort( attrsLst.begin(), attrsLst.end(), std::greater<int>() );
|
||||
Q_FOREACH ( int attr, attrsLst )
|
||||
{
|
||||
if ( mFirstFieldIsFid )
|
||||
@ -4028,7 +4028,7 @@ QGISEXTERN int listStyles( const QString &uri, QStringList &ids, QStringList &na
|
||||
OGR_F_Destroy( hFeature );
|
||||
}
|
||||
|
||||
qSort( listTimestamp.begin(), listTimestamp.end() );
|
||||
std::sort( listTimestamp.begin(), listTimestamp.end() );
|
||||
// Sort from most recent to least recent
|
||||
for ( int i = listTimestamp.size() - 1; i >= 0; i-- )
|
||||
{
|
||||
|
@ -2409,7 +2409,7 @@ bool QgsPostgresProvider::deleteAttributes( const QgsAttributeIds& ids )
|
||||
conn->begin();
|
||||
|
||||
QList<int> idsList = ids.values();
|
||||
qSort( idsList.begin(), idsList.end(), qGreater<int>() );
|
||||
std::sort( idsList.begin(), idsList.end(), std::greater<int>() );
|
||||
|
||||
for ( QList<int>::const_iterator iter = idsList.begin(); iter != idsList.end(); ++iter )
|
||||
{
|
||||
|
@ -450,7 +450,7 @@ bool QgsWmsProvider::setImageCrs( QString const & crs )
|
||||
{
|
||||
mTileMatrixSet = &mCaps.mTileMatrixSets[ mSettings.mTileMatrixSetId ];
|
||||
QList<double> keys = mTileMatrixSet->tileMatrices.keys();
|
||||
qSort( keys );
|
||||
std::sort( keys.begin(), keys.end() );
|
||||
Q_FOREACH ( double key, keys )
|
||||
{
|
||||
resolutions << key;
|
||||
@ -849,7 +849,7 @@ QImage *QgsWmsProvider::draw( QgsRectangle const & viewExtent, int pixelWidth, i
|
||||
// order tile requests according to the distance from view center
|
||||
LessThanTileRequest cmp;
|
||||
cmp.center = viewExtent.center();
|
||||
qSort( requestsFinal.begin(), requestsFinal.end(), cmp );
|
||||
std::sort( requestsFinal.begin(), requestsFinal.end(), cmp );
|
||||
|
||||
QgsWmsTiledImageDownloadHandler handler( dataSourceUri(), mSettings.authorization(), mTileReqNo, requestsFinal, image, viewExtent, mSettings.mSmoothPixmapTransform, feedback );
|
||||
handler.downloadBlocking();
|
||||
|
@ -27,7 +27,7 @@ QgsWmtsDimensions::QgsWmtsDimensions( const QgsWmtsTileLayer &layer, QWidget *pa
|
||||
setupUi( this );
|
||||
|
||||
QStringList dims = layer.dimensions.keys();
|
||||
qSort( dims );
|
||||
std::sort( dims.begin(), dims.end() );
|
||||
|
||||
mDimensions->setRowCount( dims.size() );
|
||||
|
||||
|
@ -200,19 +200,19 @@ namespace QgsWms
|
||||
//sort color box for a/r/g/b
|
||||
if ( redRange >= greenRange && redRange >= blueRange && redRange >= alphaRange )
|
||||
{
|
||||
qSort( colorBox.begin(), colorBox.end(), redCompare );
|
||||
std::sort( colorBox.begin(), colorBox.end(), redCompare );
|
||||
}
|
||||
else if ( greenRange >= redRange && greenRange >= blueRange && greenRange >= alphaRange )
|
||||
{
|
||||
qSort( colorBox.begin(), colorBox.end(), greenCompare );
|
||||
std::sort( colorBox.begin(), colorBox.end(), greenCompare );
|
||||
}
|
||||
else if ( blueRange >= redRange && blueRange >= greenRange && blueRange >= alphaRange )
|
||||
{
|
||||
qSort( colorBox.begin(), colorBox.end(), blueCompare );
|
||||
std::sort( colorBox.begin(), colorBox.end(), blueCompare );
|
||||
}
|
||||
else
|
||||
{
|
||||
qSort( colorBox.begin(), colorBox.end(), alphaCompare );
|
||||
std::sort( colorBox.begin(), colorBox.end(), alphaCompare );
|
||||
}
|
||||
|
||||
//get median
|
||||
|
@ -195,8 +195,8 @@ class TestQgsSpatialIndex : public QObject
|
||||
QCOMPARE( resBulk.count(), 500 );
|
||||
QCOMPARE( resInsert.count(), 500 );
|
||||
// the trees are built differently so they will give also different order of fids
|
||||
qSort( resBulk );
|
||||
qSort( resInsert );
|
||||
std::sort( resBulk.begin(), resBulk.end() );
|
||||
std::sort( resInsert.begin(), resInsert.end() );
|
||||
QCOMPARE( resBulk, resInsert );
|
||||
|
||||
delete indexBulk;
|
||||
|
Loading…
x
Reference in New Issue
Block a user