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

@@ -72,7 +72,7 @@ ViewProviderTextDocument::ViewProviderTextDocument()
void ViewProviderTextDocument::setupContextMenu(QMenu* menu, QObject* receiver, const char* member)
{
Gui::ActionFunction* func = new Gui::ActionFunction(menu);
auto func = new Gui::ActionFunction(menu);
QAction* act = menu->addAction(QObject::tr("Edit text"));
func->trigger(act, std::bind(&ViewProviderTextDocument::doubleClicked, this));
@@ -108,11 +108,11 @@ void ViewProviderTextDocument::onChanged(const App::Property* prop)
else if (prop == &SyntaxHighlighter) {
long value = SyntaxHighlighter.getValue();
if (value == 1) {
PythonSyntaxHighlighter* pythonSyntax = new PythonSyntaxHighlighter(editorWidget);
auto pythonSyntax = new PythonSyntaxHighlighter(editorWidget);
pythonSyntax->setDocument(editorWidget->document());
}
else {
QSyntaxHighlighter* shl = editorWidget->findChild<QSyntaxHighlighter*>();
auto shl = editorWidget->findChild<QSyntaxHighlighter*>();
if (shl)
shl->deleteLater();
}