summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-04-26 09:44:30 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-04-28 11:39:04 +0000
commitf77cd97cacd1603fdca0c3fda405d351a1ccda93 (patch)
tree878d4c46db6c6cd04107c7a2d9d3feb3b0056ad8 /src
parentb52dd27d8544706f7fd03a716f3d41cbc4974b4b (diff)
Avoid default cases
Prefer to list all enums to handling defaults, this makes it easier to catch missing cases in the future. Change-Id: Idae2f445bd907f62202a6b68da0d030e21863afe Reviewed-by: Alexandru Croitor <alexandru.croitor@theqtcompany.com> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index b4a821faa..7795cc41d 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -724,7 +724,9 @@ QAction *QWebEnginePage::action(WebAction action) const
case RequestClose:
text = tr("Close Page");
break;
- default:
+ case NoWebAction:
+ case WebActionCount:
+ Q_UNREACHABLE();
break;
}
@@ -897,8 +899,11 @@ void QWebEnginePage::triggerAction(WebAction action, bool)
case RequestClose:
d->adapter->requestClose();
break;
- default:
+ case NoWebAction:
+ break;
+ case WebActionCount:
Q_UNREACHABLE();
+ break;
}
}
@@ -954,11 +959,10 @@ bool QWebEnginePagePrivate::contextMenuRequested(const WebEngineContextMenuData
QMenu::exec(view->actions(), event.globalPos(), 0, view);
break;
}
- // fall through
- default:
+ // fallthrough
+ case Qt::NoContextMenu:
event.ignore();
return false;
- break;
}
view->d_func()->m_pendingContextMenuEvent = false;
return true;
@@ -1007,8 +1011,6 @@ void QWebEnginePagePrivate::javascriptDialog(QSharedPointer<JavaScriptDialogCont
case InternalAuthorizationDialog:
accepted = (QMessageBox::question(view, controller->title(), controller->message(), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes);
break;
- default:
- Q_UNREACHABLE();
}
if (accepted)
controller->accept();
@@ -1173,7 +1175,7 @@ void QWebEnginePage::setFeaturePermission(const QUrl &securityOrigin, QWebEngine
else
d->adapter->grantMouseLockPermission(false);
break;
- default:
+ case Notifications:
break;
}
}
@@ -1339,7 +1341,6 @@ QStringList QWebEnginePage::chooseFiles(FileSelectionMode mode, const QStringLis
if (!str.isNull())
ret << str;
break;
- default:
case FilePickerController::Open:
str = QFileDialog::getOpenFileName(view(), QString(), oldFiles.first());
if (!str.isNull())