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:
@@ -79,26 +79,26 @@ bool Gui::GUIApplicationNativeEventAware::processSpaceballEvent(QObject *object,
|
||||
QApplication::notify(object, event);
|
||||
if (event->type() == Spaceball::MotionEvent::MotionEventType)
|
||||
{
|
||||
Spaceball::MotionEvent *motionEvent = dynamic_cast<Spaceball::MotionEvent*>(event);
|
||||
auto motionEvent = dynamic_cast<Spaceball::MotionEvent*>(event);
|
||||
if (!motionEvent)
|
||||
return true;
|
||||
if (!motionEvent->isHandled())
|
||||
{
|
||||
//make a new event and post to parent.
|
||||
Spaceball::MotionEvent *newEvent = new Spaceball::MotionEvent(*motionEvent);
|
||||
auto newEvent = new Spaceball::MotionEvent(*motionEvent);
|
||||
postEvent(object->parent(), newEvent);
|
||||
}
|
||||
}
|
||||
|
||||
if (event->type() == Spaceball::ButtonEvent::ButtonEventType)
|
||||
{
|
||||
Spaceball::ButtonEvent *buttonEvent = dynamic_cast<Spaceball::ButtonEvent*>(event);
|
||||
auto buttonEvent = dynamic_cast<Spaceball::ButtonEvent*>(event);
|
||||
if (!buttonEvent)
|
||||
return true;
|
||||
if (!buttonEvent->isHandled())
|
||||
{
|
||||
//make a new event and post to parent.
|
||||
Spaceball::ButtonEvent *newEvent = new Spaceball::ButtonEvent(*buttonEvent);
|
||||
auto newEvent = new Spaceball::ButtonEvent(*buttonEvent);
|
||||
postEvent(object->parent(), newEvent);
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ void Gui::GUIApplicationNativeEventAware::postMotionEvent(std::vector<int> motio
|
||||
}
|
||||
importSettings(motionDataArray);
|
||||
|
||||
Spaceball::MotionEvent *motionEvent = new Spaceball::MotionEvent();
|
||||
auto motionEvent = new Spaceball::MotionEvent();
|
||||
motionEvent->setTranslations(motionDataArray[0], motionDataArray[1], motionDataArray[2]);
|
||||
motionEvent->setRotations(motionDataArray[3], motionDataArray[4], motionDataArray[5]);
|
||||
this->postEvent(currentWidget, motionEvent);
|
||||
@@ -126,7 +126,7 @@ void Gui::GUIApplicationNativeEventAware::postButtonEvent(int buttonNumber, int
|
||||
return;
|
||||
}
|
||||
|
||||
Spaceball::ButtonEvent *buttonEvent = new Spaceball::ButtonEvent();
|
||||
auto buttonEvent = new Spaceball::ButtonEvent();
|
||||
buttonEvent->setButtonNumber(buttonNumber);
|
||||
if (buttonPress)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user