PD: modernize C++: use range-based for loop
This commit is contained in:
@@ -71,10 +71,10 @@ TaskBooleanParameters::TaskBooleanParameters(ViewProviderBoolean *BooleanView,QW
|
||||
|
||||
PartDesign::Boolean* pcBoolean = static_cast<PartDesign::Boolean*>(BooleanView->getObject());
|
||||
std::vector<App::DocumentObject*> bodies = pcBoolean->Group.getValues();
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it = bodies.begin(); it != bodies.end(); ++it) {
|
||||
for (auto body : bodies) {
|
||||
QListWidgetItem* item = new QListWidgetItem(ui->listWidgetBodies);
|
||||
item->setText(QString::fromUtf8((*it)->Label.getValue()));
|
||||
item->setData(Qt::UserRole, QString::fromLatin1((*it)->getNameInDocument()));
|
||||
item->setText(QString::fromUtf8(body->Label.getValue()));
|
||||
item->setData(Qt::UserRole, QString::fromLatin1(body->getNameInDocument()));
|
||||
}
|
||||
|
||||
// Create context menu
|
||||
@@ -355,8 +355,9 @@ bool TaskDlgBooleanParameters::accept()
|
||||
}
|
||||
std::stringstream str;
|
||||
str << Gui::Command::getObjectCmd(obj) << ".setObjects( [";
|
||||
for (std::vector<std::string>::const_iterator it = bodies.begin(); it != bodies.end(); ++it)
|
||||
str << "App.getDocument('" << obj->getDocument()->getName() << "').getObject('" << *it << "'),";
|
||||
for (const auto & body : bodies) {
|
||||
str << "App.getDocument('" << obj->getDocument()->getName() << "').getObject('" << body << "'),";
|
||||
}
|
||||
str << "])";
|
||||
Gui::Command::runCommand(Gui::Command::Doc,str.str().c_str());
|
||||
}
|
||||
@@ -382,8 +383,9 @@ bool TaskDlgBooleanParameters::reject()
|
||||
if (obj->BaseFeature.getValue()) {
|
||||
doc->setShow(obj->BaseFeature.getValue()->getNameInDocument());
|
||||
std::vector<App::DocumentObject*> bodies = obj->Group.getValues();
|
||||
for (std::vector<App::DocumentObject*>::const_iterator b = bodies.begin(); b != bodies.end(); b++)
|
||||
doc->setShow((*b)->getNameInDocument());
|
||||
for (auto body : bodies) {
|
||||
doc->setShow(body->getNameInDocument());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user