Gui: Use auto and range-based for (#7481)
* On lines where the variable type is obvious from inspection, avoid repeating the type using auto. * When possible use a ranged for loop instead of begin() and end() iterators
This commit is contained in:
@@ -179,7 +179,7 @@ PyObject* DocumentPy::addAnnotation(PyObject *args)
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
ViewProviderExtern *pcExt = new ViewProviderExtern();
|
||||
auto pcExt = new ViewProviderExtern();
|
||||
|
||||
pcExt->setModeByFile(psModName ? psModName : "Main", psFileName);
|
||||
pcExt->adjustDocumentName(getDocumentPtr()->getDocument()->getName());
|
||||
@@ -269,7 +269,7 @@ PyObject* DocumentPy::mdiViewsOfType(PyObject *args)
|
||||
PY_TRY {
|
||||
std::list<Gui::MDIView*> views = getDocumentPtr()->getMDIViewsOfType(type);
|
||||
Py::List list;
|
||||
for (std::list<Gui::MDIView*>::iterator it = views.begin(); it != views.end(); ++it)
|
||||
for (auto it = views.begin(); it != views.end(); ++it)
|
||||
list.append(Py::asObject((*it)->getPyObject()));
|
||||
return Py::new_reference_to(list);
|
||||
}
|
||||
@@ -331,7 +331,7 @@ PyObject* DocumentPy::toggleTreeItem(PyObject *args)
|
||||
// get the gui document of the Assembly Item
|
||||
//ActiveAppDoc = Item->getDocument();
|
||||
//ActiveGuiDoc = Gui::Application::Instance->getDocument(getDocumentPtr());
|
||||
Gui::ViewProviderDocumentObject* ActiveVp = dynamic_cast<Gui::ViewProviderDocumentObject*>(getDocumentPtr()->getViewProvider(Object));
|
||||
auto ActiveVp = dynamic_cast<Gui::ViewProviderDocumentObject*>(getDocumentPtr()->getViewProvider(Object));
|
||||
switch (mod) {
|
||||
case 0:
|
||||
getDocumentPtr()->signalExpandObject(*ActiveVp, TreeItemMode::ToggleItem, parent, subname);
|
||||
|
||||
Reference in New Issue
Block a user