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 d7792826b4
commit 75acacd1b7
175 changed files with 2051 additions and 2057 deletions

View File

@@ -70,10 +70,10 @@ struct ProgressBarPrivate
parent = QWidget::find(window->winId());
}
while (parent) {
QMessageBox* dlg = qobject_cast<QMessageBox*>(parent);
auto* dlg = qobject_cast<QMessageBox*>(parent);
if (dlg && dlg->isModal())
return true;
QProgressDialog* pd = qobject_cast<QProgressDialog*>(parent);
auto* pd = qobject_cast<QProgressDialog*>(parent);
if (pd)
return true;
parent = parent->parentWidget();
@@ -558,7 +558,7 @@ bool ProgressBar::eventFilter(QObject* o, QEvent* e)
QThread* thr = this->thread(); // this is the main thread
if (thr != currentThread) {
if (e->type() == QEvent::KeyPress) {
QKeyEvent* ke = static_cast<QKeyEvent*>(e);
auto ke = static_cast<QKeyEvent*>(e);
if (ke->key() == Qt::Key_Escape) {
// cancel the operation
sequencer->tryToCancel();
@@ -574,7 +574,7 @@ bool ProgressBar::eventFilter(QObject* o, QEvent* e)
// check for ESC
case QEvent::KeyPress:
{
QKeyEvent* ke = static_cast<QKeyEvent*>(e);
auto ke = static_cast<QKeyEvent*>(e);
if (ke->key() == Qt::Key_Escape) {
// eventFilter() was called from the application 50 times without performing a new step (app could hang)
if (d->observeEventFilter > 50) {