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:
@@ -113,13 +113,13 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Keyboard handling
|
||||
if (type.isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
|
||||
const SoKeyboardEvent * const event = static_cast<const SoKeyboardEvent *>(ev);
|
||||
auto event = static_cast<const SoKeyboardEvent *>(ev);
|
||||
processed = processKeyboardEvent(event);
|
||||
}
|
||||
|
||||
// Mouse Button / Spaceball Button handling
|
||||
if (type.isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
|
||||
const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev;
|
||||
const auto event = (const SoMouseButtonEvent *) ev;
|
||||
const int button = event->getButton();
|
||||
const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
|
||||
@@ -220,7 +220,7 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
// Mouse Movement handling
|
||||
if (type.isDerivedFrom(SoLocation2Event::getClassTypeId())) {
|
||||
this->lockrecenter = true;
|
||||
const SoLocation2Event * const event = (const SoLocation2Event *) ev;
|
||||
const auto event = (const SoLocation2Event *) ev;
|
||||
if (this->currentmode == NavigationStyle::ZOOMING) {
|
||||
this->zoomByCursor(posn, prevnormalized);
|
||||
processed = true;
|
||||
@@ -240,7 +240,7 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Spaceball & Joystick handling
|
||||
if (type.isDerivedFrom(SoMotion3Event::getClassTypeId())) {
|
||||
const SoMotion3Event * const event = static_cast<const SoMotion3Event *>(ev);
|
||||
const auto event = static_cast<const SoMotion3Event *>(ev);
|
||||
if (event)
|
||||
this->processMotionEvent(event);
|
||||
processed = true;
|
||||
|
||||
Reference in New Issue
Block a user