PD: modernize C++: use range-based for loop
This commit is contained in:
@@ -170,10 +170,10 @@ void TaskFeaturePick::updateList()
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
for (std::vector<featureStatus>::const_iterator st = statuses.begin(); st != statuses.end(); st++) {
|
||||
for (auto status : statuses) {
|
||||
QListWidgetItem* item = ui->listWidget->item(index);
|
||||
|
||||
switch (*st) {
|
||||
switch (status) {
|
||||
case validFeature: item->setHidden(false); break;
|
||||
case invalidShape: item->setHidden(true); break;
|
||||
case isUsed: item->setHidden(!ui->checkUsed->isChecked()); break;
|
||||
@@ -218,8 +218,11 @@ std::vector<App::DocumentObject*> TaskFeaturePick::getFeatures()
|
||||
|
||||
std::vector<App::DocumentObject*> result;
|
||||
|
||||
for (std::vector<QString>::const_iterator s = features.begin(); s != features.end(); ++s)
|
||||
result.push_back(App::GetApplication().getDocument(documentName.c_str())->getObject(s->toLatin1().data()));
|
||||
for (const auto& feature : features) {
|
||||
result.push_back(App::GetApplication()
|
||||
.getDocument(documentName.c_str())
|
||||
->getObject(feature.toLatin1().data()));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -235,7 +238,7 @@ std::vector<App::DocumentObject*> TaskFeaturePick::buildFeatures()
|
||||
|
||||
auto activePart = PartDesignGui::getPartFor(activeBody, false);
|
||||
|
||||
for (std::vector<featureStatus>::const_iterator st = statuses.begin(); st != statuses.end(); st++) {
|
||||
for (auto status : statuses) {
|
||||
QListWidgetItem* item = ui->listWidget->item(index);
|
||||
|
||||
if (item->isSelected() && !item->isHidden()) {
|
||||
@@ -243,21 +246,21 @@ std::vector<App::DocumentObject*> TaskFeaturePick::buildFeatures()
|
||||
auto obj = App::GetApplication().getDocument(documentName.c_str())->getObject(t.toLatin1().data());
|
||||
|
||||
//build the dependent copy or reference if wanted by the user
|
||||
if (*st == otherBody || *st == otherPart || *st == notInBody) {
|
||||
if (status == otherBody || status == otherPart || status == notInBody) {
|
||||
if (!ui->radioXRef->isChecked()) {
|
||||
auto copy = makeCopy(obj, "", ui->radioIndependent->isChecked());
|
||||
|
||||
if (*st == otherBody) {
|
||||
if (status == otherBody) {
|
||||
activeBody->addObject(copy);
|
||||
}
|
||||
else if (*st == otherPart) {
|
||||
else if (status == otherPart) {
|
||||
auto oBody = PartDesignGui::getBodyFor(obj, false);
|
||||
if (!oBody)
|
||||
activePart->addObject(copy);
|
||||
else
|
||||
activeBody->addObject(copy);
|
||||
}
|
||||
else if (*st == notInBody) {
|
||||
else if (status == notInBody) {
|
||||
activeBody->addObject(copy);
|
||||
// doesn't supposed to get here anything but sketch but to be on the safe side better to check
|
||||
if (copy->getTypeId().isDerivedFrom(Sketcher::SketchObject::getClassTypeId())) {
|
||||
|
||||
Reference in New Issue
Block a user