[education/rkward] rkward: Fix most clazy warnings

Thomas Friedrichsmeier null at kde.org
Sat Mar 26 16:21:52 GMT 2022


Git commit 7b2061d7a6b4f3d300a79216013ad2e2b19a0bfe by Thomas Friedrichsmeier.
Committed on 26/03/2022 at 16:21.
Pushed by tfry into branch 'master'.

Fix most clazy warnings

M  +3    -3    rkward/agents/rkdebughandler.cpp
M  +1    -1    rkward/agents/rksaveagent.cpp
M  +2    -2    rkward/agents/showedittextfileagent.cpp
M  +3    -3    rkward/core/rkmodificationtracker.cpp
M  +3    -3    rkward/core/robjectlist.cpp
M  +6    -6    rkward/dataeditor/rkvareditmodel.cpp
M  +3    -3    rkward/dataeditor/twintablemember.cpp
M  +19   -19   rkward/dialogs/rkloadlibsdialog.cpp
M  +1    -1    rkward/dialogs/rkrecoverdialog.cpp
M  +3    -3    rkward/dialogs/rksetupwizard.cpp
M  +4    -4    rkward/misc/celleditor.cpp
M  +2    -2    rkward/misc/editformatdialog.cpp
M  +3    -3    rkward/misc/editlabelsdialog.cpp
M  +1    -1    rkward/misc/getfilenamewidget.cpp
M  +5    -5    rkward/misc/multistringselector.cpp
M  +6    -6    rkward/misc/rkaccordiontable.cpp
M  +1    -1    rkward/misc/rkdynamicsearchline.cpp
M  +1    -1    rkward/misc/rkfindbar.cpp
M  +1    -1    rkward/misc/rkjobsequence.cpp
M  +3    -3    rkward/misc/rkobjectlistview.cpp
M  +4    -6    rkward/misc/rkoutputdirectory.cpp
M  +1    -1    rkward/misc/rkprogresscontrol.cpp
M  +1    -1    rkward/misc/rksaveobjectchooser.cpp
M  +1    -1    rkward/misc/rkspecialactions.cpp
M  +1    -1    rkward/misc/rkspinbox.cpp
M  +3    -3    rkward/misc/rktableview.cpp
M  +4    -5    rkward/misc/rkxmlguipreviewarea.cpp
M  +1    -1    rkward/misc/rkxmlguisyncer_p.h
M  +1    -1    rkward/plugin/rkcomponent.cpp
M  +20   -20   rkward/plugin/rkcomponentproperties.cpp
M  +4    -4    rkward/plugin/rkcomponentproperties.h
M  +3    -3    rkward/plugin/rkformula.h
M  +7    -7    rkward/plugin/rkmatrixinput.cpp
M  +9    -9    rkward/plugin/rkoptionset.cpp
M  +6    -6    rkward/plugin/rkstandardcomponent.cpp
M  +4    -4    rkward/plugin/rkstandardcomponentgui.cpp
M  +0    -1    rkward/plugin/rkvarslot.cpp
M  +1    -1    rkward/rbackend/rcommandstack.cpp
M  +2    -2    rkward/rbackend/rkrinterface.cpp
M  +2    -2    rkward/rbackend/rksessionvars.cpp
M  +8    -8    rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
M  +1    -1    rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp
M  +11   -11   rkward/rkconsole.cpp
M  +8    -8    rkward/rkward.cpp
M  +7    -7    rkward/scriptbackends/qtscriptbackend.cpp
M  +1    -1    rkward/scriptbackends/rkcomponentscripting.cpp
M  +3    -3    rkward/scriptbackends/scriptbackend.cpp
M  +1    -1    rkward/scriptbackends/simplebackend.cpp
M  +1    -1    rkward/settings/rksettings.cpp
M  +6    -6    rkward/settings/rksettingsmodule.cpp
M  +1    -1    rkward/settings/rksettingsmodule.h
M  +1    -1    rkward/settings/rksettingsmodulecommandeditor.cpp
M  +0    -1    rkward/settings/rksettingsmodulecommandeditor.h
M  +2    -3    rkward/settings/rksettingsmoduledebug.cpp
M  +1    -1    rkward/settings/rksettingsmodulegeneral.cpp
M  +2    -1    rkward/settings/rksettingsmodulekateplugins.cpp
M  +2    -2    rkward/settings/rksettingsmoduleplugins.cpp
M  +1    -1    rkward/settings/rksettingsmoduler.cpp
M  +4    -3    rkward/windows/katepluginintegration.cpp
M  +1    -1    rkward/windows/rkcodecompletion.cpp
M  +10   -11   rkward/windows/rkcommandeditorwindow.cpp
M  +4    -4    rkward/windows/rkcommandlog.cpp
M  +7    -7    rkward/windows/rkhtmlwindow.cpp
M  +11   -11   rkward/windows/rkmdiwindow.cpp
M  +1    -1    rkward/windows/rktoolwindowbar.cpp
M  +1    -1    rkward/windows/rkwindowcatcher.h
M  +3    -3    rkward/windows/rkworkplace.cpp
M  +5    -5    rkward/windows/rkworkplaceview.cpp

https://invent.kde.org/education/rkward/commit/7b2061d7a6b4f3d300a79216013ad2e2b19a0bfe

