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

@@ -308,7 +308,7 @@ bool WheelEventFilter::eventFilter(QObject* obj, QEvent* ev)
{
if (qobject_cast<QComboBox*>(obj) && ev->type() == QEvent::Wheel)
return true;
QAbstractSpinBox* sb = qobject_cast<QAbstractSpinBox*>(obj);
auto sb = qobject_cast<QAbstractSpinBox*>(obj);
if (sb) {
if (ev->type() == QEvent::Show) {
sb->setFocusPolicy(Qt::StrongFocus);
@@ -328,7 +328,7 @@ KeyboardFilter::KeyboardFilter(QObject* parent)
bool KeyboardFilter::eventFilter(QObject* obj, QEvent* ev)
{
if (ev->type() == QEvent::KeyPress || ev->type() == QEvent::KeyRelease) {
QKeyEvent *kev = static_cast<QKeyEvent *>(ev);
auto kev = static_cast<QKeyEvent *>(ev);
Qt::KeyboardModifiers mod = kev->modifiers();
int key = kev->key();
if ((mod & Qt::KeypadModifier) && (key == Qt::Key_Period || key == Qt::Key_Comma))