Skip to content
Permalink
Browse files

Also remove Q_FOREACH from all gui headers

  • Loading branch information
m-kuhn committed Apr 26, 2018
1 parent 2d5ec75 commit d0240e82c9780eba829d8c302e514ba4ab111cc7
Showing with 37 additions and 35 deletions.
  1. +36 −0 src/gui/raster/qgspalettedrendererwidget.cpp
  2. +1 −35 src/gui/raster/qgspalettedrendererwidget.h
@@ -805,3 +805,39 @@ void QgsPalettedRendererModel::deleteAll()

///@endcond PRIVATE


void QgsPalettedRendererClassGatherer::run()
{
mWasCanceled = false;

// allow responsive cancelation
mFeedback = new QgsRasterBlockFeedback();
connect( mFeedback, &QgsRasterBlockFeedback::progressChanged, this, &QgsPalettedRendererClassGatherer::progressChanged );

QgsPalettedRasterRenderer::ClassData newClasses = QgsPalettedRasterRenderer::classDataFromRaster( mLayer->dataProvider(), mBandNumber, mRamp.get(), mFeedback );

// combine existing classes with new classes
QgsPalettedRasterRenderer::ClassData::iterator classIt = newClasses.begin();
for ( ; classIt != newClasses.end(); ++classIt )
{
// check if existing classes contains this same class
for ( const QgsPalettedRasterRenderer::Class &existingClass : qgis::as_const( mClasses ) )
{
if ( existingClass.value == classIt->value )
{
classIt->color = existingClass.color;
classIt->label = existingClass.label;
break;
}
}
}
mClasses = newClasses;

// be overly cautious - it's *possible* stop() might be called between deleting mFeedback and nulling it
mFeedbackMutex.lock();
delete mFeedback;
mFeedback = nullptr;
mFeedbackMutex.unlock();

emit collectedClasses();
}
@@ -49,41 +49,7 @@ class QgsPalettedRendererClassGatherer: public QThread
, mWasCanceled( false )
{}

void run() override
{
mWasCanceled = false;

// allow responsive cancelation
mFeedback = new QgsRasterBlockFeedback();
connect( mFeedback, &QgsRasterBlockFeedback::progressChanged, this, &QgsPalettedRendererClassGatherer::progressChanged );

QgsPalettedRasterRenderer::ClassData newClasses = QgsPalettedRasterRenderer::classDataFromRaster( mLayer->dataProvider(), mBandNumber, mRamp.get(), mFeedback );

// combine existing classes with new classes
QgsPalettedRasterRenderer::ClassData::iterator classIt = newClasses.begin();
for ( ; classIt != newClasses.end(); ++classIt )
{
// check if existing classes contains this same class
Q_FOREACH ( const QgsPalettedRasterRenderer::Class &existingClass, mClasses )
{
if ( existingClass.value == classIt->value )
{
classIt->color = existingClass.color;
classIt->label = existingClass.label;
break;
}
}
}
mClasses = newClasses;

// be overly cautious - it's *possible* stop() might be called between deleting mFeedback and nulling it
mFeedbackMutex.lock();
delete mFeedback;
mFeedback = nullptr;
mFeedbackMutex.unlock();

emit collectedClasses();
}
void run() override;

//! Informs the gatherer to immediately stop collecting values
void stop()

0 comments on commit d0240e8

Please sign in to comment.
You can’t perform that action at this time.