Gui: modernize C++: use range-based for loop
This commit is contained in:
@@ -157,7 +157,7 @@ namespace Gui {
|
||||
class SoFCColorBarProxyObject : public QObject
|
||||
{
|
||||
public:
|
||||
SoFCColorBarProxyObject(SoFCColorBar* b)
|
||||
explicit SoFCColorBarProxyObject(SoFCColorBar* b)
|
||||
: QObject(nullptr), bar(b) {}
|
||||
~SoFCColorBarProxyObject() override {}
|
||||
void customEvent(QEvent *) override
|
||||
@@ -190,8 +190,8 @@ SoFCColorBar::SoFCColorBar()
|
||||
_colorBars.push_back( new SoFCColorGradient );
|
||||
_colorBars.push_back( new SoFCColorLegend );
|
||||
|
||||
for (std::vector<SoFCColorBarBase*>::const_iterator it = _colorBars.begin(); it != _colorBars.end(); ++it)
|
||||
pColorMode->addChild( *it );
|
||||
for (auto it : _colorBars)
|
||||
pColorMode->addChild(it);
|
||||
pColorMode->whichChild = 0;
|
||||
}
|
||||
|
||||
@@ -227,14 +227,14 @@ void SoFCColorBar::setViewportSize( const SbVec2s& size )
|
||||
|
||||
void SoFCColorBar::setRange( float fMin, float fMax, int prec )
|
||||
{
|
||||
for (std::vector<SoFCColorBarBase*>::const_iterator it = _colorBars.begin(); it != _colorBars.end(); ++it)
|
||||
(*it)->setRange(fMin, fMax, prec);
|
||||
for (auto it : _colorBars)
|
||||
it->setRange(fMin, fMax, prec);
|
||||
}
|
||||
|
||||
void SoFCColorBar::setOutsideGrayed (bool bVal)
|
||||
{
|
||||
for (std::vector<SoFCColorBarBase*>::const_iterator it = _colorBars.begin(); it != _colorBars.end(); ++it)
|
||||
(*it)->setOutsideGrayed(bVal);
|
||||
for (auto it : _colorBars)
|
||||
it->setOutsideGrayed(bVal);
|
||||
}
|
||||
|
||||
bool SoFCColorBar::isVisible (float fVal) const
|
||||
@@ -318,10 +318,10 @@ void SoFCColorBar::handleEvent (SoHandleEventAction *action)
|
||||
SoFCColorBarBase* current = getActiveBar();
|
||||
QMenu menu;
|
||||
int i=0;
|
||||
for (std::vector<SoFCColorBarBase*>::const_iterator it = _colorBars.begin(); it != _colorBars.end(); ++it) {
|
||||
QAction* item = menu.addAction(QObject::tr((*it)->getColorBarName()));
|
||||
for (auto it : _colorBars) {
|
||||
QAction* item = menu.addAction(QObject::tr(it->getColorBarName()));
|
||||
item->setCheckable(true);
|
||||
item->setChecked((*it) == current);
|
||||
item->setChecked(it == current);
|
||||
item->setData(QVariant(i++));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user