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