diff --git a/rkward/agents/rkdebughandler.cpp b/rkward/agents/rkdebughandler.cpp
index e5bc01ad..e77acdfb 100644
--- a/rkward/agents/rkdebughandler.cpp
+++ b/rkward/agents/rkdebughandler.cpp
@@ -54,7 +54,7 @@ void RKDebugHandler::debugCall (RBackendRequest *request, RCommand *command) {
 	for (int i = 0; i < dummy.size (); ++i) _rel_src_lines.append (dummy.at (i).toInt ());
 
 	_state = InDebugPrompt;
-	newDebugState ();
+	emit newDebugState();
 }
 
 void RKDebugHandler::sendCancel () {
@@ -78,7 +78,7 @@ void RKDebugHandler::submitDebugString (const QString &command) {
 
 	_command = 0;
 	_state = InDebugRun;
-	newDebugState ();
+	emit newDebugState();
 }
 
 void RKDebugHandler::endDebug () {
@@ -87,6 +87,6 @@ void RKDebugHandler::endDebug () {
 	_command = 0;
 	_request = 0;
 	_state = NotInDebugger;
-	newDebugState ();
+	emit newDebugState();
 }
 
diff --git a/rkward/agents/rksaveagent.cpp b/rkward/agents/rksaveagent.cpp
index 8a9f33b1..044c9a74 100644
--- a/rkward/agents/rksaveagent.cpp
+++ b/rkward/agents/rksaveagent.cpp
@@ -93,7 +93,7 @@ bool RKSaveAgent::saveWorkspace(const QUrl& _url) {
 	RKProgressControl control(RKWardMainWindow::getMain(), i18n("Workspace is being saved. <b>Hint:</b> Should this take an unusually long time, on a regular sized workspace, this may be due to other commands still pending completion in the R backend."), i18n("Saving workspace"), RKProgressControl::CancellableNoProgress);
 	control.addRCommand(command, true);
 	bool success = false;
-	QObject::connect(command->notifier(), &RCommandNotifier::commandFinished, [&success, command]() { success = command->succeeded(); });
+	QObject::connect(command->notifier(), &RCommandNotifier::commandFinished, [&success, command]() { success = command->succeeded(); });  // clazy:exclude=lambda-in-connect (-> doModal(), below)
 	RKGlobals::rInterface()->issueCommand(command, save_chain);
 	control.doModal(false);
 	RKGlobals::rInterface()->closeChain(save_chain);
diff --git a/rkward/agents/showedittextfileagent.cpp b/rkward/agents/showedittextfileagent.cpp
index f1fdbfba..89a5830c 100644
--- a/rkward/agents/showedittextfileagent.cpp
+++ b/rkward/agents/showedittextfileagent.cpp
@@ -34,8 +34,8 @@ ShowEditTextFileAgent::ShowEditTextFileAgent (RBackendRequest *request, const QS
 
 	ShowEditTextFileAgent::request = request;
 
-	message = new KMessageWidget (0);
-	message->setText (QString ("<p><strong>%1<strong></p><p>%2</p>").arg (caption).arg (text));
+	message = new KMessageWidget(nullptr);
+	message->setText(QString("<p><strong>%1<strong></p><p>%2</p>").arg(caption, text));
 	if (request) {
 		message->setCloseButtonVisible (false);
 		QAction *done_action = new QAction (QIcon::fromTheme ("dialog-ok"), i18n ("Done"), message);
diff --git a/rkward/core/rkmodificationtracker.cpp b/rkward/core/rkmodificationtracker.cpp
index 7d93c00d..7b203837 100644
--- a/rkward/core/rkmodificationtracker.cpp
+++ b/rkward/core/rkmodificationtracker.cpp
@@ -149,7 +149,7 @@ void RKModificationTracker::renameObject (RObject *object, const QString &new_na
 		sendListenerNotification (RObjectListener::MetaChanged, object, 0, 0, 0);
 
 		QModelIndex object_index = indexFor (object);
-		emit (dataChanged (object_index, object_index));
+		emit dataChanged(object_index, object_index);
 	}
 }
 
@@ -179,7 +179,7 @@ void RKModificationTracker::objectMetaChanged (RObject *object) {
 		sendListenerNotification (RObjectListener::MetaChanged, object, 0, 0, 0);
 
 		QModelIndex object_index = indexFor (object);
-		emit (dataChanged (object_index, object_index));
+		emit dataChanged(object_index, object_index);
 	}
 }
 
@@ -191,7 +191,7 @@ void RKModificationTracker::objectDataChanged (RObject *object, RObject::ChangeS
 		delete changes;
 
 		QModelIndex object_index = indexFor (object);
-		emit (dataChanged (object_index, object_index));	// might have changed dimensions, for instance
+		emit dataChanged(object_index, object_index);	// might have changed dimensions, for instance
 	}
 }
 
diff --git a/rkward/core/robjectlist.cpp b/rkward/core/robjectlist.cpp
index 48165710..bf19ae56 100644
--- a/rkward/core/robjectlist.cpp
+++ b/rkward/core/robjectlist.cpp
@@ -112,7 +112,7 @@ void RObjectList::updateFromR (RCommandChain *chain) {
 		return;
 	}
 
-	emit (updateStarted ());
+	emit updateStarted();
 	update_chain = RKGlobals::rInterface ()->startChain (chain);
 
 	RCommand *command = new RCommand ("list (search (), loadedNamespaces ())", RCommand::App | RCommand::Sync | RCommand::GetStructuredData, QString (), this, ROBJECTLIST_UPDATE_ENVIRONMENTS_COMMAND);
@@ -130,7 +130,7 @@ void RObjectList::updateFromR (RCommandChain *chain, const QStringList &current_
 		return;
 	}
 
-	emit (updateStarted ());
+	emit updateStarted();
 	update_chain = RKGlobals::rInterface ()->startChain (chain);
 
 	updateEnvironments (current_searchpath, false);
@@ -160,7 +160,7 @@ void RObjectList::rCommandDone (RCommand *command) {
 		update_chain = 0;
 	
 		RK_DEBUG (OBJECTS, DL_DEBUG, "object list update complete");
-		emit (updateComplete ());
+		emit updateComplete();
 	} else {
 		RK_ASSERT (false);
 	}
diff --git a/rkward/dataeditor/rkvareditmodel.cpp b/rkward/dataeditor/rkvareditmodel.cpp
index edd1b466..05651af4 100644
--- a/rkward/dataeditor/rkvareditmodel.cpp
+++ b/rkward/dataeditor/rkvareditmodel.cpp
@@ -97,7 +97,7 @@ void RKVarEditModel::objectRemoved (RObject* object) {
 	if (meta_model) meta_model->endRemoveDataObject ();
 	endRemoveColumns ();
 
-	if (objects.size () <= var_col_offset) emit (modelDepleted ());	// editor may or may want to auto-destruct
+	if (objects.size () <= var_col_offset) emit modelDepleted();	// editor may or may want to auto-destruct
 }
 
 void RKVarEditModel::checkDuplicates () {
@@ -126,7 +126,7 @@ void RKVarEditModel::checkDuplicatesNow () {
 		}
 	}
 
-	if (!dupes.isEmpty ()) emit (hasDuplicates (dupes));
+	if (!dupes.isEmpty ()) emit hasDuplicates(dupes);
 }
 
 void RKVarEditModel::objectMetaChanged (RObject* changed) {
@@ -168,7 +168,7 @@ void RKVarEditModel::objectDataChanged (RObject* object, const RObject::ChangeSe
 		scheduleReset ();
 		return;
 	}
-	emit (dataChanged (index (changes->from_index, cindex), index (changes->to_index, cindex)));
+	emit dataChanged(index(changes->from_index, cindex), index(changes->to_index, cindex));
 }
 
 void RKVarEditModel::doInsertColumns (int, int) {
@@ -514,8 +514,8 @@ void RKVarEditMetaModel::endRemoveDataObject () {
 void RKVarEditMetaModel::objectMetaChanged (int atcolumn) {
 	RK_TRACE (EDITOR);
 
-	emit (dataChanged (index (0, atcolumn), index (RowCount - 1, atcolumn)));
-	emit (headerDataChanged (Qt::Horizontal, atcolumn, atcolumn));
+	emit dataChanged(index(0, atcolumn), index(RowCount - 1, atcolumn));
+	emit headerDataChanged (Qt::Horizontal, atcolumn, atcolumn);
 }
 
 int RKVarEditMetaModel::rowCount (const QModelIndex& parent) const {
@@ -916,7 +916,7 @@ void RKVarEditDataFrameModel::objectRemoved (RObject* object) {
 
 	// if the dataframe is gone, the editor will most certainly want to auto-destruct.
 	// since the model will be taken down as well, this has to come last in the function.
-	if (!dataframe) emit (modelObjectDestroyed ());
+	if (!dataframe) emit modelObjectDestroyed();
 }
 
 void RKVarEditDataFrameModel::childAdded (int index, RObject* parent) {
diff --git a/rkward/dataeditor/twintablemember.cpp b/rkward/dataeditor/twintablemember.cpp
index f6eef9d1..e5c4087e 100644
--- a/rkward/dataeditor/twintablemember.cpp
+++ b/rkward/dataeditor/twintablemember.cpp
@@ -155,10 +155,10 @@ void TwinTableMember::handleContextMenuRequest (const QPoint& pos) {
 
 	if (sender () == horizontalHeader ()) {
 		int col = horizontalHeader ()->logicalIndexAt (pos);
-		if (col >= 0) emit (contextMenuRequest (-1, col, horizontalHeader ()->mapToGlobal (pos)));
+		if (col >= 0) emit contextMenuRequest(-1, col, horizontalHeader()->mapToGlobal(pos));
 	} else if (sender () == verticalHeader ()) {
 		int row = verticalHeader ()->logicalIndexAt (pos);
-		if (row >= 0) emit (contextMenuRequest (row, -1, verticalHeader ()->mapToGlobal (pos)));
+		if (row >= 0) emit contextMenuRequest(row, -1, verticalHeader()->mapToGlobal(pos));
 	} else {
 		RK_ASSERT (sender () == this);
 
@@ -167,7 +167,7 @@ void TwinTableMember::handleContextMenuRequest (const QPoint& pos) {
 		if ((row < 0) || (col < 0)) {
 			row = col = -2;	// to differentiate from the headers, above
 		}
-		emit (contextMenuRequest (row, col, mapToGlobal (pos)));
+		emit contextMenuRequest(row, col, mapToGlobal(pos));
 	}
 }
 
diff --git a/rkward/dialogs/rkloadlibsdialog.cpp b/rkward/dialogs/rkloadlibsdialog.cpp
index f31e6398..7bcdf8fd 100644
--- a/rkward/dialogs/rkloadlibsdialog.cpp
+++ b/rkward/dialogs/rkloadlibsdialog.cpp
@@ -106,14 +106,14 @@ void RKLoadLibsDialog::slotPageChanged () {
 }
 
 //static
-void RKLoadLibsDialog::showInstallPackagesModal (QWidget *parent, RCommandChain *chain, const QStringList &package_names) {
-	RK_TRACE (DIALOGS);
+void RKLoadLibsDialog::showInstallPackagesModal(QWidget *parent, RCommandChain *chain, const QStringList &package_names) {
+	RK_TRACE(DIALOGS);
 
-	RKLoadLibsDialog *dialog = new RKLoadLibsDialog (parent, chain, true);
-	QTimer::singleShot (0, [dialog, package_names]() { dialog->automatedInstall(package_names); });		// to get past the dialog->exec, below
-	dialog->setCurrentPage (dialog->install_packages_pageitem);
-	dialog->exec ();
-	RK_TRACE (DIALOGS);
+	RKLoadLibsDialog *dialog = new RKLoadLibsDialog(parent, chain, true);
+	QTimer::singleShot(0, dialog, [dialog, package_names]() { dialog->automatedInstall(package_names); });   // to get past the dialog->exec, below
+	dialog->setCurrentPage(dialog->install_packages_pageitem);
+	dialog->exec();
+	RK_TRACE(DIALOGS);
 }
 
 // static
@@ -158,14 +158,14 @@ void RKLoadLibsDialog::accept () {
 	was_accepted = true;
 	hide ();
 	// will self-destruct once all children are done
-	emit (accepted());
+	emit accepted();
 }
 
 void RKLoadLibsDialog::reject () {
 	was_accepted = false;
 	hide ();
 	// will self-destruct once all children are done
-	emit (rejected());
+	emit rejected();
 }
 
 void RKLoadLibsDialog::rCommandDone (RCommand *command) {
@@ -175,7 +175,7 @@ void RKLoadLibsDialog::rCommandDone (RCommand *command) {
 		RK_ASSERT (command->getDataLength () > 0);
 		// NOTE: The problem is that e.g. R_LIBS_USER is not in .libPaths() if it does not exist, yet. But it should be available as an option, of course
 		library_locations = command->stringVector ();
-		emit (libraryLocationsChanged (library_locations));
+		emit libraryLocationsChanged(library_locations);
 	} else {
 		RK_ASSERT (false);
 	}
@@ -188,7 +188,7 @@ void RKLoadLibsDialog::addLibraryLocation (const QString& new_loc) {
 
 	if (QDir ().mkpath (new_loc)) RKSettingsModuleRPackages::addLibraryLocation (new_loc, chain);
 	library_locations.prepend (new_loc);
-	emit (libraryLocationsChanged (library_locations));
+	emit libraryLocationsChanged(library_locations);
 }
 
 bool RKLoadLibsDialog::removePackages (QStringList packages, QStringList from_liblocs) {
@@ -378,31 +378,31 @@ void RKLoadLibsDialog::runInstallationCommand (const QString& command, bool as_r
 	file.remove ();
 	delete installation_process;
 	installation_process = 0;
-	emit (installedPackagesChanged ());
+	emit installedPackagesChanged();
 }
 
 void RKLoadLibsDialog::installationProcessOutput () {
 	RK_TRACE (DIALOGS);
 	RK_ASSERT (installation_process);
 
-	emit (installationOutput (QString::fromLocal8Bit (installation_process->readAllStandardOutput())));
+	emit installationOutput(QString::fromLocal8Bit(installation_process->readAllStandardOutput()));
 }
 
 void RKLoadLibsDialog::installationProcessError () {
 	RK_TRACE (DIALOGS);
 	RK_ASSERT (installation_process);
 
-	emit (installationError (QString::fromLocal8Bit (installation_process->readAllStandardError ())));
+	emit installationError(QString::fromLocal8Bit(installation_process->readAllStandardError()));
 }
 
 void RKLoadLibsDialog::processExited (int exitCode, QProcess::ExitStatus exitStatus) {
 	RK_TRACE (DIALOGS);
 
 	if (exitCode || (exitStatus != QProcess::NormalExit)) {
-		installationError ('\n' + i18n ("Installation process died with exit code %1", exitCode));
+		emit installationError('\n' + i18n ("Installation process died with exit code %1", exitCode));
 	}
 
-	emit (installationComplete ());
+	emit installationComplete();
 }
 
 ////////////////////// LoadUnloadWidget ////////////////////////////
@@ -512,7 +512,7 @@ void LoadUnloadWidget::rCommandDone (RCommand *command) {
 		loaded_view->sortItems (0, Qt::AscendingOrder);
 		updateCurrentList ();
 	} else if (command->getFlags () == LOAD_PACKAGE_COMMAND) {
-		emit (loadUnloadDone ());
+		emit loadUnloadDone();
 	} else {
 		RK_ASSERT (false);
 	}
@@ -1190,8 +1190,8 @@ bool RKRPackageInstallationStatus::setData (const QModelIndex &index, const QVar
 	if (irow >= 0) installed_status[irow] = stat;
 	if (arow >= 0) available_status[arow] = stat;
 
-	dataChanged (index, index);
-	if (bindex.isValid ()) dataChanged (bindex, bindex);
+	emit dataChanged(index, index);
+	if (bindex.isValid ()) emit dataChanged(bindex, bindex);
 
 	return true;
 }
diff --git a/rkward/dialogs/rkrecoverdialog.cpp b/rkward/dialogs/rkrecoverdialog.cpp
index 8a1c1a11..c58844be 100644
--- a/rkward/dialogs/rkrecoverdialog.cpp
+++ b/rkward/dialogs/rkrecoverdialog.cpp
@@ -89,7 +89,7 @@ QString RKRecoverDialog::saveFileFor (const QString& recovery_file) {
 		QString num;
 		if (i > 0) num = '_' + QString::number (i+1);
 		new_name = dir.absoluteFilePath ("recovered_workspace_" + mtime.toString ("yyyy-MM-dd_hh:mm") + num + ".RData");
-		if (!QFileInfo (new_name).exists ()) break;
+		if (!QFileInfo::exists(new_name)) break;
 	}
 	return new_name;
 }
diff --git a/rkward/dialogs/rksetupwizard.cpp b/rkward/dialogs/rksetupwizard.cpp
index 520a410b..9e663720 100644
--- a/rkward/dialogs/rksetupwizard.cpp
+++ b/rkward/dialogs/rksetupwizard.cpp
@@ -74,11 +74,11 @@ void RKSetupWizardItem::createWidget(QGridLayout *layout, int row) {
 	if (!(longlabel.isEmpty() && options.isEmpty())) {
 		QString details = longlabel;
 		for (int i = 0; i < options.size(); ++i) {
-			details += QString("<p><b>%1</b>: %2</p>").arg(options[i].shortlabel).arg(options[i].longlabel);
+			details += QString("<p><b>%1</b>: %2</p>").arg(options[i].shortlabel, options[i].longlabel);
 		}
 		auto info = new QPushButton();
 		info->setIcon(RKStandardIcons::getIcon(RKStandardIcons::WindowHelp));
-		QObject::connect(info, &QPushButton::clicked, [details, layout]() { KMessageBox::information(layout->parentWidget(), details, QString(), QString(), KMessageBox::Notify | KMessageBox::AllowLink); });
+		QObject::connect(info, &QPushButton::clicked, layout, [details, layout]() { KMessageBox::information(layout->parentWidget(), details, QString(), QString(), KMessageBox::Notify | KMessageBox::AllowLink); });
 		layout->addWidget(info, row, 3);
 	}
 }
@@ -186,7 +186,7 @@ RKSetupWizard::RKSetupWizard(QWidget* parent, InvokationReason reason, const QLi
 	// TODO: Remove, eventually
 	auto legacy_output = new RKSetupWizardItem(i18n("Pre 0.7.3 output file"));
 	QString legacy_output_path = RKSettingsModuleGeneral::filesPath() + "rk_out.html";
-	if (QFileInfo(legacy_output_path).exists()) {
+	if (QFileInfo::exists(legacy_output_path)) {
 		legacy_output->setStatus(RKSetupWizardItem::Warning, i18n("Exists"));
 		legacy_output->setLongLabel(QString("<p>An output file from before RKWard version 0.7.3 was found (%1). You will probably want to convert this to the new format. Alternatively, if it is no longer needed, you can delete it, manually.</p>").arg(legacy_output_path));
 		legacy_output->addOption(i18n("Import"), i18n("Import to the session, so you can save in the new output format."), [](RKSetupWizard* wizard) { wizard->r_commands_to_run.append("rk.import.legacy.output()\n"); });
diff --git a/rkward/misc/celleditor.cpp b/rkward/misc/celleditor.cpp
index 569ae78c..87b04aab 100644
--- a/rkward/misc/celleditor.cpp
+++ b/rkward/misc/celleditor.cpp
@@ -89,22 +89,22 @@ void CellEditor::keyPressEvent (QKeyEvent *e) {
 	if (e->modifiers () == Qt::NoModifier) {
 		if ((e->key () == Qt::Key_Left) || (e->key () == Qt::Key_Backspace)) {
 			if (cursorPosition () < 1) {
-				emit (done (this, RKItemDelegate::EditorExitLeft));
+				emit done(this, RKItemDelegate::EditorExitLeft);
 				return;
 			}
 		}
 		if (e->key () == Qt::Key_Right) {
 			if (cursorPosition () >= (int) text ().length ()) {
-				emit (done (this, RKItemDelegate::EditorExitRight));
+				emit done(this, RKItemDelegate::EditorExitRight);
 				return;
 			}
 		}
 		if (e->key () == Qt::Key_Up) {
-			emit (done (this, RKItemDelegate::EditorExitUp));
+			emit done(this, RKItemDelegate::EditorExitUp);
 			return;
 		}
 		if (e->key () == Qt::Key_Down) {
-			emit (done (this, RKItemDelegate::EditorExitDown));
+			emit done(this, RKItemDelegate::EditorExitDown);
 			return;
 		}
 	}
diff --git a/rkward/misc/editformatdialog.cpp b/rkward/misc/editformatdialog.cpp
index 40e05ad7..4419e768 100644
--- a/rkward/misc/editformatdialog.cpp
+++ b/rkward/misc/editformatdialog.cpp
@@ -142,9 +142,9 @@ void EditFormatDialogProxy::dialogDone (int result) {
 
 	if (result == QDialog::Accepted) {
 		options = dialog->options;
-		emit (done (this, RKItemDelegate::EditorExit));
+		emit done(this, RKItemDelegate::EditorExit);
 	} else {
-		emit (done (this, RKItemDelegate::EditorReject));
+		emit done(this, RKItemDelegate::EditorReject);
 	}
 	dialog->deleteLater ();
 	dialog = 0;
diff --git a/rkward/misc/editlabelsdialog.cpp b/rkward/misc/editlabelsdialog.cpp
index 2a414c10..826b6c01 100644
--- a/rkward/misc/editlabelsdialog.cpp
+++ b/rkward/misc/editlabelsdialog.cpp
@@ -182,7 +182,7 @@ bool RKVarLevelsTableModel::setData (const QModelIndex& index, const QVariant& v
 		endInsertRows ();
 	} else {
 		labels.insert (QString::number (index.row () + 1), text);
-		emit (dataChanged (index, index));
+		emit dataChanged(index, index);
 	}
 
 	if (text.isEmpty ()) {	// remove trailing empty rows
@@ -263,9 +263,9 @@ void EditLabelsDialogProxy::dialogDone (int result) {
 
 	if (result == QDialog::Accepted) {
 		labels = dialog->table->lmodel->labels;
-		emit (done (this, RKItemDelegate::EditorExit));
+		emit done(this, RKItemDelegate::EditorExit);
 	} else {
-		emit (done (this, RKItemDelegate::EditorReject));
+		emit done(this, RKItemDelegate::EditorReject);
 	}
 	dialog->deleteLater ();
 	dialog = 0;
diff --git a/rkward/misc/getfilenamewidget.cpp b/rkward/misc/getfilenamewidget.cpp
index a439b8a4..3991c8c8 100644
--- a/rkward/misc/getfilenamewidget.cpp
+++ b/rkward/misc/getfilenamewidget.cpp
@@ -129,7 +129,7 @@ void GetFileNameWidget::hackOverrideDirDialog () {
 
 void GetFileNameWidget::locationEditChanged (const QString &) {
 	RK_TRACE (MISC);
-	emit (locationChanged ());
+	emit locationChanged();
 }
 
 QString GetFileNameWidget::getLocation () {
diff --git a/rkward/misc/multistringselector.cpp b/rkward/misc/multistringselector.cpp
index 6fc6cb76..04f77a1f 100644
--- a/rkward/misc/multistringselector.cpp
+++ b/rkward/misc/multistringselector.cpp
@@ -71,10 +71,10 @@ void MultiStringSelector::insertNewStringsImpl (int above_row) {
 	RK_TRACE (MISC);
 
 	QStringList new_strings;
-	emit (getNewStrings (&new_strings));
+	emit getNewStrings(&new_strings);
 	model->insertRows (above_row, new_strings.size ());
 	for (int i = new_strings.size () - 1; i >= 0; --i) {
-		model->setData (model->index (above_row + i, 0), new_strings[i]);
+		model->setData(model->index (above_row + i, 0), new_strings[i]);
 	}
 }
 
@@ -174,7 +174,7 @@ void RKMultiStringSelectorV2::buttonClicked () {
 
 	if (sender () == add_button) {
 		if (add_at_bottom || (row < 0)) row = tree_view->model ()->rowCount ();
-		emit (insertNewStrings (row));
+		emit insertNewStrings(row);
 		tree_view->setCurrentIndex (tree_view->model ()->index (row, 0));
 	} else if (row < 0) {	// all actions below need a valid row
 		RK_ASSERT (false);
@@ -190,7 +190,7 @@ void RKMultiStringSelectorV2::buttonClicked () {
 			RK_ASSERT (row < tree_view->model ()->rowCount ());
 			rowb = qMin (row + 1, tree_view->model ()->rowCount () - 1);
 		}
-		emit (swapRows (row, rowb));
+		emit swapRows(row, rowb);
 		tree_view->setCurrentIndex (tree_view->model ()->index (rowb, 0));
 	}
 	anyModelDataChange ();
@@ -213,6 +213,6 @@ void RKMultiStringSelectorV2::updateButtons () {
 
 void RKMultiStringSelectorV2::anyModelDataChange () {
 	RK_TRACE (MISC);
-	emit (listChanged ());
+	emit listChanged();
 }
 
diff --git a/rkward/misc/rkaccordiontable.cpp b/rkward/misc/rkaccordiontable.cpp
index 5ff958c8..d348aae3 100644
--- a/rkward/misc/rkaccordiontable.cpp
+++ b/rkward/misc/rkaccordiontable.cpp
@@ -181,13 +181,13 @@ public slots:
 		endRemoveRows ();
 	}
 	void r_dataChanged (const QModelIndex& from, const QModelIndex& to) {
-		emit (dataChanged (mapFromSource (from), mapFromSource (to)));
+		emit dataChanged(mapFromSource(from), mapFromSource(to));
 	}
 	void r_headerDataChanged(Qt::Orientation o,int from,int to) {
-		emit (headerDataChanged (o, from, to));
+		emit headerDataChanged(o, from, to);
 	}
 	void r_layoutChanged () {
-		emit (layoutChanged());
+		emit layoutChanged();
 	}
 };
 
@@ -391,7 +391,7 @@ void RKAccordionTable::rowClicked (QModelIndex row) {
 	}
 	if (!row.parent ().isValid ()) {
 		if (row.row () >= pmodel->rowCount () - pmodel->add_trailing_rows) {
-			emit (addRow (row.row ()));
+			emit addRow(row.row());
 		}
 	}
 }
@@ -403,7 +403,7 @@ void RKAccordionTable::currentChanged (const QModelIndex& current, const QModelI
 	if (handling_a_click) return;
 	if (!pmodel->isFake (current)) {
 		setExpanded (current, true);
-		emit (activated (current.row ()));
+		emit activated(current.row());
 	}
 }
 
@@ -492,7 +492,7 @@ void RKAccordionTable::removeClicked () {
 		RK_ASSERT (row >= 0);
 		return;
 	}
-	emit (removeRow (row));
+	emit removeRow(row);
 }
 
 void RKAccordionTable::setModel (QAbstractItemModel* model) {
diff --git a/rkward/misc/rkdynamicsearchline.cpp b/rkward/misc/rkdynamicsearchline.cpp
index 57a0d5d7..537c5122 100644
--- a/rkward/misc/rkdynamicsearchline.cpp
+++ b/rkward/misc/rkdynamicsearchline.cpp
@@ -71,5 +71,5 @@ void RKDynamicSearchLine::delayedSearch () {
 	QRegExp filter (term, Qt::CaseInsensitive, allnum ? QRegExp::FixedString : QRegExp::RegExp2);
 	if (model) model->setFilterRegExp (filter);
 	removeAction (working_indicator);
-	emit (searchChanged (filter));
+	emit searchChanged(filter);
 }
diff --git a/rkward/misc/rkfindbar.cpp b/rkward/misc/rkfindbar.cpp
index 976c23d5..b5542cbc 100644
--- a/rkward/misc/rkfindbar.cpp
+++ b/rkward/misc/rkfindbar.cpp
@@ -137,7 +137,7 @@ void RKFindBar::doSearch (bool backward) {
 	show ();
 	bool found = false;
 	QString term = term_edit->currentText ();
-	findRequest (term, backward, this, &found);
+	emit findRequest(term, backward, this, &found);
 	if (!(found || term.isEmpty ())) indicateSearchFail();
 }
 
diff --git a/rkward/misc/rkjobsequence.cpp b/rkward/misc/rkjobsequence.cpp
index a0404c8a..e51dcbca 100644
--- a/rkward/misc/rkjobsequence.cpp
+++ b/rkward/misc/rkjobsequence.cpp
@@ -55,7 +55,7 @@ void RKJobSequence::nextJob () {
 	RK_TRACE (MISC);
 
 	if (outstanding_jobs.isEmpty ()) {
-		emit (finished (this));
+		emit finished(this);
 		deleteLater ();
 		return;
 	}
diff --git a/rkward/misc/rkobjectlistview.cpp b/rkward/misc/rkobjectlistview.cpp
index bd6ffb10..96b27c6b 100644
--- a/rkward/misc/rkobjectlistview.cpp
+++ b/rkward/misc/rkobjectlistview.cpp
@@ -140,7 +140,7 @@ RObject* RKObjectListView::objectAtIndex (const QModelIndex& index) const {
 void RKObjectListView::selectionChanged (const QItemSelection&, const QItemSelection&) {
 	RK_TRACE (APP);
 
-	emit (selectionChanged ());
+	emit selectionChanged();
 }
 
 RObject::ObjectList RKObjectListView::selectedObjects () const {
@@ -162,7 +162,7 @@ void RKObjectListView::contextMenuEvent (QContextMenuEvent* event) {
 
 	menu_object = objectAtIndex (indexAt (event->pos ()));
 	bool suppress = false;
-	emit (aboutToShowContextMenu (menu_object, &suppress));
+	emit aboutToShowContextMenu(menu_object, &suppress);
 
 	if (!suppress) menu->popup (event->globalPos ());
 }
@@ -515,5 +515,5 @@ void RKObjectListViewSettings::updateSelfNow () {
 
 	invalidateFilter ();
 
-	emit (settingsChanged ());
+	emit settingsChanged();
 }
diff --git a/rkward/misc/rkoutputdirectory.cpp b/rkward/misc/rkoutputdirectory.cpp
index 9f1fd3d0..29f0fea8 100644
--- a/rkward/misc/rkoutputdirectory.cpp
+++ b/rkward/misc/rkoutputdirectory.cpp
@@ -159,7 +159,7 @@ GenericRRequestResult RKOutputDirectory::exportAs (const QString& _dest, RKOutpu
 		dest = QDir::cleanPath(dialog.selectedFiles().value(0));
 	}
 
-	bool exists = QFileInfo(dest).exists();
+	bool exists = QFileInfo::exists(dest);
 	if (exists) {
 		if (overwrite == Ask) {
 			const QString warning = i18n("Are you sure you want to overwrite the existing file '%1'?", dest);
@@ -180,7 +180,7 @@ GenericRRequestResult RKOutputDirectory::exportZipInternal(const QString &dest)
 
 	// write to a temporary location, first, then - if successful - copy to final destination
 	QString tempname = dest + '~';
-	while (QFileInfo(tempname).exists()) {
+	while (QFileInfo::exists(tempname)) {
 		tempname.append('~');
 	}
 
@@ -430,7 +430,7 @@ RKOutputDirectoryCallResult RKOutputDirectory::getCurrentOutput(RCommandChain* c
 	if (outputs.isEmpty()) {
 		if (RKSettingsModuleOutput::sharedDefaultOutput()) {
 			QString filename = RKSettingsModuleGeneral::filesPath() + "default.rko";
-			auto ret = get(filename, !QFileInfo(filename).exists(), chain);
+			auto ret = get(filename, !QFileInfo::exists(filename), chain);
 			if (ret.dir()) {
 				ret.dir()->activate(chain);
 				return ret;
@@ -610,7 +610,7 @@ void RKOutputDirectory::setKnownModified(bool modified) {
 	RK_TRACE(APP);
 	if (known_modified != modified) {
 		known_modified = modified;
-		stateChange(isActive(), modified);
+		emit stateChange(isActive(), modified);
 	}
 }
 
@@ -618,5 +618,3 @@ bool RKOutputDirectory::isModifiedFast() const {
 	return known_modified;
 }
 
-
-#include "rkoutputdirectory.moc"
diff --git a/rkward/misc/rkprogresscontrol.cpp b/rkward/misc/rkprogresscontrol.cpp
index 068ee148..488e4e56 100644
--- a/rkward/misc/rkprogresscontrol.cpp
+++ b/rkward/misc/rkprogresscontrol.cpp
@@ -173,7 +173,7 @@ void RKProgressControl::dialogDestroyed () {
 				RKGlobals::rInterface ()->cancelCommand (*it);
 			}
 		}
-		emit (cancelled ());
+		emit cancelled();
 	}
 }
 
diff --git a/rkward/misc/rksaveobjectchooser.cpp b/rkward/misc/rksaveobjectchooser.cpp
index 157f6940..67b25413 100644
--- a/rkward/misc/rksaveobjectchooser.cpp
+++ b/rkward/misc/rksaveobjectchooser.cpp
@@ -190,7 +190,7 @@ void RKSaveObjectChooser::updateState () {
 
 	if ((new_name != current_full_name) || (sender () == overwrite_confirm)) {
 		current_full_name = new_name;
-		emit (changed (isOk ()));
+		emit changed(isOk());
 	}
 }
 
diff --git a/rkward/misc/rkspecialactions.cpp b/rkward/misc/rkspecialactions.cpp
index ca4790a7..547f96c8 100644
--- a/rkward/misc/rkspecialactions.cpp
+++ b/rkward/misc/rkspecialactions.cpp
@@ -38,7 +38,7 @@ void RKPasteSpecialAction::doSpecialPaste () {
 	RKPasteSpecialDialog* dialog = new RKPasteSpecialDialog (associatedWidgets ().first ());
 	int res = dialog->exec ();
 	if (res == QDialog::Accepted) {
-		emit (pasteText (dialog->resultingText()));
+		emit pasteText(dialog->resultingText());
 	}
 	dialog->deleteLater ();
 }
diff --git a/rkward/misc/rkspinbox.cpp b/rkward/misc/rkspinbox.cpp
index c86a81ac..48e3a3bc 100644
--- a/rkward/misc/rkspinbox.cpp
+++ b/rkward/misc/rkspinbox.cpp
@@ -104,7 +104,7 @@ QValidator::State RKSpinBox::validate (QString &input, int &pos) const {
 void RKSpinBox::emitValueChange () {
 	RK_TRACE (MISC);
 
-	emit (valueChanged (0));
+	emit valueChanged(0);
 }
 
 void RKSpinBox::updateValue (int change) {
diff --git a/rkward/misc/rktableview.cpp b/rkward/misc/rktableview.cpp
index 40a32021..199dfb77 100644
--- a/rkward/misc/rktableview.cpp
+++ b/rkward/misc/rktableview.cpp
@@ -102,7 +102,7 @@ void RKTableView::keyPressEvent (QKeyEvent *e) {
 	RK_TRACE (EDITOR);
 
 	if ((e->key () == Qt::Key_Delete) || (e->key () == Qt::Key_Backspace)) {
-		emit (blankSelectionRequest ());
+		emit blankSelectionRequest();
 		e->accept ();
 	} else {
 		QTableView::keyPressEvent (e);
@@ -268,8 +268,8 @@ bool RKItemDelegate::eventFilter (QObject* object, QEvent* event) {
 void RKItemDelegate::editorDone (QWidget* editor, RKItemDelegate::EditorDoneReason reason) {
 	RK_TRACE (EDITOR);
 
-	if (reason != EditorReject) commitData (editor);
-	emit (doCloseEditor (editor, reason));
+	if (reason != EditorReject) emit commitData(editor);
+	emit doCloseEditor(editor, reason);
 	locked_for_modal_editor = false;
 }
 
diff --git a/rkward/misc/rkxmlguipreviewarea.cpp b/rkward/misc/rkxmlguipreviewarea.cpp
index 9837c12d..7617acf4 100644
--- a/rkward/misc/rkxmlguipreviewarea.cpp
+++ b/rkward/misc/rkxmlguipreviewarea.cpp
@@ -88,7 +88,7 @@ QWidget* RKXMLGUIPreviewArea::wrapperWidget () {
 	QToolButton *tb = new QToolButton (wrapper_widget);
 	tb->setAutoRaise (true);
 	tb->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionDelete));
-	connect (tb, &QAbstractButton::clicked, [this]() { wrapper_widget->hide (); emit (previewClosed(this)); });
+	connect (tb, &QAbstractButton::clicked, this, [this]() { wrapper_widget->hide(); emit previewClosed(this); });
 
 	QToolButton *menu_button = new QToolButton (this);
 	menu_button->setPopupMode (QToolButton::InstantPopup);
@@ -197,7 +197,7 @@ void RKPreviewManager::previewCommandDone (RCommand* command) {
 		setNoPreviewAvailable ();
 	} else {
 		QString warnings = command->warnings () + command->error ();
-		if (!warnings.isEmpty ()) warnings = QString ("<b>%1</b>\n<pre>%2</pre>").arg (i18n ("Warnings or Errors:")).arg (warnings.toHtmlEscaped ());
+		if (!warnings.isEmpty ()) warnings = QString("<b>%1</b>\n<pre>%2</pre>").arg(i18n("Warnings or Errors:"), warnings.toHtmlEscaped());
 		setStatusMessage (warnings);
 	}
 }
@@ -212,7 +212,7 @@ void RKPreviewManager::setCommand (RCommand* command) {
 
 	// Send an empty dummy command first. This is to sync up with any commands that should have been run _before_ the preview (e.g. to set up the preview area, so that status labels can be shown)
 	RCommand *dummy = new RCommand (QString (), RCommand::App | RCommand::Sync | RCommand::EmptyCommand);
-	connect (dummy->notifier(), &RCommandNotifier::commandFinished, [this]() { setStatusMessage (shortStatusLabel ()); });
+	connect(dummy->notifier(), &RCommandNotifier::commandFinished, this, [this]() { setStatusMessage(shortStatusLabel()); });
 	RKGlobals::rInterface ()->issueCommand (dummy);
 
 	RKGlobals::rInterface ()->issueCommand (command);
@@ -249,7 +249,7 @@ void RKPreviewManager::setStatusMessage (const QString& message) {
 	RKMDIWindow *window = RKWorkplace::mainWorkplace ()->getNamedWindow (id);
 	if (window) window->setStatusMessage (message);
 
-	emit (statusChanged());
+	emit statusChanged();
 }
 
 QString RKPreviewManager::shortStatusLabel() const {
@@ -266,4 +266,3 @@ QString RKPreviewManager::shortStatusLabel() const {
 	}
 }
 
-#include "rkxmlguipreviewarea.moc"
diff --git a/rkward/misc/rkxmlguisyncer_p.h b/rkward/misc/rkxmlguisyncer_p.h
index 21265d6a..428d08e3 100644
--- a/rkward/misc/rkxmlguisyncer_p.h
+++ b/rkward/misc/rkxmlguisyncer_p.h
@@ -35,7 +35,7 @@ public:
 	explicit RKXMLGUISyncerNotifier (QObject *parent) : QObject (parent) {};
 	~RKXMLGUISyncerNotifier () {};
 
-	void emitChangeSignal (KXMLGUIClient *client) { changed (client); };
+	void emitChangeSignal (KXMLGUIClient *client) { emit changed(client); };
 signals:
 	void changed (KXMLGUIClient *client);
 };
diff --git a/rkward/plugin/rkcomponent.cpp b/rkward/plugin/rkcomponent.cpp
index 93efac3c..923b58d9 100644
--- a/rkward/plugin/rkcomponent.cpp
+++ b/rkward/plugin/rkcomponent.cpp
@@ -382,7 +382,7 @@ void RKComponent::changed () {
 		parentComponent ()->changed ();
 	}
 
-	emit (componentChanged (this));
+	emit componentChanged(this);
 }
 
 RKStandardComponent *RKComponent::standardComponent (QString *id_adjust) const {
diff --git a/rkward/plugin/rkcomponentproperties.cpp b/rkward/plugin/rkcomponentproperties.cpp
index b043f04e..46da0ce9 100644
--- a/rkward/plugin/rkcomponentproperties.cpp
+++ b/rkward/plugin/rkcomponentproperties.cpp
@@ -124,7 +124,7 @@ bool RKComponentPropertyBase::setValue (const QString &string) {
 	RK_TRACE (PLUGIN);
 
 	_value = string;
-	emit (valueChanged (this));
+	emit valueChanged(this);
 	return true;
 }
 
@@ -309,7 +309,7 @@ void RKComponentPropertyStringList::doChange () {
 	RK_TRACE (PLUGIN);
 	is_valid = checkListLength ();
 	_value.clear ();
-	emit (valueChanged (this));
+	emit valueChanged(this);
 }
 
 ///////////////////////////////////////////// Bool //////////////////////////////////////////
@@ -408,7 +408,7 @@ void RKComponentPropertyBool::setBoolValue (bool new_value) {
 	RK_TRACE (PLUGIN);
 
 	internalSetValue (new_value);
-	emit (valueChanged (this));
+	emit valueChanged(this);
 }
 
 bool RKComponentPropertyBool::boolValue () {
@@ -437,7 +437,7 @@ bool RKComponentPropertyBool::setValue (const QString &string) {
 	RK_TRACE (PLUGIN);
 
 	internalSetValue (string);
-	emit (valueChanged (this));
+	emit valueChanged(this);
 	return isValid ();
 }
 
@@ -461,7 +461,7 @@ void RKComponentPropertyBool::governorValueChanged (RKComponentPropertyBase *pro
 	} else {	// fallback for lists, and other stuff that really should not have been connected to a bool property, in the first place
 		internalSetValue (value.toString ());
 	}
-	emit (valueChanged (this));
+	emit valueChanged(this);
 }
 
 
@@ -482,7 +482,7 @@ bool RKComponentPropertyInt::setIntValue (int new_value) {
 	RK_TRACE (PLUGIN);
 
 	internalSetValue (new_value);
-	emit (valueChanged (this));
+	emit valueChanged(this);
 	return (isValid ());
 }
 
@@ -490,7 +490,7 @@ bool RKComponentPropertyInt::setValue (const QString &string) {
 	RK_TRACE (PLUGIN);
 
 	internalSetValue (string);
-	emit (valueChanged (this));
+	emit valueChanged(this);
 	return (isValid ());
 }
 
@@ -592,7 +592,7 @@ void RKComponentPropertyInt::governorValueChanged (RKComponentPropertyBase *prop
 	if (isValid ()) internalSetValue ((int) val);
 	else internalSetValue (value.toString ());
 
-	emit (valueChanged (this));
+	emit valueChanged(this);
 }
 
 QIntValidator *RKComponentPropertyInt::getValidator () {
@@ -637,7 +637,7 @@ bool RKComponentPropertyDouble::setDoubleValue (double new_value) {
 	RK_TRACE (PLUGIN);
 
 	internalSetValue (new_value);
-	emit (valueChanged (this));
+	emit valueChanged(this);
 	return (isValid ());
 }
 
@@ -645,7 +645,7 @@ bool RKComponentPropertyDouble::setValue (const QString &string) {
 	RK_TRACE (PLUGIN);
 
 	internalSetValue (string);
-	emit (valueChanged (this));
+	emit valueChanged(this);
 	return (isValid ());
 }
 
@@ -747,7 +747,7 @@ void RKComponentPropertyDouble::governorValueChanged (RKComponentPropertyBase *p
 	if (is_valid) internalSetValue (val);
 	else internalSetValue (value.toString ());
 
-	emit (valueChanged (this));
+	emit valueChanged(this);
 }
 
 QDoubleValidator *RKComponentPropertyDouble::getValidator () {
@@ -818,7 +818,7 @@ bool RKComponentPropertyRObjects::addObjectValue (RObject *object) {
 
 	if (addObjectValueSilent (object)) {
 		updateValidity ();
-		emit (valueChanged (this));
+		emit valueChanged(this);
 		return isValid ();
 	}
 	return false;
@@ -846,7 +846,7 @@ void RKComponentPropertyRObjects::objectRemoved (RObject *object) {
 		problems.remove (object);
 		stopListenForObject (object);
 		updateValidity ();
-		emit (valueChanged (this));
+		emit valueChanged(this);
 	}
 }
 
@@ -860,7 +860,7 @@ void RKComponentPropertyRObjects::removeAt (int index) {
 	problems.remove (obj);
 	if (!object_list.contains (obj)) stopListenForObject (obj);
 	updateValidity ();
-	emit (valueChanged (this));
+	emit valueChanged(this);
 }
 
 void RKComponentPropertyRObjects::setClassFilter (const QStringList &classes) {
@@ -901,7 +901,7 @@ bool RKComponentPropertyRObjects::setObjectValueSilent (RObject* object) {
 bool RKComponentPropertyRObjects::setObjectValue (RObject *object) {
 	setObjectValueSilent (object);
 	updateValidity ();
-	emit (valueChanged (this));
+	emit valueChanged(this);
 	return isValid ();
 }
 
@@ -914,7 +914,7 @@ void RKComponentPropertyRObjects::setObjectList (const RObject::ObjectList &newl
 			addObjectValueSilent (newlist[i]);
 		}
 		updateValidity ();
-		emit (valueChanged (this));
+		emit valueChanged(this);
 	}
 }
 
@@ -1007,7 +1007,7 @@ bool RKComponentPropertyRObjects::setValueList (const QStringList& values) {
 	}
 
 	updateValidity ();
-	emit (valueChanged (this));
+	emit valueChanged(this);
 	return (isValid () && ok);
 }
 
@@ -1132,7 +1132,7 @@ void RKComponentPropertyRObjects::objectMetaChanged (RObject *object) {
 			if (probs.isEmpty ()) problems.remove (object);
 			else problems.insert (object, probs);
 			updateValidity ();
-			emit (valueChanged (this));
+			emit valueChanged(this);
 		}
 	}
 }
@@ -1154,7 +1154,7 @@ void RKComponentPropertyRObjects::validizeAll (bool silent) {
 
 	updateValidity ();		// we should do this even if there are no changes in the list. There might have still been changes in the filter!
 	if (changes) {
-		if (!silent) emit (valueChanged (this));
+		if (!silent) emit valueChanged(this);
 	}
 }
 
@@ -1387,7 +1387,7 @@ void RKComponentPropertySwitch::selfChanged (RKComponentPropertyBase *) {
 
 void RKComponentPropertySwitch::sourcePropertyChanged (RKComponentPropertyBase*) {
 	RK_TRACE (PLUGIN);
-	valueChanged (this);	// new value will be pulled by anyone interested
+	emit valueChanged(this);	// new value will be pulled by anyone interested
 }
 
 QVariant RKComponentPropertySwitch::value (const QString& modifier) {
diff --git a/rkward/plugin/rkcomponentproperties.h b/rkward/plugin/rkcomponentproperties.h
index 827c3a5a..97869885 100644
--- a/rkward/plugin/rkcomponentproperties.h
+++ b/rkward/plugin/rkcomponentproperties.h
@@ -385,13 +385,13 @@ public:
 
 /** set the preprocess code.
 @param code The code to set. If this is QString (), the property is seen to lack preprocess code and hence is not valid (see isValid ()). In contrast, empty strings are seen as valid */
-	void setPreprocess (const QString &code) { preprocess_code = code; emit (valueChanged (this)); };
+	void setPreprocess (const QString &code) { preprocess_code = code; emit valueChanged(this); };
 /** see setPreprocess () */
-	void setCalculate (const QString &code) { calculate_code = code; emit (valueChanged (this)); };
+	void setCalculate (const QString &code) { calculate_code = code; emit valueChanged(this); };
 /** see setPreprocess () */
-	void setPrintout (const QString &code) { printout_code = code; emit (valueChanged (this)); };
+	void setPrintout (const QString &code) { printout_code = code; emit valueChanged(this); };
 /** see setPreview () */
-	void setPreview (const QString &code) { preview_code = code; emit (valueChanged (this)); };
+	void setPreview (const QString &code) { preview_code = code; emit valueChanged(this); };
 
 	bool isValid () override { return (!(preprocess_code.isNull () || calculate_code.isNull () || printout_code.isNull ())); };
 
diff --git a/rkward/plugin/rkformula.h b/rkward/plugin/rkformula.h
index b16e707b..605093bb 100644
--- a/rkward/plugin/rkformula.h
+++ b/rkward/plugin/rkformula.h
@@ -20,7 +20,7 @@
 #include "rkcomponent.h"
 
 #include <qstring.h>
-#include <qmap.h>
+#include <QHash>
 #include "../core/robject.h"
 
 class QPushButton;
@@ -80,7 +80,7 @@ private:
 	void makeModelString ();
 	QString mangleName (RObject *var);
 	
-	typedef QMap<QTreeWidgetItem*, RObject*> ItemMap;
+	typedef QHash<QTreeWidgetItem*, RObject*> ItemMap;
 	ItemMap predictors_map;
 	
 	struct Interaction {
@@ -88,7 +88,7 @@ private:
 		RObject::ObjectList vars;
 	};
 	
-	typedef QMap<QTreeWidgetItem*, Interaction> InteractionMap;
+	typedef QHash<QTreeWidgetItem*, Interaction> InteractionMap;
 	InteractionMap interaction_map;
 	
 	/** recursively cross the given source variables on level level. Returns the resulting terms in an QList */
diff --git a/rkward/plugin/rkmatrixinput.cpp b/rkward/plugin/rkmatrixinput.cpp
index e0a2345f..f7c2f219 100644
--- a/rkward/plugin/rkmatrixinput.cpp
+++ b/rkward/plugin/rkmatrixinput.cpp
@@ -129,7 +129,7 @@ QVariant RKMatrixInput::value (const QString& modifier) {
 		return QString ("cbind (\n" + ret.join (",\n") + "\n)");
 	} else if (modifier.startsWith (QLatin1String ("row."))) {
 		bool ok;
-		int row = modifier.mid (4).toInt (&ok);
+		int row = modifier.midRef(4).toInt(&ok);
 		if ((row >= 0) && ok) {
 			return (rowStrings (row));
 		}
@@ -187,7 +187,7 @@ void RKMatrixInput::setCellValue (int row, int column, const QString& value) {
 	}
 	col.storage[row] = value;
 	updateColumn (column);
-	model->dataChanged (model->index (row, column), model->index (row, column));
+	emit model->dataChanged(model->index(row, column), model->index(row, column));
 }
 
 void RKMatrixInput::setColumnValue (int column, const QString& value) {
@@ -196,7 +196,7 @@ void RKMatrixInput::setColumnValue (int column, const QString& value) {
 	if (!expandStorageForColumn (column)) return;
 	columns[column].storage = value.split ('\t', QString::KeepEmptyParts);
 	updateColumn (column);
-	model->dataChanged (model->index (0, column), model->index (row_count->intValue () + trailing_rows, column));
+	emit model->dataChanged (model->index(0, column), model->index(row_count->intValue() + trailing_rows, column));
 }
 
 void RKMatrixInput::updateColumn (int column) {
@@ -310,7 +310,7 @@ void RKMatrixInput::updateAll () {
 	}
 	if (new_valid != is_valid) {
 		is_valid = new_valid;
-		model->headerDataChanged (Qt::Horizontal, 0, column_count->intValue () - 1);
+		emit model->headerDataChanged(Qt::Horizontal, 0, column_count->intValue() - 1);
 	}
 	changed ();
 }
@@ -332,9 +332,9 @@ void RKMatrixInput::dimensionPropertyChanged (RKComponentPropertyBase *property)
 		}
 	}
 
-	model->layoutAboutToBeChanged ();
-	updateAll ();
-	model->layoutChanged ();
+	emit model->layoutAboutToBeChanged();
+	updateAll();
+	emit model->layoutChanged();
 }
 
 void RKMatrixInput::tsvPropertyChanged () {
diff --git a/rkward/plugin/rkoptionset.cpp b/rkward/plugin/rkoptionset.cpp
index 5cbd129d..76befe69 100644
--- a/rkward/plugin/rkoptionset.cpp
+++ b/rkward/plugin/rkoptionset.cpp
@@ -256,7 +256,7 @@ void RKOptionSet::fetchPropertyValuesRecursive (PropertyValueMap *list, bool inc
 void RKOptionSet::serializationPropertyChanged (RKComponentPropertyBase* property) {
 	if (updating) return;
 	updating = true;
-	if (model) model->layoutAboutToBeChanged ();
+	if (model) emit model->layoutAboutToBeChanged();
 
 	RK_TRACE (PLUGIN);
 	RK_ASSERT (property == serialization_of_set);
@@ -333,7 +333,7 @@ void RKOptionSet::serializationPropertyChanged (RKComponentPropertyBase* propert
 	active_row = -1;
 	current_row->setIntValue (qMin (0, row - 1));
 
-	if (model) model->layoutChanged ();
+	if (model) emit model->layoutChanged();
 	changed ();
 }
 
@@ -494,7 +494,7 @@ void RKOptionSet::setRowState (int row, bool finished, bool valid) {
 		valid ? --n_invalid_rows : ++n_invalid_rows;
 		changed = true;
 	}
-	if (changed && model) model->dataChanged (model->index (row, 0), model->index (row, model->columnCount () - 1));
+	if (changed && model) emit model->dataChanged(model->index(row, 0), model->index(row, model->columnCount() - 1));
 }
 
 void RKOptionSet::changed () {
@@ -510,7 +510,7 @@ void RKOptionSet::changed () {
 	ComponentStatus s = recursiveStatus ();
 	if (s != last_known_status) {
 		last_known_status = s;
-		if (model) model->headerDataChanged (Qt::Horizontal, 0, model->columnCount () - 1);
+		if (model) emit model->headerDataChanged(Qt::Horizontal, 0, model->columnCount() - 1);
 	}
 
 	RKComponent::changed ();
@@ -533,7 +533,7 @@ void RKOptionSet::governingPropertyChanged (RKComponentPropertyBase *property) {
 		target->setValueAt (row, value);
 
 		if (model && (inf.display_index >= 0)) {
-			model->dataChanged (model->index (inf.display_index, row), model->index (inf.display_index, row));
+			emit model->dataChanged(model->index(inf.display_index, row), model->index(inf.display_index, row));
 		}
 	}
 
@@ -556,7 +556,7 @@ void RKOptionSet::columnPropertyChanged (RKComponentPropertyBase *property) {
 
 	if (target == keycolumn) handleKeycolumnUpdate ();
 	else {
-		if (model) model->dataChanged (model->index (ci.display_index, 0), model->index (ci.display_index, model->rowCount ()));
+		if (model) emit model->dataChanged(model->index(ci.display_index, 0), model->index(ci.display_index, model->rowCount()));
 		applyContentsFromExternalColumn (target, active_row);
 	}
 }
@@ -823,7 +823,7 @@ QVariant RKOptionSetDisplayModel::data (const QModelIndex& index, int role) cons
 
 void RKOptionSetDisplayModel::doResetNow () {
 	RK_TRACE (PLUGIN);
-	emit (layoutChanged ());
+	emit layoutChanged();
 	set->updateCurrentRowInDisplay ();
 }
 
@@ -842,7 +842,7 @@ QVariant RKOptionSetDisplayModel::headerData (int section, Qt::Orientation orien
 				if ((set->rowCount () > 0) && (set->rowCount () < set->min_rows_if_any)) probs.append (i18n ("At least %1 rows have to be defined (if any)", set->min_rows_if_any));
 				if (set->rowCount () < set->min_rows) probs.append (i18n ("At least %1 rows have to be defined", set->min_rows));
 				if (set->rowCount () > set->max_rows) probs.append (i18n ("At most %1 rows may be defined", set->max_rows));
-				return (QString ("<p>%1</p><ul><li>%2</li></ul>").arg (i18n ("This element is not valid for the following reason(s):")).arg (probs.join ("</li>\n<li>")));
+				return (QString ("<p>%1</p><ul><li>%2</li></ul>").arg(i18n("This element is not valid for the following reason(s):"), probs.join("</li>\n<li>")));
 			}
 		}
 	}
@@ -852,7 +852,7 @@ QVariant RKOptionSetDisplayModel::headerData (int section, Qt::Orientation orien
 void RKOptionSetDisplayModel::triggerReset() {
 	RK_TRACE (PLUGIN);
 	if (!reset_timer.isActive ()) {
-		emit (layoutAboutToBeChanged ());
+		emit layoutAboutToBeChanged();
 		reset_timer.start ();
 	}
 }
diff --git a/rkward/plugin/rkstandardcomponent.cpp b/rkward/plugin/rkstandardcomponent.cpp
index 95d05d06..f38cc1f8 100644
--- a/rkward/plugin/rkstandardcomponent.cpp
+++ b/rkward/plugin/rkstandardcomponent.cpp
@@ -123,9 +123,9 @@ RKStandardComponent::RKStandardComponent (RKComponent *parent_component, QWidget
 	if (!backend->initialize (code, parent_component == 0)) return;
 
 	// check for existence of help file
-	element = xml->getChildElement (doc_element, "help", DL_WARNING);
-	QString dummy = QFileInfo (filename).path() + '/' + xml->getStringAttribute (element, "file", "::nosuchfile::", DL_INFO);
-	have_help = QFileInfo (dummy).exists ();
+	element = xml->getChildElement(doc_element, "help", DL_WARNING);
+	QString dummy = QFileInfo(filename).path() + '/' + xml->getStringAttribute(element, "file", "::nosuchfile::", DL_INFO);
+	have_help = QFileInfo::exists(dummy);
 
 	update_pending = false;
 
@@ -362,7 +362,7 @@ void RKStandardComponent::buildAndInitialize (const QDomElement &doc_element, co
 		QTimer::singleShot (0, gui, SLOT (show()));
 	}
 	changed ();
-	standardInitializationComplete ();
+	emit standardInitializationComplete();
 }
 
 RKXMLGUIPreviewArea* RKStandardComponent::addDockedPreview (RKComponentPropertyBool* controller, const QString& label, const QString &id) {
@@ -720,7 +720,7 @@ void RKComponentBuilder::parseLogic (const QDomElement &element, XMLHelper &xml,
 
 	if (element.isNull ()) return;
 
-	QMap<RKComponentPropertyBase*, QStringList> switch_convert_sources;
+	QHash<RKComponentPropertyBase*, QStringList> switch_convert_sources;
 
 	const XMLChildList children = xml.getChildElements (element, QString (), DL_ERROR);
 	for (int i = 0; i < children.size (); ++i) {
@@ -813,7 +813,7 @@ void RKComponentBuilder::parseLogic (const QDomElement &element, XMLHelper &xml,
 	}
 
 	// resolve source properties for switch and convert elements, *after* all properties have been created
-	for (QMap<RKComponentPropertyBase*, QStringList>::const_iterator it = switch_convert_sources.constBegin (); it != switch_convert_sources.constEnd (); ++it) {
+	for (auto it = switch_convert_sources.constBegin(); it != switch_convert_sources.constEnd(); ++it) {
 		if (it.key ()->type () == RKComponentBase::PropertyConvert) {
 			static_cast<RKComponentPropertyConvert*> (it.key ())->setSources (it.value ());
 		} else {
diff --git a/rkward/plugin/rkstandardcomponentgui.cpp b/rkward/plugin/rkstandardcomponentgui.cpp
index 5e5c6af0..4166e20f 100644
--- a/rkward/plugin/rkstandardcomponentgui.cpp
+++ b/rkward/plugin/rkstandardcomponentgui.cpp
@@ -110,10 +110,10 @@ public:
 		}
 	};
 
-	void saveSize () {
-		if (extension->isVisible ()) {
-			if (orientation () == Qt::Horizontal) RKSettingsModulePlugins::setDefaultSidePreviewWidth (sizes ()[1]);
-			else RKSettingsModulePlugins::setDefaultCodeHeight (sizes ()[1]);
+	void saveSize() {
+		if (extension->isVisible()) {
+			if (orientation() == Qt::Horizontal) RKSettingsModulePlugins::setDefaultSidePreviewWidth(sizes().at(1));
+			else RKSettingsModulePlugins::setDefaultCodeHeight(sizes().at(1));
 		}
 	}
 
diff --git a/rkward/plugin/rkvarslot.cpp b/rkward/plugin/rkvarslot.cpp
index 6a2ae601..e709013f 100644
--- a/rkward/plugin/rkvarslot.cpp
+++ b/rkward/plugin/rkvarslot.cpp
@@ -181,7 +181,6 @@ void RKVarSlot::availablePropertyChanged (RKComponentPropertyBase *) {
 void RKVarSlot::updateLook () {
 	RK_TRACE (PLUGIN);
 
-	QPalette palette = list->palette ();
 	if (!isSatisfied ()) {		// implies that it is enabled
 		list->setStyleSheet(QString("background: red; color: black"));
 	} else {
diff --git a/rkward/rbackend/rcommandstack.cpp b/rkward/rbackend/rcommandstack.cpp
index c72b0f3a..02eb6d00 100644
--- a/rkward/rbackend/rcommandstack.cpp
+++ b/rkward/rbackend/rcommandstack.cpp
@@ -382,6 +382,6 @@ void RCommandStackModel::itemChange (RCommandChain* item) {
 	RK_TRACE (RBACKEND);
 
 	QModelIndex item_index = indexFor (item);
-	emit (dataChanged (item_index, item_index));
+	emit dataChanged(item_index, item_index);
 }
 
diff --git a/rkward/rbackend/rkrinterface.cpp b/rkward/rbackend/rkrinterface.cpp
index 0310e267..052c2f86 100644
--- a/rkward/rbackend/rkrinterface.cpp
+++ b/rkward/rbackend/rkrinterface.cpp
@@ -564,7 +564,7 @@ GenericRRequestResult RInterface::processPlainGenericRequest(const QStringList &
 	} else if (call == "wdChange") {
 		// in case of separate processes, apply new working directory in frontend, too.
 		QDir::setCurrent (calllist.value (1));
-		emit (backendWorkdirChanged());
+		emit backendWorkdirChanged();
 	} else if (call == "highlightRCode") {
 		return GenericRRequestResult(RKCommandHighlighter::commandToHTML(calllist.value(1)));
 	} else if (call == "quit") {
@@ -762,7 +762,7 @@ int addButtonToBox (QDialog *dialog, QDialogButtonBox *box, QDialogButtonBox::St
 	QPushButton *button = box->addButton (which);
 	if (text != def_text) button->setText (text);
 	if (is_default) button->setDefault (true);
-	QObject::connect (button, &QPushButton::clicked, [dialog, which]() { dialog->done (which); });
+	QObject::connect(button, &QPushButton::clicked, dialog, [dialog, which]() { dialog->done(which); });
 	return 1;
 }
 
diff --git a/rkward/rbackend/rksessionvars.cpp b/rkward/rbackend/rksessionvars.cpp
index dd48937c..ed226b77 100644
--- a/rkward/rbackend/rksessionvars.cpp
+++ b/rkward/rbackend/rksessionvars.cpp
@@ -54,7 +54,7 @@ void RKSessionVars::setInstalledPackages (const QStringList &new_list) {
 	RK_TRACE (RBACKEND);
 
 	installed_packages = new_list;
-	emit (installedPackagesChanged ());
+	emit installedPackagesChanged();
 }
 
 void RKSessionVars::setRVersion (const QString& version_string) {
@@ -80,7 +80,7 @@ quint32 RKSessionVars::parseVersionString (const QString &version, QString *suff
 		while (1) {
 			++pos;
 			if (!(pos < version.size () && version[pos].isDigit ())) {
-				int val = version.mid (opos, pos - opos).toInt ();
+				int val = version.midRef(opos, pos - opos).toInt();
 				if ((val < 0) || (val > 255) || (pos == opos)) {
 					RK_DEBUG (MISC, DL_ERROR, "Invalid version specification '%s'", qPrintable (version));
 					if (val > 255) val = 255;
diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp b/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
index 471f907a..e42570f2 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
@@ -551,8 +551,8 @@ void RKGraphicsDevice::setActive (bool active) {
 	if (!view) return;
 	if (active) view->setWindowTitle (i18nc ("Window title", "%1 (Active)", base_title));
 	else view->setWindowTitle (i18nc ("Window title", "%1 (Inactive)", base_title));
-	emit (activeChanged (active));
-	emit (captionChanged (view->windowTitle ()));
+	emit activeChanged(active);
+	emit captionChanged(view->windowTitle ());
 }
 
 void RKGraphicsDevice::goInteractive (const QString& prompt) {
@@ -567,7 +567,7 @@ void RKGraphicsDevice::goInteractive (const QString& prompt) {
 	view->setToolTip (prompt);
 	view->show ();
 	view->raise ();
-	emit (goingInteractive (true, prompt));
+	emit goingInteractive(true, prompt);
 }
 
 void RKGraphicsDevice::locator () {
@@ -606,7 +606,7 @@ void RKGraphicsDevice::newPageDialogDone (int result) {
 	RK_TRACE (GRAPHICS_DEVICE);
 
 	RK_ASSERT (dialog);
-	emit (newPageConfirmDone (result == QDialog::Accepted));
+	emit newPageConfirmDone(result == QDialog::Accepted);
 	interaction_opcode = -1;
 	stopInteraction ();
 }
@@ -647,7 +647,7 @@ bool RKGraphicsDevice::eventFilter (QObject *watched, QEvent *event) {
 		if (event->type () == QEvent::MouseButtonRelease) {
 			QMouseEvent *me = static_cast<QMouseEvent*> (event);
 			if (me->button () == Qt::LeftButton) {
-				emit (locatorDone (true, me->x (), me->y ()));
+				emit locatorDone(true, me->x(), me->y());
 				interaction_opcode = -1;
 			}
 			stopInteraction ();
@@ -714,10 +714,10 @@ void RKGraphicsDevice::stopInteraction () {
 	RK_TRACE (GRAPHICS_DEVICE);
 
 	if (interaction_opcode == RKDLocator) {
-		emit (locatorDone (false, 0.0, 0.0));
+		emit locatorDone(false, 0.0, 0.0);
 	} else if (interaction_opcode == RKDNewPageConfirm) {
 		RK_ASSERT (dialog);
-		emit (newPageConfirmDone (true));
+		emit newPageConfirmDone(true);
 	} else if (interaction_opcode == RKDStartGettingEvents) {
 		// not much to do, fortunately, as getting graphics events is non-blocking
 		stored_events.clear ();
@@ -736,7 +736,7 @@ void RKGraphicsDevice::stopInteraction () {
 		checkSize ();
 		view->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred);
 	}
-	emit (goingInteractive (false, QString ()));
+	emit goingInteractive(false, QString());
 	interaction_opcode = -1;
 }
 
diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp
index d21ebb1b..744373d5 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp
@@ -258,7 +258,7 @@ void RKGraphicsDeviceFrontendTransmitter::newData () {
 			if (!device) {
 				if (opcode == RKDCancel) {
 					RK_DEBUG (GRAPHICS_DEVICE, DL_WARNING, "Graphics operation canceled");
-					emit (stopInteraction());
+					emit stopInteraction();
 				} else if (opcode == RKDQueryResolution) {
 					QDesktopWidget *desktop = QApplication::desktop ();
 					streamer.outstream << (qint32) desktop->physicalDpiX () << (qint32) desktop->physicalDpiY ();
diff --git a/rkward/rkconsole.cpp b/rkward/rkconsole.cpp
index 09808d61..aa5de60f 100644
--- a/rkward/rkconsole.cpp
+++ b/rkward/rkconsole.cpp
@@ -476,11 +476,11 @@ void RKConsole::submitCommand () {
 			last_line_end = 0;
 			RK_ASSERT (false);
 		}
-		command.append (input_buffer.left (last_line_end));
-		if (last_line_end < (input_buffer.size () - 1)) {
-			input_buffer = input_buffer.mid (last_line_end + 1);
+		command.append(input_buffer.leftRef(last_line_end));
+		if (last_line_end < (input_buffer.size() - 1)) {
+			input_buffer = input_buffer.mid(last_line_end + 1);
 		} else {
-			input_buffer.clear ();
+			input_buffer.clear();
 		}
 	} else {
 		RK_ASSERT (!command.endsWith ('\n'));
@@ -613,8 +613,8 @@ void RKConsole::submitBatch (const QString &batch) {
 		QString line = currentEditingLine ();
 		int pos = currentCursorPositionInCommand ();
 		if (pos >= 0) {
-			setCurrentEditingLine (line.left (pos));
-			input_buffer.append (line.mid (pos));
+			setCurrentEditingLine(line.left(pos));
+			input_buffer.append(line.midRef(pos));
 		}
 	}
 	if (!current_command) tryNextInBuffer ();
@@ -744,12 +744,12 @@ QString RKConsole::cleanSelection (const QString &origin) {
 	ret.reserve (origin.length ());
 	QStringList lines = origin.split ('\n');
 	foreach (const QString& line, lines) {
-		if (line.startsWith (nprefix)) {
-			ret.append (line.mid (nprefix.length ()));
-		} else if (line.startsWith (iprefix)) {
-			ret.append (line.mid (iprefix.length ()));
+		if (line.startsWith(nprefix)) {
+			ret.append(line.midRef(nprefix.length()));
+		} else if (line.startsWith(iprefix)) {
+			ret.append(line.midRef(iprefix.length()));
 		} else {
-			ret.append (line);
+			ret.append(line);
 		}
 		ret.append ('\n');
 	}
diff --git a/rkward/rkward.cpp b/rkward/rkward.cpp
index 81d0c4e2..69d0c482 100644
--- a/rkward/rkward.cpp
+++ b/rkward/rkward.cpp
@@ -218,10 +218,10 @@ void RKWardMainWindow::closeEvent (QCloseEvent *e) {
 		return;
 	}
 
-	e->ignore ();
-	if (doQueryQuit ()) {
-		emit (aboutToQuitRKWard());
-		new RKQuitAgent (this);
+	e->ignore();
+	if (doQueryQuit()) {
+		emit aboutToQuitRKWard();
+		new RKQuitAgent(this);
 	}
 }
 
@@ -365,11 +365,11 @@ void RKWardMainWindow::initPlugins (const QStringList &automatically_added) {
 	}
 	if (!completely_broken_maps.isEmpty ()) {
 		QString maplist = "<ul><li>" + completely_broken_maps.join ("</li>\n<li>") + "</li></ul>";
-		KMessageBox::detailedError (0, QString ("<p>%1</p><p>%2</p>").arg (i18n ("The following RKWard pluginmap files could not be loaded, and have been disabled. This could be because they are broken, not compatible with this version of RKWard, or not meant for direct loading (see the 'Details' for more information). They have been disabled.")).arg (maplist), completely_broken_maps_details.join ("\n"), i18n ("Failed to load some plugin maps"));
+		KMessageBox::detailedError (0, QString ("<p>%1</p><p>%2</p>").arg (i18n ("The following RKWard pluginmap files could not be loaded, and have been disabled. This could be because they are broken, not compatible with this version of RKWard, or not meant for direct loading (see the 'Details' for more information). They have been disabled."), maplist), completely_broken_maps_details.join ("\n"), i18n ("Failed to load some plugin maps"));
 	}
 	if (!somewhat_broken_maps.isEmpty ()) {
 		QString maplist = "<ul><li>" + somewhat_broken_maps.join ("</li>\n<li>") + "</li></ul>";
-		KMessageBox::detailedError (0, QString ("<p>%1</p><p>%2</p><p>%3</p>").arg (i18n ("Some errors were encountered while loading the following RKWard pluginmap files. This could be because individual plugins are broken or not compatible with this version of RKWard (see the 'Details' for more information). Other plugins were loaded, successfully, however.")).arg (maplist).arg (i18n ("Note: You will not be warned about these pluginmap files again, until you upgrade RKWard, or remove and re-add them in Settings->Configure RKWard->Plugins.")), somewhat_broken_maps_details.join ("\n"), i18n ("Failed to load some plugin maps"));
+		KMessageBox::detailedError (0, QString ("<p>%1</p><p>%2</p><p>%3</p>").arg (i18n ("Some errors were encountered while loading the following RKWard pluginmap files. This could be because individual plugins are broken or not compatible with this version of RKWard (see the 'Details' for more information). Other plugins were loaded, successfully, however."), maplist, i18n ("Note: You will not be warned about these pluginmap files again, until you upgrade RKWard, or remove and re-add them in Settings->Configure RKWard->Plugins.")), somewhat_broken_maps_details.join ("\n"), i18n ("Failed to load some plugin maps"));
 	}
 
 	slotSetStatusReady ();
@@ -396,7 +396,7 @@ void RKWardMainWindow::startR () {
 			RK_DEBUG(APP, DL_INFO, "RKWard version changed. Discarding cached package at %s", qPrintable (package));
 			QFile::remove (package);
 		}
-		if (!QFileInfo (package).exists()) {
+		if (!QFileInfo::exists(package)) {
 			RK_DEBUG(APP, DL_INFO, "Copying rkward R source package to %s", qPrintable (package));
 			RK_ASSERT(QFile::copy (RKCommonFunctions::getRKWardDataDir () + "/rpackages/" + packages[i], package));
 		}
@@ -732,7 +732,7 @@ void RKWardMainWindow::initStatusBar () {
 	// Instead, we use a right-aligned bar merged into the bottom toolbar -> no space wasted.
 	//statusBar()->hide(); -> after geomtry has been set
 	auto realbar = RKWorkplace::mainWorkplace()->statusBar();
-	connect(statusBar(), &QStatusBar::messageChanged, [this](const QString &message) {
+	connect(statusBar(), &QStatusBar::messageChanged, this, [this](const QString &message) {
 		if(message.isEmpty()) updateCWD();
 		else statusbar_cwd->setText(message);
 		// realbar->showMessage(message);  // why doesn't this work, instead? Qt 5.12.8
diff --git a/rkward/scriptbackends/qtscriptbackend.cpp b/rkward/scriptbackends/qtscriptbackend.cpp
index cc9f8406..a40079da 100644
--- a/rkward/scriptbackends/qtscriptbackend.cpp
+++ b/rkward/scriptbackends/qtscriptbackend.cpp
@@ -122,7 +122,7 @@ void QtScriptBackend::threadError (const QString &message) {
 
 	KMessageBox::error (0, i18n ("The QtScript-backend has reported an error:\n%1", message), i18n ("Scripting error"));
 
-	emit (haveError ());
+	emit haveError();
 	destroy ();
 }
 
@@ -135,7 +135,7 @@ void QtScriptBackend::commandDone (const QString &result) {
 void QtScriptBackend::needData (const QString &identifier, const int hint) {
 	RK_TRACE (PHP);
 
-	emit (requestValue (identifier, hint));
+	emit requestValue(identifier, hint);
 }
 
 
@@ -195,7 +195,7 @@ void QtScriptBackendThread::setData (const QVariant &data) {
 QVariant QtScriptBackendThread::getValue (const QString &identifier, const int hint) {
 	RK_TRACE (PHP);
 
-	emit (needData (identifier, hint));
+	emit needData(identifier, hint);
 
 	QVariant ret;
 	while (1) {
@@ -242,7 +242,7 @@ bool QtScriptBackendThread::scriptError () {
 
 	QString message = i18n ("Script Error: %1\nBacktrace:\n%2", engine.uncaughtException ().toString (), engine.uncaughtExceptionBacktrace ().join ("\n"));
 	engine.clearExceptions ();
-	emit (error (message));
+	emit error(message);
 
 	return true;
 }
@@ -258,7 +258,7 @@ bool QtScriptBackendThread::includeFile (const QString &filename) {
 
 		QFile file (_filename);
 		if (!file.open (QIODevice::ReadOnly | QIODevice::Text)) {
-		emit (error (i18n ("The file \"%1\" (needed by \"%2\") could not be found. Please check your installation.", _filename, _scriptfile)));
+		emit error(i18n("The file \"%1\" (needed by \"%2\") could not be found. Please check your installation.", _filename, _scriptfile));
 		return false;
 	}
 
@@ -293,7 +293,7 @@ void QtScriptBackendThread::run () {
 #endif
 	if (!includeFile (_scriptfile)) return;
 
-	emit (commandDone ("startup complete"));
+	emit commandDone("startup complete");
 
 	QString command;
 	while (1) {
@@ -318,7 +318,7 @@ void QtScriptBackendThread::run () {
 		// do it!
 		QScriptValue result = engine.evaluate (command);
 		if (scriptError ()) return;
-		emit (commandDone (result.toString ()));
+		emit commandDone(result.toString());
 
 		command.clear ();
 	}
diff --git a/rkward/scriptbackends/rkcomponentscripting.cpp b/rkward/scriptbackends/rkcomponentscripting.cpp
index 96ba0bee..14c6b307 100644
--- a/rkward/scriptbackends/rkcomponentscripting.cpp
+++ b/rkward/scriptbackends/rkcomponentscripting.cpp
@@ -82,7 +82,7 @@ void RKComponentScriptingProxy::handleScriptError (const QString& current_file)
 		QString message = i18n ("Script Error at '%1' line %2: %3\n", file.isEmpty() ? i18n ("inlined code") : file, engine.uncaughtExceptionLineNumber (), engine.uncaughtException ().toString ());
 		KMessageBox::detailedError (0, message, engine.uncaughtExceptionBacktrace ().join ("\n"));
 		engine.clearExceptions ();
-		emit (haveError());
+		emit haveError();
 	}
 }
 
diff --git a/rkward/scriptbackends/scriptbackend.cpp b/rkward/scriptbackends/scriptbackend.cpp
index 6d8eb660..46cdacb1 100644
--- a/rkward/scriptbackends/scriptbackend.cpp
+++ b/rkward/scriptbackends/scriptbackend.cpp
@@ -101,16 +101,16 @@ void ScriptBackend::commandFinished (const QString &output) {
 				// no heading for the preview code (not shown in the code box)
 				code_property->setPreview (_output);
 			} else {
-				emit (commandDone (current_flags));
+				emit commandDone(current_flags);
 			}
 		} else {
-			emit (commandDone (current_flags));
+			emit commandDone(current_flags);
 		}
 	}
 	busy = false;
 	tryNextFunction ();
 	if (!busy) {
-		emit (idle ());
+		emit idle();
 	}
 }
 
diff --git a/rkward/scriptbackends/simplebackend.cpp b/rkward/scriptbackends/simplebackend.cpp
index acd490ea..9dea33a8 100644
--- a/rkward/scriptbackends/simplebackend.cpp
+++ b/rkward/scriptbackends/simplebackend.cpp
@@ -120,7 +120,7 @@ void SimpleBackend::processCall () {
 		RK_ASSERT (token_end >= 0);
 		QString token = current_template.mid (next_token + 3, token_end - (next_token + 3));
 		template_pos = token_end + 3;
-		emit (requestValue (token, RKStandardComponent::StringValue));
+		emit requestValue(token, RKStandardComponent::StringValue);
 		return;
 	}
 
diff --git a/rkward/settings/rksettings.cpp b/rkward/settings/rksettings.cpp
index 1884529f..8cb73190 100644
--- a/rkward/settings/rksettings.cpp
+++ b/rkward/settings/rksettings.cpp
@@ -284,6 +284,6 @@ RKSettingsTracker::~RKSettingsTracker () {
 
 void RKSettingsTracker::signalSettingsChange (RKSettings::SettingsPage page) {
 	RK_TRACE (SETTINGS);
-	emit (settingsChanged (page));
+	emit settingsChanged(page);
 }
 
diff --git a/rkward/settings/rksettingsmodule.cpp b/rkward/settings/rksettingsmodule.cpp
index 4758e219..2557c172 100644
--- a/rkward/settings/rksettingsmodule.cpp
+++ b/rkward/settings/rksettingsmodule.cpp
@@ -45,7 +45,7 @@ RKSettingsModuleWidget::RKSettingsModuleWidget(QWidget *parent, RKSettingsModule
 
 void RKSettingsModuleWidget::change() {
 	changed = true;
-	settingsChanged();
+	emit settingsChanged();
 }
 
 
@@ -54,7 +54,7 @@ QCheckBox* RKConfigValue<bool, bool>::makeCheckbox(const QString& label, RKSetti
 	QCheckBox *ret = new QCheckBox(label);
 	ret->setChecked(value);
 	QObject::connect(ret, &QCheckBox::stateChanged, module, &RKSettingsModuleWidget::change);
-	QObject::connect(module, &RKSettingsModuleWidget::apply, [ret, this]() { this->value = ret->isChecked(); });
+	QObject::connect(module, &RKSettingsModuleWidget::apply, module, [ret, this]() { this->value = ret->isChecked(); });
 	return ret;
 }
 
@@ -63,7 +63,7 @@ RKSpinBox* RKConfigValue<double, double>::makeSpinBox(double min, double max, RK
 	RKSpinBox* ret = new RKSpinBox();
 	ret->setRealMode(min, max, value, 1, 2);
 	QObject::connect(ret, QOverload<int>::of(&QSpinBox::valueChanged), module, &RKSettingsModuleWidget::change);
-	QObject::connect(module, &RKSettingsModuleWidget::apply, [ret, this]() { this->value = ret->realValue(); });
+	QObject::connect(module, &RKSettingsModuleWidget::apply, module, [ret, this]() { this->value = ret->realValue(); });
 	return ret;
 }
 
@@ -72,7 +72,7 @@ RKSpinBox* RKConfigValue<int, int>::makeSpinBox(int min, int max, RKSettingsModu
 	RKSpinBox* ret = new RKSpinBox();
 	ret->setIntMode(min, max, value);
 	QObject::connect(ret, QOverload<int>::of(&QSpinBox::valueChanged), module, &RKSettingsModuleWidget::change);
-	QObject::connect(module, &RKSettingsModuleWidget::apply, [ret, this]() { this->value = ret->intValue(); });
+	QObject::connect(module, &RKSettingsModuleWidget::apply, module, [ret, this]() { this->value = ret->intValue(); });
 	return ret;
 }
 // Hmm... Boring dupe of the above
@@ -81,7 +81,7 @@ RKSpinBox* RKConfigValue<uint, uint>::makeSpinBox(uint min, uint max, RKSettings
 	RKSpinBox* ret = new RKSpinBox();
 	ret->setIntMode(min, max, value);
 	QObject::connect(ret, QOverload<int>::of(&QSpinBox::valueChanged), module, &RKSettingsModuleWidget::change);
-	QObject::connect(module, &RKSettingsModuleWidget::apply, [ret, this]() { this->value = ret->intValue(); });
+	QObject::connect(module, &RKSettingsModuleWidget::apply, module, [ret, this]() { this->value = ret->intValue(); });
 	return ret;
 }
 
@@ -98,7 +98,7 @@ QComboBox* RKConfigBase::makeDropDownHelper(const LabelList &entries, RKSettings
 	}
 	RK_ASSERT(index >= 0);
 	ret->setCurrentIndex(index);
-	QObject::connect(ret, QOverload<int>::of(&QComboBox::currentIndexChanged), [ret, setter, module]() {
+	QObject::connect(ret, QOverload<int>::of(&QComboBox::currentIndexChanged), module, [ret, setter, module]() {
 		module->change();
 		setter(ret->currentData().toInt());
 	});
diff --git a/rkward/settings/rksettingsmodule.h b/rkward/settings/rksettingsmodule.h
index 5598a6bb..41067b2c 100644
--- a/rkward/settings/rksettingsmodule.h
+++ b/rkward/settings/rksettingsmodule.h
@@ -147,7 +147,7 @@ protected:
 	bool changed;
 /** temporary indirection until applyChanges() has been obsolete, everywhere */
 	void doApply() {
-		emit(apply());
+		emit apply();
 		applyChanges();
 		changed = false;
 	}
diff --git a/rkward/settings/rksettingsmodulecommandeditor.cpp b/rkward/settings/rksettingsmodulecommandeditor.cpp
index 147ae93b..bb001e1c 100644
--- a/rkward/settings/rksettingsmodulecommandeditor.cpp
+++ b/rkward/settings/rksettingsmodulecommandeditor.cpp
@@ -46,7 +46,7 @@ RKConfigValue<int> RKSettingsModuleCommandEditor::autosave_interval {"Autosave i
 RKConfigValue<int> RKSettingsModuleCommandEditor::num_recent_files { "Max number of recent files", 10 };
 RKConfigValue<QString> RKSettingsModuleCommandEditor::script_file_filter { "Script file filter", "*.R *.S *.q *.Rhistory" };
 
-RKCodeCompletionSettingsWidget::RKCodeCompletionSettingsWidget(QWidget *parent, RKSettingsModule *module, RKCodeCompletionSettings *settings, bool show_common) : RKSettingsModuleWidget(parent, module), settings(settings), show_common(show_common) {
+RKCodeCompletionSettingsWidget::RKCodeCompletionSettingsWidget(QWidget *parent, RKSettingsModule *module, RKCodeCompletionSettings *settings, bool show_common) : RKSettingsModuleWidget(parent, module), settings(settings) {
 	RK_TRACE (SETTINGS);
 	QVBoxLayout* main_vbox = new QVBoxLayout (this);
 	main_vbox->setContentsMargins(0,0,0,0);
diff --git a/rkward/settings/rksettingsmodulecommandeditor.h b/rkward/settings/rksettingsmodulecommandeditor.h
index e9fc1681..1af2ec82 100644
--- a/rkward/settings/rksettingsmodulecommandeditor.h
+++ b/rkward/settings/rksettingsmodulecommandeditor.h
@@ -81,7 +81,6 @@ private:
 	QGroupBox* auto_completion_enabled_box;
 
 	RKCodeCompletionSettings *settings;
-	bool show_common;
 };
 
 class RKSettingsModuleKTextEditorConfigWrapper : public RKSettingsModule {
diff --git a/rkward/settings/rksettingsmoduledebug.cpp b/rkward/settings/rksettingsmoduledebug.cpp
index 6c59b1c6..198a7ca8 100644
--- a/rkward/settings/rksettingsmoduledebug.cpp
+++ b/rkward/settings/rksettingsmoduledebug.cpp
@@ -121,9 +121,8 @@ void RKSettingsModuleDebug::applyChanges () {
 	RK_Debug::RK_Debug_Flags = flags;
 }
 
-void RKSettingsModuleDebug::syncConfig(KConfig *config, RKConfigBase::ConfigSyncAction) {
-	RK_TRACE (SETTINGS);
-
+void RKSettingsModuleDebug::syncConfig(KConfig*, RKConfigBase::ConfigSyncAction) {
+	RK_TRACE(SETTINGS);
 	// left empty on purpose
 }
 
diff --git a/rkward/settings/rksettingsmodulegeneral.cpp b/rkward/settings/rksettingsmodulegeneral.cpp
index 50eff635..e41b9269 100644
--- a/rkward/settings/rksettingsmodulegeneral.cpp
+++ b/rkward/settings/rksettingsmodulegeneral.cpp
@@ -93,7 +93,7 @@ RKSettingsModuleGeneral::RKSettingsModuleGeneral (RKSettings *gui, QWidget *pare
 	initial_dir_custom_chooser = new GetFileNameWidget (group_box, GetFileNameWidget::ExistingDirectory, true, QString(), i18n ("Initial working directory"), initial_dir_specification);
 	initial_dir_custom_chooser->setEnabled (initial_dir == CustomDirectory);
 	connect (initial_dir_custom_chooser, &GetFileNameWidget::locationChanged, this, &RKSettingsModuleGeneral::change);
-	connect(initial_dir_chooser, QOverload<int>::of(&QComboBox::currentIndexChanged), [initial_dir_chooser, this]() { this->initial_dir_custom_chooser->setEnabled(initial_dir_chooser->currentData()==CustomDirectory); });
+	connect(initial_dir_chooser, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [initial_dir_chooser, this]() { this->initial_dir_custom_chooser->setEnabled(initial_dir_chooser->currentData()==CustomDirectory); });
 	hlayout->addWidget (initial_dir_custom_chooser);
 	RKCommonFunctions::setTips (i18n ("<p>The initial working directory to use. Note that if you are loading a workspace on startup, and you have configured RKWard to change to the directory of loaded workspaces, that directory will take precedence.</p>"), group_box, initial_dir_chooser, initial_dir_custom_chooser);
 	main_vbox->addWidget (group_box);
diff --git a/rkward/settings/rksettingsmodulekateplugins.cpp b/rkward/settings/rksettingsmodulekateplugins.cpp
index 20958577..5eafc852 100644
--- a/rkward/settings/rksettingsmodulekateplugins.cpp
+++ b/rkward/settings/rksettingsmodulekateplugins.cpp
@@ -50,7 +50,8 @@ RKSettingsModuleKatePlugins::RKSettingsModuleKatePlugins(RKSettings *gui, QWidge
 	boldfont.setBold(true);
 	plugin_table->setHeaderLabels(QStringList() << QString() << i18n("Name") << i18n("Description"));
 	KatePluginIntegrationApp *pluginapp = RKWardMainWindow::getMain()->katePluginIntegration();
-	foreach (const QString &key, pluginapp->known_plugins.keys()) {
+	const auto keys = pluginapp->known_plugins.keys();
+	for (const QString &key : keys) {
 		QTreeWidgetItem *item = new QTreeWidgetItem();
 		KPluginMetaData plugindata = pluginapp->known_plugins.value(key).data;
 		item->setData(1, Qt::DisplayRole, plugindata.name());
diff --git a/rkward/settings/rksettingsmoduleplugins.cpp b/rkward/settings/rksettingsmoduleplugins.cpp
index ecea376b..8d28edf1 100644
--- a/rkward/settings/rksettingsmoduleplugins.cpp
+++ b/rkward/settings/rksettingsmoduleplugins.cpp
@@ -508,7 +508,7 @@ bool RKSettingsModulePluginsModel::setData (const QModelIndex& index, const QVar
 	if (role == Qt::CheckStateRole) {
 		if (index.isValid () && (index.column () == COLUMN_CHECKED)) {
 			plugin_maps[index.row ()].active = value.toBool ();
-			emit (dataChanged (index, index));
+			emit dataChanged(index, index);
 			return true;
 		}
 	}
@@ -527,7 +527,7 @@ void RKSettingsModulePluginsModel::insertNewStrings (int above_row) {
 		if (pos >= 0) {
 			if (!plugin_maps[pos].active) {
 				plugin_maps[pos].active = true;
-				emit (dataChanged (index (pos, 0), index (pos, COLUMN_COUNT - 1)));
+				emit dataChanged(index(pos, 0), index(pos, COLUMN_COUNT - 1));
 			}
 			files.removeAt (i);
 		}
diff --git a/rkward/settings/rksettingsmoduler.cpp b/rkward/settings/rksettingsmoduler.cpp
index 89690cd6..5e30ee0b 100755
--- a/rkward/settings/rksettingsmoduler.cpp
+++ b/rkward/settings/rksettingsmoduler.cpp
@@ -618,7 +618,7 @@ void RKSettingsModuleRPackages::validateSettingsInteractive (QList<RKSetupWizard
 			                                        "to work (if they are compatible with this version of R)."), [legacy_libloc](RKSetupWizard*) {
 									liblocs.get().removeAll(legacy_libloc);
 									QString new_loc = legacy_libloc + '-' + RKSessionVars::RVersion (true);
-									RKGlobals::rInterface ()->issueCommand (QString ("file.rename(%1, %2)\n").arg (RObject::rQuote (legacy_libloc)).arg (RObject::rQuote (new_loc)), RCommand::App);
+									RKGlobals::rInterface ()->issueCommand (QString ("file.rename(%1, %2)\n").arg(RObject::rQuote(legacy_libloc), RObject::rQuote (new_loc)), RCommand::App);
 									liblocs.get().prepend (legacy_libloc + QStringLiteral ("-%v"));
 									RKGlobals::rInterface ()->issueCommand (libLocsCommand(), RCommand::App);
 								});
diff --git a/rkward/windows/katepluginintegration.cpp b/rkward/windows/katepluginintegration.cpp
index bc753724..357200de 100644
--- a/rkward/windows/katepluginintegration.cpp
+++ b/rkward/windows/katepluginintegration.cpp
@@ -107,7 +107,7 @@ QObject* KatePluginIntegrationApp::loadPlugin (const QString& identifier) {
 	if (factory) {
 		if (identifier == "katekonsoleplugin") {
 			// Workaround until https://invent.kde.org/utilities/kate/-/commit/cf11bcbf1f36e2a82b1a1b14090a3f0a2b09ecf4 can be assumed to be present (should be removed in KF6)
-			if (qgetenv("EDITOR").isNull()) qputenv("EDITOR", "vi");
+			if (qEnvironmentVariableIsEmpty("EDITOR")) qputenv("EDITOR", "vi");
 		}
 
 		KTextEditor::Plugin *plugin = factory->create<KTextEditor::Plugin>(this, QVariantList () << identifier);
@@ -135,7 +135,8 @@ void KatePluginIntegrationApp::loadPlugins(const QStringList& plugins) {
 	RK_TRACE (APP);
 
 	bool changes = false;
-	foreach (const QString &key, known_plugins.keys()) {
+	const auto keys = known_plugins.keys();
+	for(const QString &key : keys) {
 		auto info = known_plugins.value(key);
 		if (plugins.contains(key)) {
 			if (!info.plugin) {
@@ -589,7 +590,7 @@ QObject* KatePluginIntegrationWindow::createPluginView(KTextEditor::Plugin* plug
 	active_plugin = 0;
 	disconnect(factory(), &KXMLGUIFactory::clientAdded, this, &KatePluginIntegrationWindow::catchXMLGUIClientsHack);
 	fixUpPluginUI(app->idForPlugin(plugin), resources);
-	connect(plugin, &QObject::destroyed, [this, plugin]() { plugin_resources.remove(plugin); });
+	connect(plugin, &QObject::destroyed, this, [this, plugin]() { plugin_resources.remove(plugin); });
 	return resources.view;
 }
 
diff --git a/rkward/windows/rkcodecompletion.cpp b/rkward/windows/rkcodecompletion.cpp
index df241419..2c00b7d8 100644
--- a/rkward/windows/rkcodecompletion.cpp
+++ b/rkward/windows/rkcodecompletion.cpp
@@ -835,7 +835,7 @@ void RKFileCompletionModelWorker::run () {
 		exes = comp.allMatches ();
 	}
 
-	emit (completionsReady (string, exes, files));
+	emit completionsReady(string, exes, files);
 }
 
 RKFileCompletionModel::RKFileCompletionModel (RKCompletionManager* manager) : RKCompletionModelBase (manager) {
diff --git a/rkward/windows/rkcommandeditorwindow.cpp b/rkward/windows/rkcommandeditorwindow.cpp
index d59ec5da..5919fd3b 100644
--- a/rkward/windows/rkcommandeditorwindow.cpp
+++ b/rkward/windows/rkcommandeditorwindow.cpp
@@ -201,7 +201,7 @@ RKCommandEditorWindow::RKCommandEditorWindow (QWidget *parent, const QUrl _url,
 	}
 	preview = new RKXMLGUIPreviewArea (QString(), this);
 	preview_manager = new RKPreviewManager (this);
-	connect (preview_manager, &RKPreviewManager::statusChanged, [this]() { preview_timer.start (500); });
+	connect (preview_manager, &RKPreviewManager::statusChanged, this, [this]() { preview_timer.start (500); });
 	m_view = m_doc->createView (this);
 	RKWorkplace::mainWorkplace()->registerNamedWindow (preview_manager->previewId(), this, preview);
 	if (!url.isEmpty ()) {
@@ -225,16 +225,15 @@ RKCommandEditorWindow::RKCommandEditorWindow (QWidget *parent, const QUrl _url,
 	QList<KActionCollection*> own_acs;
 	own_acs.append(part->actionCollection());
 	own_acs.append(standardActionCollection());
-	auto own_actions = part->actionCollection()->actions();
 	// How's this for a nested for loop...
 	for (const auto ac : own_acs) {
-		auto own_actions = ac->actions();
+		const auto own_actions = ac->actions();
 		for (const auto a : own_actions) {
-			for (const auto k : ac->defaultShortcuts(a)) {
+			for (const auto &k : ac->defaultShortcuts(a)) {
 				for (const auto kac : kate_acs) {
 					for (auto ka : kac->actions()) {
 						auto action_shortcuts = kac->defaultShortcuts(ka);
-						for (const auto kk : action_shortcuts) {
+						for (const auto &kk : action_shortcuts) {
 							if (k.matches(kk) != QKeySequence::NoMatch || kk.matches(k) != QKeySequence::NoMatch) {
 								RK_DEBUG(EDITOR, DL_WARNING, "Removing conflicting shortcut %s in kate part (%s, conflicting with %s)", qPrintable(kk.toString()), qPrintable(ka->objectName()), qPrintable(a->objectName()));
 								action_shortcuts.removeAll(k);
@@ -261,7 +260,7 @@ RKCommandEditorWindow::RKCommandEditorWindow (QWidget *parent, const QUrl _url,
 	layout->addWidget(preview_splitter);
 
 	setGlobalContextProperty ("current_filename", m_doc->url ().url ());
-	connect (m_doc, &KTextEditor::Document::documentUrlChanged, [this]() { updateCaption(); setGlobalContextProperty ("current_filename", m_doc->url ().url ()); });
+	connect (m_doc, &KTextEditor::Document::documentUrlChanged, this, [this]() { updateCaption(); setGlobalContextProperty ("current_filename", m_doc->url ().url ()); });
 	connect (m_doc, &KTextEditor::Document::modifiedChanged, this, &RKCommandEditorWindow::updateCaption);                // of course most of the time this causes a redundant call to updateCaption. Not if a modification is undone, however.
 #ifdef __GNUC__
 #warning remove this in favor of KTextEditor::Document::restore()
@@ -935,7 +934,7 @@ void RKCommandEditorWindow::doRenderPreview () {
 		          "}\n"
 		          "rk.set.output.html.file(output, silent=TRUE)\n"
 		          "rk.show.html(%2)\n";
-		command = command.arg (RObject::rQuote (preview_input_file->fileName ())).arg (RObject::rQuote (output_file));
+		command = command.arg (RObject::rQuote (preview_input_file->fileName ()), RObject::rQuote (output_file));
 	} else {
 		RK_ASSERT (false);
 	}
@@ -1123,8 +1122,8 @@ QString exportText(const QString& text, const KTextEditor::Attribute::Ptr& attri
 
 	if ( writeForeground || writeBackground ) {
 		ret.append (QString("<span style='%1%2'>")
-					.arg(writeForeground ? QString(QLatin1String("color:") + attrib->foreground().color().name() + QLatin1Char(';')) : QString())
-					.arg(writeBackground ? QString(QLatin1String("background:") + attrib->background().color().name() + QLatin1Char(';')) : QString()));
+					.arg(writeForeground ? QString(QLatin1String("color:") + attrib->foreground().color().name() + QLatin1Char(';')) : QString(),
+					     writeBackground ? QString(QLatin1String("background:") + attrib->background().color().name() + QLatin1Char(';')) : QString()));
 	}
 
 	ret.append (text.toHtmlEscaped());
@@ -1156,8 +1155,8 @@ QString RKCommandHighlighter::commandToHTML (const QString r_command, Highlighti
 		opening = "<pre class=\"%3\">";
 	} else {
 		opening = QString("<pre style='%1%2' class=\"%3\">")
-				.arg(m_defaultAttribute->fontBold() ? "font-weight:bold;" : "")
-				.arg(m_defaultAttribute->fontItalic() ? "text-style:italic;" : "");
+				.arg(m_defaultAttribute->fontBold() ? "font-weight:bold;" : "",
+				     m_defaultAttribute->fontItalic() ? "text-style:italic;" : "");
 				// Note: copying the default text/background colors is pointless in our case, and leads to subtle inconsistencies.
 	}
 
diff --git a/rkward/windows/rkcommandlog.cpp b/rkward/windows/rkcommandlog.cpp
index 1cac1076..0aa10b10 100644
--- a/rkward/windows/rkcommandlog.cpp
+++ b/rkward/windows/rkcommandlog.cpp
@@ -246,11 +246,11 @@ RKCommandLogView::~RKCommandLogView () {
 	RK_TRACE (APP);
 }
 
-void RKCommandLogView::contextMenuEvent (QContextMenuEvent *event) {
-	RK_TRACE (APP);
+void RKCommandLogView::contextMenuEvent(QContextMenuEvent *event) {
+	RK_TRACE(APP);
 
-	emit (popupMenuRequest (event->globalPos ()));
-	event->accept ();
+	emit popupMenuRequest(event->globalPos());
+	event->accept();
 }
 
 void RKCommandLogView::selectAll () {
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index f25f988a..d6f9d9ec 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -196,7 +196,7 @@ protected:
 
 		if (cururl.matches (navurl, QUrl::NormalizePathSegments | QUrl::StripTrailingSlash)) {
 			RK_DEBUG (APP, DL_DEBUG, "Page internal navigation request from %s to %s", qPrintable (cururl.toString ()), qPrintable (navurl.toString ()));
-			emit (pageInternalNavigation (navurl));
+			emit pageInternalNavigation(navurl);
 			return true;
 		}
 
@@ -332,7 +332,7 @@ RKHTMLWindow::RKHTMLWindow (QWidget *parent, WindowMode mode) : RKMDIWindow (par
 #ifdef NO_QT_WEBENGINE
 	connect (page, &QWebPage::downloadRequested, [this](const QNetworkRequest &request) { page->downloadUrl (request.url ()); });
 #else
-	connect (page->profile (), &QWebEngineProfile::downloadRequested, [this](QWebEngineDownloadItem* item) {
+	connect (page->profile (), &QWebEngineProfile::downloadRequested, this, [this](QWebEngineDownloadItem* item) {
 		QString path = QFileDialog::getSaveFileName (this, i18n ("Save as"), item->path ());
 		if (path.isEmpty ()) return;
 		item->setPath (path);
@@ -1162,7 +1162,7 @@ QString RKHelpRenderer::renderHelpFragment (QDomElement &fragment) {
 	int npos;
 	QString ret;
 	while ((npos = text.indexOf ("<link", pos)) >= 0) {
-		ret += text.mid (pos, npos - pos);
+		ret += text.midRef(pos, npos - pos);
 
 		QString href;
 		int href_start = text.indexOf (" href=\"", npos + 5);
@@ -1182,14 +1182,14 @@ QString RKHelpRenderer::renderHelpFragment (QDomElement &fragment) {
 		ret += prepareHelpLink (href, linktext);
 		pos = end;
 	}
-	ret += text.mid (pos);
+	ret += text.midRef(pos);
 
 	if (component_xml) {
 		text = ret;
 		ret.clear ();
 		pos = 0;
 		while ((npos = text.indexOf ("<label ", pos)) >= 0) {
-			ret += text.mid (pos, npos - pos);
+			ret += text.midRef(pos, npos - pos);
 
 			QString id;
 			int id_start = text.indexOf ("id=\"", npos + 6);
@@ -1201,7 +1201,7 @@ QString RKHelpRenderer::renderHelpFragment (QDomElement &fragment) {
 			}
 			ret += resolveLabel (id);
 		}
-		ret += text.mid (pos);
+		ret += text.midRef(pos);
 	}
 
 	RK_DEBUG (APP, DL_DEBUG, "%s", qPrintable (ret));
@@ -1425,7 +1425,7 @@ void RKOutputWindowManager::fileChanged (const QString &path) {
 	}
 }
 
-void RKOutputWindowManager::windowDestroyed (QObject *window) {
+void RKOutputWindowManager::windowDestroyed(QObject *window) {
 	RK_TRACE (APP);
 
 	// warning: Do not call any methods on the window. It is half-destroyed, already.
diff --git a/rkward/windows/rkmdiwindow.cpp b/rkward/windows/rkmdiwindow.cpp
index b07479ce..4049f6af 100644
--- a/rkward/windows/rkmdiwindow.cpp
+++ b/rkward/windows/rkmdiwindow.cpp
@@ -110,10 +110,10 @@ QString RKMDIWindow::shortCaption () {
 	return windowTitle ();
 }
 
-void RKMDIWindow::setCaption (const QString &caption) {
-	RK_TRACE (APP);
-	QWidget::setWindowTitle (caption);
-	emit (captionChanged (this));
+void RKMDIWindow::setCaption(const QString &caption) {
+	RK_TRACE(APP);
+	QWidget::setWindowTitle(caption);
+	emit captionChanged(this);
 	if (tool_window_bar) tool_window_bar->captionChanged(this);
 }
 
@@ -149,7 +149,7 @@ void RKMDIWindow::activate (bool with_focus) {
 		}
 	}
 
-	emit (windowActivated (this));
+	emit windowActivated(this);
 	if (with_focus) {
 		if (old_focus) old_focus->clearFocus ();
 		topLevelWidget ()->activateWindow ();
@@ -218,12 +218,12 @@ bool RKMDIWindow::eventFilter (QObject *watched, QEvent *e) {
 
 	if (watched == getPart ()) {
 		if (KParts::PartActivateEvent::test (e)) {
-			RK_TRACE (APP);		// trace only the "interesting" calls to this function
+			RK_TRACE(APP);           // trace only the "interesting" calls to this function
 
-			KParts::PartActivateEvent *ev = static_cast<KParts::PartActivateEvent *> (e);
-			if (ev->activated ()) {
-				emit (windowActivated (this));
-				setFocus ();		// focus doesn't always work correctly for the kate part
+			KParts::PartActivateEvent *ev = static_cast<KParts::PartActivateEvent *>(e);
+			if (ev->activated()) {
+				emit windowActivated(this);
+				setFocus();      // focus doesn't always work correctly for the kate part
 				active = true;
 			} else {
 				active = false;
@@ -353,7 +353,7 @@ void RKMDIWindow::setStatusMessage (const QString& message, RCommand *command) {
 		layout->addStretch ();
 
 		// when animation is finished, squeeze the popup-container, so as not to interfere with mouse events in the main window
-		connect (status_popup, &KMessageWidget::showAnimationFinished, [this]() { status_popup_container->resize (QSize(width(), status_popup->height () + 20)); });
+		connect (status_popup, &KMessageWidget::showAnimationFinished, this, [this]() { status_popup_container->resize (QSize(width(), status_popup->height () + 20)); });
 		connect (status_popup, &KMessageWidget::hideAnimationFinished, status_popup_container, &QWidget::hide);
 	}
 
diff --git a/rkward/windows/rktoolwindowbar.cpp b/rkward/windows/rktoolwindowbar.cpp
index 9851f4e8..f83f1bdd 100644
--- a/rkward/windows/rktoolwindowbar.cpp
+++ b/rkward/windows/rktoolwindowbar.cpp
@@ -79,7 +79,7 @@ int RKToolWindowBar::getSplitterSize () const {
 		RK_ASSERT (false);
 		return 0;
 	}
-	return (splitter->sizes ()[pos]);
+	return (splitter->sizes().at(pos));
 }
 
 void RKToolWindowBar::setSplitterSize (int new_size) {
diff --git a/rkward/windows/rkwindowcatcher.h b/rkward/windows/rkwindowcatcher.h
index 57e771d5..0cecbcf6 100644
--- a/rkward/windows/rkwindowcatcher.h
+++ b/rkward/windows/rkwindowcatcher.h
@@ -168,7 +168,7 @@ public slots:
 	void showPlotInfo ();
 
 /** reimplemented to keep window alive while saving history */
-	bool close (CloseWindowMode ask_save) override;
+	bool close (RKMDIWindow::CloseWindowMode ask_save) override;
 	void setKilledInR () { killed_in_r = true; };
 	void setWindowStyleHint (const QString& hint) override;
 private slots:
diff --git a/rkward/windows/rkworkplace.cpp b/rkward/windows/rkworkplace.cpp
index 7460e7a5..c53c188e 100644
--- a/rkward/windows/rkworkplace.cpp
+++ b/rkward/windows/rkworkplace.cpp
@@ -182,7 +182,7 @@ void RKWorkplace::setWorkspaceURL (const QUrl &url, bool keep_config) {
 			delete _workspace_config;
 			_workspace_config = 0;
 		}
-		emit (workspaceUrlChanged (url));
+		emit workspaceUrlChanged(url);
 	}
 }
 
@@ -814,11 +814,11 @@ QUrl checkAdjustRestoredUrl (const QString &_url, const QString old_base) {
 	if (!(old_base_url.isLocalFile () && new_base_url.isLocalFile () && url.isLocalFile ())) return (url);
 
 	// if the file exists, unadjusted, return it.
-	if (QFileInfo (url.toLocalFile ()).exists ()) return (url);
+	if (QFileInfo::exists(url.toLocalFile())) return (url);
 
 	// check whether a file exists for the adjusted url
 	QString relative = QDir (new_base_url.path ()).absoluteFilePath (QDir (old_base_url.path ()).relativeFilePath (url.path ()));
-	if (QFileInfo (relative).exists ()) return (QUrl::fromLocalFile (relative));
+	if (QFileInfo::exists(relative)) return (QUrl::fromLocalFile(relative));
 	return (url);
 }
 
diff --git a/rkward/windows/rkworkplaceview.cpp b/rkward/windows/rkworkplaceview.cpp
index 6a9e9225..90c49342 100644
--- a/rkward/windows/rkworkplaceview.cpp
+++ b/rkward/windows/rkworkplaceview.cpp
@@ -139,7 +139,7 @@ void RKWorkplaceViewPane::tabRemoved (int index) {
 	RK_TRACE (APP);
 	QTabWidget::tabRemoved (index);
 //	if (count () < 2) tabBar ()->hide ();
-	if (count () < 1) emit (becameEmpty (this));
+	if (count () < 1) emit becameEmpty(this);
 	workplace_view->updateActions ();
 }
 
@@ -490,11 +490,11 @@ void RKWorkplaceView::childCaptionChanged (RKMDIWindow *widget) {
 	if (id == pane->currentIndex ()) setCaption (widget->shortCaption ());
 }
 
-void RKWorkplaceView::setCaption (const QString &caption) {
-	RK_TRACE (APP);
+void RKWorkplaceView::setCaption(const QString &caption) {
+	RK_TRACE(APP);
 
-	QWidget::setWindowTitle (caption);
-	emit (captionChanged (caption));
+	QWidget::setWindowTitle(caption);
+	emit captionChanged(caption);
 }
 
 void RKWorkplaceView::restoreLayout(const QString& desc) {


More information about the rkward-tracker mailing list