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:
berniev
2022-09-15 04:25:13 +10:00
committed by GitHub
parent f7c84dfd09
commit ae53c9b0a4
175 changed files with 2051 additions and 2057 deletions

View File

@@ -289,7 +289,7 @@ void View3DInventor::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
else if (strcmp(Reason,"HighlightColor") == 0) {
float transparency;
SbColor highlightColor(0.8f, 0.1f, 0.1f);
unsigned long highlight = (unsigned long)(highlightColor.getPackedValue());
auto highlight = (unsigned long)(highlightColor.getPackedValue());
highlight = rGrp.GetUnsigned("HighlightColor", highlight);
highlightColor.setPackedValue((uint32_t)highlight, transparency);
SoSFColor col; col.setValue(highlightColor);
@@ -299,7 +299,7 @@ void View3DInventor::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
else if (strcmp(Reason,"SelectionColor") == 0) {
float transparency;
SbColor selectionColor(0.1f, 0.8f, 0.1f);
unsigned long selection = (unsigned long)(selectionColor.getPackedValue());
auto selection = (unsigned long)(selectionColor.getPackedValue());
selection = rGrp.GetUnsigned("SelectionColor", selection);
selectionColor.setPackedValue((uint32_t)selection, transparency);
SoSFColor col; col.setValue(selectionColor);
@@ -570,19 +570,19 @@ bool View3DInventor::onMsg(const char* pMsg, const char** ppReturn)
return true;
}
else if(strcmp("Example1",pMsg) == 0 ) {
SoSeparator * root = new SoSeparator;
auto root = new SoSeparator;
Texture3D(root);
_viewer->setSceneGraph(root);
return true;
}
else if(strcmp("Example2",pMsg) == 0 ) {
SoSeparator * root = new SoSeparator;
auto root = new SoSeparator;
LightManip(root);
_viewer->setSceneGraph(root);
return true;
}
else if(strcmp("Example3",pMsg) == 0 ) {
SoSeparator * root = new SoSeparator;
auto root = new SoSeparator;
AnimationTexture(root);
_viewer->setSceneGraph(root);
return true;
@@ -976,7 +976,7 @@ void View3DInventor::setCurrentViewMode(ViewMode newmode)
this->removeAction(*it);
// Step two
QMdiSubWindow* mdi = qobject_cast<QMdiSubWindow*>(parentWidget());
auto mdi = qobject_cast<QMdiSubWindow*>(parentWidget());
if (mdi && mdi->layout())
mdi->layout()->invalidate();
}
@@ -990,7 +990,7 @@ bool View3DInventor::eventFilter(QObject* watched, QEvent* e)
// Note: We don't need to care about removing an action if its parent widget gets destroyed.
// This does the action itself for us.
if (watched != this && e->type() == QEvent::ActionAdded) {
QActionEvent* a = static_cast<QActionEvent*>(e);
auto a = static_cast<QActionEvent*>(e);
QAction* action = a->action();
if (!action->isSeparator()) {
@@ -1032,7 +1032,7 @@ void View3DInventor::contextMenuEvent (QContextMenuEvent*e)
void View3DInventor::customEvent(QEvent * e)
{
if (e->type() == QEvent::User) {
NavigationStyleEvent* se = static_cast<NavigationStyleEvent*>(e);
auto se = static_cast<NavigationStyleEvent*>(e);
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/View");
if (hGrp->GetBool("SameStyleForAllViews", true))