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:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user