[education/rkward/kf5] /: Adapt to new KDE compiler settings

Thomas Friedrichsmeier null at kde.org
Wed Apr 10 16:12:08 BST 2024


Git commit b7b591e461575f2d0682b3aa944b4975f1b76d1d by Thomas Friedrichsmeier, on behalf of Carl Schwan.
Committed on 01/04/2024 at 11:45.
Pushed by tfry into branch 'kf5'.

Adapt to new KDE compiler settings

M  +3    -3    CMakeLists.txt
M  +3    -3    rkward/agents/rkdebughandler.cpp
M  +1    -1    rkward/agents/rkdebughandler.h
M  +1    -1    rkward/agents/rkquitagent.h
M  +1    -1    rkward/autotests/core_test.cpp
M  +1    -1    rkward/core/CMakeLists.txt
M  +3    -3    rkward/core/rkmodificationtracker.cpp
M  +1    -1    rkward/core/rkmodificationtracker.h
M  +4    -4    rkward/core/robject.h
M  +3    -3    rkward/core/robjectlist.cpp
M  +2    -2    rkward/core/robjectlist.h
M  +1    -1    rkward/dataeditor/rkeditordataframe.h
M  +1    -1    rkward/dataeditor/rktextmatrix.cpp
M  +2    -1    rkward/dataeditor/rktextmatrix.h
M  +8    -8    rkward/dataeditor/rkvareditmodel.cpp
M  +3    -3    rkward/dataeditor/rkvareditmodel.h
M  +2    -2    rkward/dataeditor/twintable.h
M  +3    -3    rkward/dataeditor/twintablemember.cpp
M  +3    -3    rkward/dataeditor/twintablemember.h
M  +8    -8    rkward/dialogs/rkloadlibsdialog.cpp
M  +9    -9    rkward/dialogs/rkloadlibsdialog.h
M  +1    -1    rkward/dialogs/rkrecoverdialog.h
M  +1    -1    rkward/dialogs/rksavemodifieddialog.h
M  +1    -1    rkward/dialogs/rkselectlistdialog.h
M  +4    -4    rkward/misc/celleditor.cpp
M  +2    -2    rkward/misc/celleditor.h
M  +2    -2    rkward/misc/editformatdialog.cpp
M  +3    -3    rkward/misc/editformatdialog.h
M  +3    -3    rkward/misc/editlabelsdialog.cpp
M  +3    -3    rkward/misc/editlabelsdialog.h
M  +2    -2    rkward/misc/getfilenamewidget.cpp
M  +3    -3    rkward/misc/getfilenamewidget.h
M  +4    -4    rkward/misc/multistringselector.cpp
M  +4    -4    rkward/misc/multistringselector.h
M  +7    -7    rkward/misc/rkaccordiontable.cpp
M  +2    -2    rkward/misc/rkaccordiontable.h
M  +1    -1    rkward/misc/rkdbusapi.h
M  +1    -1    rkward/misc/rkdynamicsearchline.cpp
M  +2    -2    rkward/misc/rkdynamicsearchline.h
M  +1    -1    rkward/misc/rkfindbar.cpp
M  +3    -3    rkward/misc/rkfindbar.h
M  +1    -1    rkward/misc/rkjobsequence.cpp
M  +2    -2    rkward/misc/rkjobsequence.h
M  +2    -2    rkward/misc/rkobjectlistview.cpp
M  +4    -4    rkward/misc/rkobjectlistview.h
M  +1    -1    rkward/misc/rkoutputdirectory.cpp
M  +1    -1    rkward/misc/rkoutputdirectory.h
M  +1    -1    rkward/misc/rkprogresscontrol.cpp
M  +2    -2    rkward/misc/rkprogresscontrol.h
M  +2    -2    rkward/misc/rksaveobjectchooser.cpp
M  +2    -2    rkward/misc/rksaveobjectchooser.h
M  +1    -1    rkward/misc/rkspecialactions.cpp
M  +3    -3    rkward/misc/rkspecialactions.h
M  +1    -1    rkward/misc/rkspinbox.cpp
M  +1    -1    rkward/misc/rkspinbox.h
M  +2    -2    rkward/misc/rkstandardactions.cpp
M  +3    -3    rkward/misc/rktableview.cpp
M  +5    -5    rkward/misc/rktableview.h
M  +2    -2    rkward/misc/rkxmlguipreviewarea.cpp
M  +4    -4    rkward/misc/rkxmlguipreviewarea.h
M  +3    -3    rkward/misc/rkxmlguisyncer_p.h
M  +1    -1    rkward/plugin/rkabstractoptionselector.h
M  +1    -1    rkward/plugin/rkcheckbox.h
M  +1    -1    rkward/plugin/rkcomponent.cpp
M  +3    -3    rkward/plugin/rkcomponent.h
M  +1    -1    rkward/plugin/rkcomponentcontext.h
M  +1    -1    rkward/plugin/rkcomponentmap.h
M  +21   -21   rkward/plugin/rkcomponentproperties.cpp
M  +9    -9    rkward/plugin/rkcomponentproperties.h
M  +1    -1    rkward/plugin/rkdropdown.h
M  +1    -1    rkward/plugin/rkformula.h
M  +1    -1    rkward/plugin/rkinput.h
M  +5    -5    rkward/plugin/rkmatrixinput.cpp
M  +2    -2    rkward/plugin/rkmatrixinput.h
M  +8    -8    rkward/plugin/rkoptionset.cpp
M  +2    -2    rkward/plugin/rkoptionset.h
M  +1    -1    rkward/plugin/rkpluginbrowser.h
M  +1    -1    rkward/plugin/rkpluginframe.h
M  +1    -1    rkward/plugin/rkpluginsaveobject.h
M  +1    -1    rkward/plugin/rkpluginspinbox.h
M  +1    -1    rkward/plugin/rkpreviewbox.h
M  +1    -1    rkward/plugin/rkstandardcomponent.cpp
M  +2    -2    rkward/plugin/rkstandardcomponent.h
M  +3    -3    rkward/plugin/rkstandardcomponentgui.h
M  +1    -1    rkward/plugin/rktabpage.h
M  +1    -1    rkward/plugin/rktext.h
M  +1    -1    rkward/plugin/rkvalueselector.h
M  +1    -1    rkward/plugin/rkvarselector.h
M  +1    -1    rkward/plugin/rkvarslot.h
M  +6    -6    rkward/rbackend/rcommand.h
M  +1    -1    rkward/rbackend/rcommandstack.cpp
M  +1    -1    rkward/rbackend/rkbackendtransmitter.h
M  +1    -1    rkward/rbackend/rkfrontendtransmitter.h
M  +4    -4    rkward/rbackend/rkrinterface.cpp
M  +1    -1    rkward/rbackend/rkrinterface.h
M  +1    -1    rkward/rbackend/rksessionvars.cpp
M  +1    -1    rkward/rbackend/rksessionvars.h
M  +1    -1    rkward/rbackend/rktransmitter.h
M  +8    -8    rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
M  +3    -3    rkward/rbackend/rkwarddevice/rkgraphicsdevice.h
M  +1    -1    rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp
M  +2    -2    rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.h
M  +1    -1    rkward/rkconsole.h
M  +1    -1    rkward/rkward.cpp
M  +3    -3    rkward/rkward.h
M  +2    -2    rkward/robjectviewer.h
M  +7    -7    rkward/scriptbackends/qtscriptbackend.cpp
M  +3    -3    rkward/scriptbackends/qtscriptbackend.h
M  +1    -1    rkward/scriptbackends/rkcomponentscripting.cpp
M  +3    -3    rkward/scriptbackends/rkcomponentscripting.h
M  +3    -3    rkward/scriptbackends/scriptbackend.cpp
M  +1    -1    rkward/scriptbackends/scriptbackend.h
M  +1    -1    rkward/scriptbackends/simplebackend.cpp
M  +1    -1    rkward/settings/rkrecenturls.cpp
M  +1    -1    rkward/settings/rkrecenturls.h
M  +1    -1    rkward/settings/rksettings.cpp
M  +4    -4    rkward/settings/rksettings.h
M  +1    -1    rkward/settings/rksettingsmodule.cpp
M  +2    -2    rkward/settings/rksettingsmodule.h
M  +1    -1    rkward/settings/rksettingsmoduledebug.h
M  +1    -1    rkward/settings/rksettingsmodulegraphics.h
M  +1    -1    rkward/settings/rksettingsmoduleobjectbrowser.h
M  +2    -2    rkward/settings/rksettingsmoduleoutput.h
M  +1    -1    rkward/settings/rksettingsmoduleplugins.cpp
M  +2    -2    rkward/settings/rksettingsmoduleplugins.h
M  +3    -3    rkward/settings/rksettingsmoduler.h
M  +1    -1    rkward/settings/rksettingsmodulewatch.h
M  +1    -1    rkward/windows/detachedwindowcontainer.h
M  +8    -8    rkward/windows/katepluginintegration.cpp
M  +3    -3    rkward/windows/katepluginintegration.h
M  +1    -1    rkward/windows/rcontrolwindow.h
M  +2    -2    rkward/windows/rkcallstackviewer.h
M  +3    -3    rkward/windows/rkcodecompletion.cpp
M  +5    -5    rkward/windows/rkcodecompletion.h
M  +8    -8    rkward/windows/rkcommandeditorwindow.cpp
M  +2    -2    rkward/windows/rkcommandeditorwindow.h
M  +1    -1    rkward/windows/rkcommandlog.cpp
M  +4    -4    rkward/windows/rkcommandlog.h
M  +2    -2    rkward/windows/rkdebugconsole.h
M  +1    -1    rkward/windows/rkfilebrowser.h
M  +1    -1    rkward/windows/rkhelpsearchwindow.h
M  +3    -3    rkward/windows/rkhtmlwindow.cpp
M  +3    -3    rkward/windows/rkhtmlwindow.h
M  +3    -3    rkward/windows/rkmdiwindow.cpp
M  +5    -5    rkward/windows/rkmdiwindow.h
M  +1    -1    rkward/windows/rktoolwindowbar.h
M  +2    -2    rkward/windows/rktoplevelwindowgui.h
M  +2    -2    rkward/windows/rkwindowcatcher.h
M  +2    -2    rkward/windows/rkworkplace.cpp
M  +6    -6    rkward/windows/rkworkplace.h
M  +2    -2    rkward/windows/rkworkplaceview.cpp
M  +5    -5    rkward/windows/rkworkplaceview.h
M  +1    -1    rkward/windows/robjectbrowser.h

https://invent.kde.org/education/rkward/-/commit/b7b591e461575f2d0682b3aa944b4975f1b76d1d

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4146d835d..b790c50ea 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,7 +22,7 @@ INCLUDE(ECMAddAppIcon)
 INCLUDE(ECMMarkNonGuiExecutable)
 INCLUDE(FeatureSummary)
 
-FIND_PACKAGE(Qt6 6.6 CONFIG REQUIRED COMPONENTS Widgets Core Xml Network Qml PrintSupport)
+FIND_PACKAGE(Qt6 6.6 CONFIG REQUIRED COMPONENTS Widgets Core Xml Network Qml PrintSupport Core5Compat)
 FIND_PACKAGE(KF6 6.0.0 REQUIRED COMPONENTS CoreAddons DocTools I18n XmlGui TextEditor WidgetsAddons Parts Config Notifications WindowSystem Archive OPTIONAL_COMPONENTS Crash)
 IF(NOT NO_QT_WEBENGINE)
 	FIND_PACKAGE(Qt6 6.6 OPTIONAL_COMPONENTS WebEngineWidgets)
@@ -33,9 +33,9 @@ IF(FORCE_PRETTY_MAKEFILE)
 	SET(CMAKE_VERBOSE_MAKEFILE OFF)
 ENDIF(FORCE_PRETTY_MAKEFILE)
 
-ADD_DEFINITIONS(${QT_DEFINITIONS} -DQT_NO_CAST_TO_ASCII)
 ADD_DEFINITIONS(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
-ADD_DEFINITIONS(-DQT_NO_URL_CAST_FROM_STRING)
+
+remove_definitions(-DQT_NO_CAST_FROM_ASCII) # TODO remove to compley to KDECompilerSettings
 
 #uncomment the line below to save ~250-350kB in object size
 #ADD_DEFINITIONS(-DRKWARD_NO_TRACE)
diff --git a/rkward/agents/rkdebughandler.cpp b/rkward/agents/rkdebughandler.cpp
index 3596e4142..4f50fde6e 100644
--- a/rkward/agents/rkdebughandler.cpp
+++ b/rkward/agents/rkdebughandler.cpp
@@ -46,7 +46,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;
-	emit newDebugState();
+	Q_EMIT newDebugState();
 }
 
 void RKDebugHandler::sendCancel () {
@@ -70,7 +70,7 @@ void RKDebugHandler::submitDebugString (const QString &command) {
 
 	_command = 0;
 	_state = InDebugRun;
-	emit newDebugState();
+	Q_EMIT newDebugState();
 }
 
 void RKDebugHandler::endDebug () {
@@ -79,6 +79,6 @@ void RKDebugHandler::endDebug () {
 	_command = 0;
 	_request = 0;
 	_state = NotInDebugger;
-	emit newDebugState();
+	Q_EMIT newDebugState();
 }
 
diff --git a/rkward/agents/rkdebughandler.h b/rkward/agents/rkdebughandler.h
index 2309785e1..c1d990b47 100644
--- a/rkward/agents/rkdebughandler.h
+++ b/rkward/agents/rkdebughandler.h
@@ -43,7 +43,7 @@ public:
 	QList<int> relativeSourceLines () const { return _rel_src_lines; };
 	QString debugPrompt () const { return _prompt; };
 	RCommand *command () const { return _command; };
-signals:
+Q_SIGNALS:
 	void newDebugState ();
 private:
 	RCommand *_command;
diff --git a/rkward/agents/rkquitagent.h b/rkward/agents/rkquitagent.h
index 93f78d33f..1b7c1d9fa 100644
--- a/rkward/agents/rkquitagent.h
+++ b/rkward/agents/rkquitagent.h
@@ -22,7 +22,7 @@ public:
 	~RKQuitAgent ();
 
 	static bool quittingInProgress () { return quitting; };
-public slots:
+public Q_SLOTS:
 	void doQuitNow ();
 	void showWaitDialog ();
 private:
diff --git a/rkward/autotests/core_test.cpp b/rkward/autotests/core_test.cpp
index d37e0ed8f..b01d3ab31 100644
--- a/rkward/autotests/core_test.cpp
+++ b/rkward/autotests/core_test.cpp
@@ -117,7 +117,7 @@ class RKWardCoreTest: public QObject {
 	}
     
 	QPointer<RKWardMainWindow> main_win;
-private slots:
+private Q_SLOTS:
 	void init() {
 		testLog("Starting next test");
 	}
diff --git a/rkward/core/CMakeLists.txt b/rkward/core/CMakeLists.txt
index 57e93b587..79444c8be 100644
--- a/rkward/core/CMakeLists.txt
+++ b/rkward/core/CMakeLists.txt
@@ -17,5 +17,5 @@ SET(core_STAT_SRCS
    )
 
 ADD_LIBRARY(core STATIC ${core_STAT_SRCS})
-TARGET_LINK_LIBRARIES(core Qt6::Core Qt6::Widgets KF6::WidgetsAddons KF6::I18n KF6::Parts)
+TARGET_LINK_LIBRARIES(core Qt6::Core Qt6::Widgets Qt6::Core5Compat KF6::WidgetsAddons KF6::I18n KF6::Parts)
 
diff --git a/rkward/core/rkmodificationtracker.cpp b/rkward/core/rkmodificationtracker.cpp
index 08f043fca..9086d41cc 100644
--- a/rkward/core/rkmodificationtracker.cpp
+++ b/rkward/core/rkmodificationtracker.cpp
@@ -141,7 +141,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);
+		Q_EMIT dataChanged(object_index, object_index);
 	}
 }
 
@@ -171,7 +171,7 @@ void RKModificationTracker::objectMetaChanged (RObject *object) {
 		sendListenerNotification (RObjectListener::MetaChanged, object, 0, 0, 0);
 
 		QModelIndex object_index = indexFor (object);
-		emit dataChanged(object_index, object_index.sibling(object_index.row(), ColumnCount-1));
+		Q_EMIT dataChanged(object_index, object_index.sibling(object_index.row(), ColumnCount-1));
 	}
 }
 
@@ -183,7 +183,7 @@ void RKModificationTracker::objectDataChanged (RObject *object, RObject::ChangeS
 		delete changes;
 
 		QModelIndex object_index = indexFor (object);
-		emit dataChanged(object_index, object_index.sibling(object_index.row(), ColumnCount-1)); // might have changed dimensions, for instance
+		Q_EMIT dataChanged(object_index, object_index.sibling(object_index.row(), ColumnCount-1)); // might have changed dimensions, for instance
 	}
 }
 
diff --git a/rkward/core/rkmodificationtracker.h b/rkward/core/rkmodificationtracker.h
index b8bbac85d..c7ad77df3 100644
--- a/rkward/core/rkmodificationtracker.h
+++ b/rkward/core/rkmodificationtracker.h
@@ -105,7 +105,7 @@ public:
 
 
 /**
-This class takes care of propagating object-modifications to all editors/variable-browsers etc. that need to know about them. For instance, if an object was removed in the R-workspace, the RObjectList will notify the RKModificationTracker. The modification tracker will then find out, whether there are editor(s) currently editing the removed object. If so, it will prompt the user what to do. Or, if an object is renamed in an editor, the RKModificationTracker will find out, whether the object is opened in further editors (not possible, yet) and tell those to update accordingly. It will further emit signals so the RObjectBrowser and RKVarselector(s) can update their object-lists.
+This class takes care of propagating object-modifications to all editors/variable-browsers etc. that need to know about them. For instance, if an object was removed in the R-workspace, the RObjectList will notify the RKModificationTracker. The modification tracker will then find out, whether there are editor(s) currently editing the removed object. If so, it will prompt the user what to do. Or, if an object is renamed in an editor, the RKModificationTracker will find out, whether the object is opened in further editors (not possible, yet) and tell those to update accordingly. It will further Q_EMIT signals so the RObjectBrowser and RKVarselector(s) can update their object-lists.
 
 @author Thomas Friedrichsmeier
 */
diff --git a/rkward/core/robject.h b/rkward/core/robject.h
index c1898492c..085318f4f 100644
--- a/rkward/core/robject.h
+++ b/rkward/core/robject.h
@@ -207,10 +207,10 @@ public:
 /** try to find the object as a child object of this object.
 @param name of the object (relative to this object)
 @returns a pointer to the object (if found) or 0 if not found */
-	RObject *findObject (const QString &name) { return findObjects (parseObjectPath (name), false, "$").value (0); };
+	RObject *findObject (const QString &name) { return findObjects (parseObjectPath (name), false, QStringLiteral("$")).value (0); };
 /** Function for code completion: given the partial name, find all objects matching this partial name
 @param partial_name The partial name to look up */
-	RObject::ObjectList findObjectsMatching (const QString &partial_name) { return findObjects (parseObjectPath (partial_name), true, "$"); };
+	RObject::ObjectList findObjectsMatching (const QString &partial_name) { return findObjects (parseObjectPath (partial_name), true, QStringLiteral("$")); };
 /** Get full-qualified object names for a list of objects as returned by findObjectsMatching */
 	static QStringList getFullNames (const RObject::ObjectList &objects, int options);
 
@@ -245,9 +245,9 @@ protected:
 	QStringList classnames;
 /** or-ed combination of PseudoObjectType flags of pseudo objects available in this object */
 	qint8 contained_objects;
-	RSlotsPseudoObject *slotsPseudoObject () const { return (hasPseudoObject (SlotsObject) ? slots_objects.value (this) : 0); };
+	RSlotsPseudoObject *slotsPseudoObject () const { return (hasPseudoObject (SlotsObject) ? slots_objects.value (this) : nullptr); };
 /** returns the namespace environment for this object. Always returns 0 for objects which are not a package environment! */
-	REnvironmentObject* namespaceEnvironment () const { return (hasPseudoObject (NamespaceObject) ? namespace_objects.value (this) : 0); };
+	REnvironmentObject* namespaceEnvironment () const { return (hasPseudoObject (NamespaceObject) ? namespace_objects.value (this) : nullptr); };
 	void setSpecialChildObject (RObject *special, PseudoObjectType special_type);
 
 /** Worker function for findObject() and findObjectsMatching().
diff --git a/rkward/core/robjectlist.cpp b/rkward/core/robjectlist.cpp
index 4562a628c..8f8ccd858 100644
--- a/rkward/core/robjectlist.cpp
+++ b/rkward/core/robjectlist.cpp
@@ -112,7 +112,7 @@ void RObjectList::updateFromR (RCommandChain *chain) {
 		return;
 	}
 
-	emit updateStarted();
+	Q_EMIT updateStarted();
 	update_chain = RInterface::startChain (chain);
 
 	RCommand *command = new RCommand("list (search (), loadedNamespaces ())", RCommand::App | RCommand::Sync | RCommand::GetStructuredData);
@@ -143,7 +143,7 @@ void RObjectList::updateFromR (RCommandChain *chain, const QStringList &current_
 		return;
 	}
 
-	emit updateStarted();
+	Q_EMIT updateStarted();
 	update_chain = RInterface::startChain (chain);
 
 	updateEnvironments (current_searchpath, false);
@@ -161,7 +161,7 @@ void RObjectList::makeUpdateCompleteCallback() {
 		update_chain = 0;
 
 		RK_DEBUG (OBJECTS, DL_DEBUG, "object list update complete");
-		emit updateComplete();
+		Q_EMIT updateComplete();
 	});
 	RInterface::issueCommand(command, update_chain);
 }
diff --git a/rkward/core/robjectlist.h b/rkward/core/robjectlist.h
index 6e464820f..65bc6b9ff 100644
--- a/rkward/core/robjectlist.h
+++ b/rkward/core/robjectlist.h
@@ -58,7 +58,7 @@ public:
 	/** A pseudo object containing as children all loaded namespaces which do not belong to a package on the search path */
 	RKOrphanNamespacesObject* orphanNamespacesObject () const { return orphan_namespaces; };
 	QString getObjectDescription () const override;
-signals:
+Q_SIGNALS:
 /// emitted when the list of objects is about to be updated	// TODO: remove me
 	void updateStarted ();
 /// emitted when the list of objects has been updated	// TODO: remove me
@@ -71,7 +71,7 @@ protected:
 	QString removeChildCommand (RObject *object) const override;
 /// reimplemented from RContainerObject to call "remove (objectname)" instead of "objectname <- NULL"
 	QString renameChildCommand (RObject *object, const QString &new_name) const override;
-/// reimplemented from RContainerObject to emit a change signal
+/// reimplemented from RContainerObject to Q_EMIT a change signal
 	void objectsChanged ();
 	bool updateStructure (RData *new_data) override;
 	void updateEnvironments (const QStringList &env_names, bool force_globalenv_update);
diff --git a/rkward/dataeditor/rkeditordataframe.h b/rkward/dataeditor/rkeditordataframe.h
index 963f4670a..eb8909219 100644
--- a/rkward/dataeditor/rkeditordataframe.h
+++ b/rkward/dataeditor/rkeditordataframe.h
@@ -37,7 +37,7 @@ public:
 
 /** Tells the editor to restore the given object in the R-workspace from its copy of the data */
 	void restoreObject (RObject *object) override;
-private slots:
+private Q_SLOTS:
 	void detachModel ();
 private:
 /// syncs the whole table.
diff --git a/rkward/dataeditor/rktextmatrix.cpp b/rkward/dataeditor/rktextmatrix.cpp
index 5cdfcdde8..fa0862d8a 100644
--- a/rkward/dataeditor/rktextmatrix.cpp
+++ b/rkward/dataeditor/rktextmatrix.cpp
@@ -41,7 +41,7 @@ RKTextMatrix RKTextMatrix::matrixFromClipboard () {
 }
 
 // static
-RKTextMatrix RKTextMatrix::matrixFromSeparatedValues (const QString& text, const QRegExp& tab, const QChar& brk) {
+RKTextMatrix RKTextMatrix::matrixFromSeparatedValues (const QString& text, const QRegularExpression& tab, const QChar& brk) {
 	RK_TRACE (EDITOR);
 
 	RKTextMatrix ret;
diff --git a/rkward/dataeditor/rktextmatrix.h b/rkward/dataeditor/rktextmatrix.h
index e2c9654bd..61d9def3a 100644
--- a/rkward/dataeditor/rktextmatrix.h
+++ b/rkward/dataeditor/rktextmatrix.h
@@ -9,6 +9,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #define RKTEXTMATRIX_H
 
 #include <QStringList>
+#include <QRegularExpression>
 
 /** This class is meant to assist paste operations in tables. Most importantly, it provides methods to map
 to and from text/tab-separated-values format, and it does not hickup in case of ragged length data.
@@ -20,7 +21,7 @@ public:
 	~RKTextMatrix ();
 
 	static RKTextMatrix matrixFromClipboard ();
-	static RKTextMatrix matrixFromSeparatedValues (const QString& text, const QRegExp& tab=QRegExp ("\t"), const QChar& brk='\n');
+	static RKTextMatrix matrixFromSeparatedValues (const QString& text, const QRegularExpression &tab = {"\t"}, const QChar& brk='\n');
 
 	QString toTabSeparatedValues () const;
 	void copyToClipboard () const;
diff --git a/rkward/dataeditor/rkvareditmodel.cpp b/rkward/dataeditor/rkvareditmodel.cpp
index 6dc6be09e..d4af69e30 100644
--- a/rkward/dataeditor/rkvareditmodel.cpp
+++ b/rkward/dataeditor/rkvareditmodel.cpp
@@ -85,7 +85,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) Q_EMIT modelDepleted();	// editor may or may want to auto-destruct
 }
 
 void RKVarEditModel::checkDuplicates () {
@@ -114,7 +114,7 @@ void RKVarEditModel::checkDuplicatesNow () {
 		}
 	}
 
-	if (!dupes.isEmpty ()) emit hasDuplicates(dupes);
+	if (!dupes.isEmpty ()) Q_EMIT hasDuplicates(dupes);
 }
 
 void RKVarEditModel::objectMetaChanged (RObject* changed) {
@@ -156,7 +156,7 @@ void RKVarEditModel::objectDataChanged (RObject* object, const RObject::ChangeSe
 		scheduleReset ();
 		return;
 	}
-	emit dataChanged(index(changes->from_index, cindex), index(changes->to_index, cindex));
+	Q_EMIT dataChanged(index(changes->from_index, cindex), index(changes->to_index, cindex));
 }
 
 void RKVarEditModel::doInsertColumns (int, int) {
@@ -187,7 +187,7 @@ bool RKVarEditModel::insertRows (int row, int count, const QModelIndex& parent)
 	beginInsertRows (QModelIndex (), row, row+count-1);
 	doInsertRowsInBackend (row, count);
 	for (int i=0; i < objects.size (); ++i) {
-// TODO: this does not emit any data change notifications to other editors
+// TODO: this does not Q_EMIT any data change notifications to other editors
 		objects[i]->insertRows (row, count);
 	}
 	endInsertRows ();
@@ -210,7 +210,7 @@ bool RKVarEditModel::removeRows (int row, int count, const QModelIndex& parent)
 	beginRemoveRows (QModelIndex (), row, lastrow);
 	doRemoveRowsInBackend (row, lastrow - row + 1);
 	for (int i=0; i < objects.size (); ++i) {
-// TODO: this does not emit any data change notifications to other editors
+// TODO: this does not Q_EMIT any data change notifications to other editors
 		objects[i]->removeRows (row, lastrow);
 	}
 	endRemoveRows ();
@@ -511,8 +511,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);
+	Q_EMIT dataChanged(index(0, atcolumn), index(RowCount - 1, atcolumn));
+	Q_EMIT headerDataChanged (Qt::Horizontal, atcolumn, atcolumn);
 }
 
 int RKVarEditMetaModel::rowCount (const QModelIndex& parent) const {
@@ -919,7 +919,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) Q_EMIT modelObjectDestroyed();
 }
 
 void RKVarEditDataFrameModel::childAdded (int index, RObject* parent) {
diff --git a/rkward/dataeditor/rkvareditmodel.h b/rkward/dataeditor/rkvareditmodel.h
index b525dbd29..4efe7be68 100644
--- a/rkward/dataeditor/rkvareditmodel.h
+++ b/rkward/dataeditor/rkvareditmodel.h
@@ -82,10 +82,10 @@ public:
 	void objectDataChanged (RObject* object, const RObject::ChangeSet *changes) override;
 
 	RKVariable* getObject (int index) const;
-signals:
+Q_SIGNALS:
 	void modelDepleted ();
 	void hasDuplicates (const QStringList& dupes);
-private slots:
+private Q_SLOTS:
 	void checkDuplicatesNow ();
 	void doResetNow ();
 private:
@@ -186,7 +186,7 @@ public:
 	RContainerObject* getObject () const { return dataframe; };
 
 	void restoreObject (RObject* object, RCommandChain* chain) override;
-signals:
+Q_SIGNALS:
 	void modelObjectDestroyed ();
 protected:
 	void doInsertColumns (int index, int count) override;
diff --git a/rkward/dataeditor/twintable.h b/rkward/dataeditor/twintable.h
index 5d43983a5..e03bb8736 100644
--- a/rkward/dataeditor/twintable.h
+++ b/rkward/dataeditor/twintable.h
@@ -46,7 +46,7 @@ public:
 
 	QActionGroup* editActions () const { return edit_actions; };
 	void setWindowStyleHint (const QString& hint) override;
-public slots:
+public Q_SLOTS:
 	void metaHeaderPressed (int section);
 	void metaHeaderEntered (int section);
 	void metaHeaderClicked (int section);
@@ -109,7 +109,7 @@ protected:
 	void initActions ();
 
 	RObject* main_object;
-private slots:
+private Q_SLOTS:
 /** inserts a new column (NOTE the action connected to this signal carries the info, where the column is to be inserted) */
 	void insertColumn ();
 /** inserts a new row in the dataview (NOTE the action connected to this signal carries the info, where the column is to be inserted) */
diff --git a/rkward/dataeditor/twintablemember.cpp b/rkward/dataeditor/twintablemember.cpp
index 1be8e41dc..73650427e 100644
--- a/rkward/dataeditor/twintablemember.cpp
+++ b/rkward/dataeditor/twintablemember.cpp
@@ -145,10 +145,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) Q_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) Q_EMIT contextMenuRequest(row, -1, verticalHeader()->mapToGlobal(pos));
 	} else {
 		RK_ASSERT (sender () == this);
 
@@ -157,7 +157,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));
+		Q_EMIT contextMenuRequest(row, col, mapToGlobal(pos));
 	}
 }
 
diff --git a/rkward/dataeditor/twintablemember.h b/rkward/dataeditor/twintablemember.h
index a41058496..2c6d74668 100644
--- a/rkward/dataeditor/twintablemember.h
+++ b/rkward/dataeditor/twintablemember.h
@@ -37,10 +37,10 @@ public:
 	void setRKModel (RKVarEditModelBase* model);
 	int trueRows () const override;	// re-implemented from RKTableView
 	int trueColumns () const override;	// re-implemented from RKTableView
-public slots:
+public Q_SLOTS:
 /** blanks out the currently selected cells (or the currently active cell, if there is no selection) */
 	void blankSelected ();
-signals:
+Q_SIGNALS:
 	void contextMenuRequest (int row, int col, const QPoint& pos);
 protected:
 	TwinTableMember *twin;
@@ -54,7 +54,7 @@ protected:
 	bool rw;
 friend class TwinTable;
 	void setTwin (TwinTableMember *new_twin);
-protected slots:
+protected Q_SLOTS:
 	void handleContextMenuRequest (const QPoint& pos);
 	void updateColWidth (int section, int old_w, int new_w);
 	void tableSelectionChanged (const QItemSelection& selected, const QItemSelection& deselected);
diff --git a/rkward/dialogs/rkloadlibsdialog.cpp b/rkward/dialogs/rkloadlibsdialog.cpp
index 24bc131ac..54e475552 100644
--- a/rkward/dialogs/rkloadlibsdialog.cpp
+++ b/rkward/dialogs/rkloadlibsdialog.cpp
@@ -74,7 +74,7 @@ RKLoadLibsDialog::RKLoadLibsDialog (QWidget *parent, RCommandChain *chain, bool
 		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);
+		Q_EMIT libraryLocationsChanged(library_locations);
 	});
 	RInterface::issueCommand(command, chain);
 }
@@ -154,7 +154,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);
+	Q_EMIT libraryLocationsChanged(library_locations);
 }
 
 bool RKLoadLibsDialog::removePackages (QStringList packages, QStringList from_liblocs) {
@@ -321,7 +321,7 @@ void RKLoadLibsDialog::runInstallationCommand (const QString& command, bool as_r
 	control->addRCommand(rcommand);
 	RInterface::issueCommand(rcommand, chain);
 	connect(rcommand->notifier(), &RCommandNotifier::commandFinished, this, [this]() {
-		emit installedPackagesChanged();
+		Q_EMIT installedPackagesChanged();
 	});
 }
 
@@ -593,7 +593,7 @@ public:
 				r.setLeft(r.left() + r.width()/2);
 				if (r.contains(e->pos())) {
 					if (event->type() == QEvent::MouseButtonRelease) {
-						emit selectAllUpdates();
+						Q_EMIT selectAllUpdates();
 					}
 					event->accept();
 					return true;
@@ -606,7 +606,7 @@ public:
 	QTreeView* table;
 	QIcon expanded;
 	QIcon collapsed;
-signals:
+Q_SIGNALS:
 	void selectAllUpdates();
 };
 
@@ -1106,9 +1106,9 @@ bool RKRPackageInstallationStatus::setData (const QModelIndex &index, const QVar
 	if (irow >= 0) installed_status[irow] = stat;
 	if (arow >= 0) available_status[arow] = stat;
 
-	emit dataChanged(index, index);
-	if (bindex.isValid ()) emit dataChanged(bindex, bindex);
-	emit changed();
+	Q_EMIT dataChanged(index, index);
+	if (bindex.isValid ()) Q_EMIT dataChanged(bindex, bindex);
+	Q_EMIT changed();
 
 	return true;
 }
diff --git a/rkward/dialogs/rkloadlibsdialog.h b/rkward/dialogs/rkloadlibsdialog.h
index a973be5f5..b113a4bb0 100644
--- a/rkward/dialogs/rkloadlibsdialog.h
+++ b/rkward/dialogs/rkloadlibsdialog.h
@@ -38,10 +38,10 @@ public:
 	virtual void apply() = 0;
 	virtual void activated() = 0;
 	bool isChanged() const { return _changed; };
-signals:
+Q_SIGNALS:
 	void changed();
 protected:
-	void setChanged() { _changed = true; emit changed(); };
+	void setChanged() { _changed = true; Q_EMIT changed(); };
 	void clearChanged() { _changed = false; };
 private:
 	bool _changed;
@@ -72,12 +72,12 @@ public:
 	static void showInstallPackagesModal (QWidget *parent, RCommandChain *chain, const QStringList &package_names);
 	static void showPluginmapConfig (QWidget *parent=0, RCommandChain *chain=0);
 	QStringList currentLibraryLocations ()  const { return library_locations; };
-signals:
+Q_SIGNALS:
 	void libraryLocationsChanged (const QStringList &liblocs);
 	void installedPackagesChanged ();
 protected:
 	void closeEvent (QCloseEvent *e) override;
-protected slots:
+protected Q_SLOTS:
 	void automatedInstall (const QStringList &packages);
 	void slotPageChanged ();
 private:
@@ -115,9 +115,9 @@ public:
 	~LoadUnloadWidget ();
 	void apply() override;
 	void activated() override;
-signals:
+Q_SIGNALS:
 	void loadUnloadDone ();
-public slots:
+public Q_SLOTS:
 	void loadButtonClicked ();
 	void detachButtonClicked ();
 	void updateInstalledPackages ();
@@ -191,9 +191,9 @@ public:
 /** reset all installation states to NoAction */
 	void clearStatus ();
 	bool initialized () const { return _initialized; };
-signals:
+Q_SIGNALS:
 	void changed();
-private slots:
+private Q_SLOTS:
 	void statusCommandFinished (RCommand *command);
 private:
 	QStringList available_packages, available_titles, available_versions, available_repos;
@@ -238,7 +238,7 @@ public:
 	void initialize ();
 	void apply() override;
 	void activated() override;
-public slots:
+public Q_SLOTS:
 	void filterChanged ();
 	void markAllUpdates ();
 	void configureRepositories ();
diff --git a/rkward/dialogs/rkrecoverdialog.h b/rkward/dialogs/rkrecoverdialog.h
index e52e73ef7..ba9858aec 100644
--- a/rkward/dialogs/rkrecoverdialog.h
+++ b/rkward/dialogs/rkrecoverdialog.h
@@ -23,7 +23,7 @@ protected:
 	~RKRecoverDialog ();
 	static QString saveFileFor (const QString &recovery_file);
 	QStringList files;
-private slots:
+private Q_SLOTS:
 	void deleteButtonClicked ();
 };
 
diff --git a/rkward/dialogs/rksavemodifieddialog.h b/rkward/dialogs/rksavemodifieddialog.h
index 6ad7f54ae..fd1be652d 100644
--- a/rkward/dialogs/rksavemodifieddialog.h
+++ b/rkward/dialogs/rksavemodifieddialog.h
@@ -31,7 +31,7 @@ private:
 	QMap<QTreeWidgetItem *, QPointer<RKMDIWindow>> window_checklist;
 	QTreeWidgetItem *save_project_check;
 	QMap<QTreeWidgetItem *, QString> outputdir_checklist;
-private slots:
+private Q_SLOTS:
 	void saveWorkplaceChanged ();
 	void saveSelected ();
 };
diff --git a/rkward/dialogs/rkselectlistdialog.h b/rkward/dialogs/rkselectlistdialog.h
index ffb9a6dc7..3875a7f21 100644
--- a/rkward/dialogs/rkselectlistdialog.h
+++ b/rkward/dialogs/rkselectlistdialog.h
@@ -33,7 +33,7 @@ protected:
 	RKSelectListDialog (QWidget *parent, const QString &caption, const QStringList& choices, const QStringList& preselected, bool multiple);
 	/** destructor */
 	~RKSelectListDialog ();
-private slots:
+private Q_SLOTS:
 	void updateState ();
 private:
 	QListWidget *input;
diff --git a/rkward/misc/celleditor.cpp b/rkward/misc/celleditor.cpp
index 262045be2..604366ed2 100644
--- a/rkward/misc/celleditor.cpp
+++ b/rkward/misc/celleditor.cpp
@@ -79,22 +79,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);
+				Q_EMIT done(this, RKItemDelegate::EditorExitLeft);
 				return;
 			}
 		}
 		if (e->key () == Qt::Key_Right) {
 			if (cursorPosition () >= (int) text ().length ()) {
-				emit done(this, RKItemDelegate::EditorExitRight);
+				Q_EMIT done(this, RKItemDelegate::EditorExitRight);
 				return;
 			}
 		}
 		if (e->key () == Qt::Key_Up) {
-			emit done(this, RKItemDelegate::EditorExitUp);
+			Q_EMIT done(this, RKItemDelegate::EditorExitUp);
 			return;
 		}
 		if (e->key () == Qt::Key_Down) {
-			emit done(this, RKItemDelegate::EditorExitDown);
+			Q_EMIT done(this, RKItemDelegate::EditorExitDown);
 			return;
 		}
 	}
diff --git a/rkward/misc/celleditor.h b/rkward/misc/celleditor.h
index c30d75fff..fc13f5d9d 100644
--- a/rkward/misc/celleditor.h
+++ b/rkward/misc/celleditor.h
@@ -35,9 +35,9 @@ public:
 	void setValueLabels (const RObject::ValueLabels& labels);
 
 	void setText (const QString& text);
-signals:
+Q_SIGNALS:
 	void done (QWidget* widget, RKItemDelegate::EditorDoneReason reason);
-public slots:
+public Q_SLOTS:
 	void selectedFromList (QAction* action);
 	void showValueLabels ();
 protected:
diff --git a/rkward/misc/editformatdialog.cpp b/rkward/misc/editformatdialog.cpp
index ea17b36da..4e5a1fd45 100644
--- a/rkward/misc/editformatdialog.cpp
+++ b/rkward/misc/editformatdialog.cpp
@@ -131,9 +131,9 @@ void EditFormatDialogProxy::dialogDone (int result) {
 
 	if (result == QDialog::Accepted) {
 		options = dialog->options;
-		emit done(this, RKItemDelegate::EditorExit);
+		Q_EMIT done(this, RKItemDelegate::EditorExit);
 	} else {
-		emit done(this, RKItemDelegate::EditorReject);
+		Q_EMIT done(this, RKItemDelegate::EditorReject);
 	}
 	dialog->deleteLater ();
 	dialog = 0;
diff --git a/rkward/misc/editformatdialog.h b/rkward/misc/editformatdialog.h
index 4a147bd7a..6d949f767 100644
--- a/rkward/misc/editformatdialog.h
+++ b/rkward/misc/editformatdialog.h
@@ -22,7 +22,7 @@ Allows editing of format-attributes for an RKVariable
 */
 class EditFormatDialog : public QDialog {
 	Q_OBJECT
-public slots:
+public Q_SLOTS:
 	void precisionFieldChanged (int);
 protected:
 /** reimplemented to make the newly selected options available */
@@ -52,9 +52,9 @@ public:
 
 	void initialize (const RKVariable::FormattingOptions& options, const QString& varname);
 	RKVariable::FormattingOptions getOptions () const { return options; };
-signals:
+Q_SIGNALS:
 	void done (QWidget* widget, RKItemDelegate::EditorDoneReason reason);
-protected slots:
+protected Q_SLOTS:
 	void dialogDone (int result);
 private:
 	RKVariable::FormattingOptions options;
diff --git a/rkward/misc/editlabelsdialog.cpp b/rkward/misc/editlabelsdialog.cpp
index 469fd3040..d4263675c 100644
--- a/rkward/misc/editlabelsdialog.cpp
+++ b/rkward/misc/editlabelsdialog.cpp
@@ -172,7 +172,7 @@ bool RKVarLevelsTableModel::setData (const QModelIndex& index, const QVariant& v
 		endInsertRows ();
 	} else {
 		labels.insert (QString::number (index.row () + 1), text);
-		emit dataChanged(index, index);
+		Q_EMIT dataChanged(index, index);
 	}
 
 	if (text.isEmpty ()) {	// remove trailing empty rows
@@ -253,9 +253,9 @@ void EditLabelsDialogProxy::dialogDone (int result) {
 
 	if (result == QDialog::Accepted) {
 		labels = dialog->table->lmodel->labels;
-		emit done(this, RKItemDelegate::EditorExit);
+		Q_EMIT done(this, RKItemDelegate::EditorExit);
 	} else {
-		emit done(this, RKItemDelegate::EditorReject);
+		Q_EMIT done(this, RKItemDelegate::EditorReject);
 	}
 	dialog->deleteLater ();
 	dialog = 0;
diff --git a/rkward/misc/editlabelsdialog.h b/rkward/misc/editlabelsdialog.h
index 221c9b591..7e9dec1ea 100644
--- a/rkward/misc/editlabelsdialog.h
+++ b/rkward/misc/editlabelsdialog.h
@@ -25,7 +25,7 @@ class RKVarLevelsTable : public RKTableView {
 public:
 	RKVarLevelsTable (QWidget *parent, const RObject::ValueLabels& labels);
 	~RKVarLevelsTable ();
-public slots:
+public Q_SLOTS:
 /** cut */
 	void cut ();
 /** cut */
@@ -88,9 +88,9 @@ public:
 	void initialize (const RObject::ValueLabels& labels, const QString& varname);
 
 	RObject::ValueLabels getLabels () const { return labels; };
-signals:
+Q_SIGNALS:
 	void done (QWidget* widget, RKItemDelegate::EditorDoneReason reason);
-protected slots:
+protected Q_SLOTS:
 	void dialogDone (int result);
 private:
 	EditLabelsDialog* dialog;
diff --git a/rkward/misc/getfilenamewidget.cpp b/rkward/misc/getfilenamewidget.cpp
index c376574b0..057c1b9c6 100644
--- a/rkward/misc/getfilenamewidget.cpp
+++ b/rkward/misc/getfilenamewidget.cpp
@@ -111,14 +111,14 @@ void GetFileNameWidget::hackOverrideDirDialog () {
 	dummy.setOptions (QFileDialog::ShowDirsOnly);
 	if (dummy.exec ()) {
 		edit->setUrl (QUrl::fromLocalFile (dummy.selectedFiles ().value (0)));
-		emit (locationChanged ());
+		Q_EMIT (locationChanged ());
 	}
 }
 #endif
 
 void GetFileNameWidget::locationEditChanged (const QString &) {
 	RK_TRACE (MISC);
-	emit locationChanged();
+	Q_EMIT locationChanged();
 }
 
 QString GetFileNameWidget::getLocation () {
diff --git a/rkward/misc/getfilenamewidget.h b/rkward/misc/getfilenamewidget.h
index b9f05c15b..5156b9406 100644
--- a/rkward/misc/getfilenamewidget.h
+++ b/rkward/misc/getfilenamewidget.h
@@ -35,13 +35,13 @@ public:
 
 /** retrieves the current location */
 	QString getLocation ();
-public slots:
+public Q_SLOTS:
 	void locationEditChanged (const QString &);
 	void updateLastUsedUrl (const QUrl& url);
-signals:
+Q_SIGNALS:
 	void locationChanged ();
 #ifdef Q_OS_WIN
-private slots:
+private Q_SLOTS:
 	void hackOverrideDirDialog ();
 #endif
 private:
diff --git a/rkward/misc/multistringselector.cpp b/rkward/misc/multistringselector.cpp
index f2c37ea2c..efc748a00 100644
--- a/rkward/misc/multistringselector.cpp
+++ b/rkward/misc/multistringselector.cpp
@@ -61,7 +61,7 @@ void MultiStringSelector::insertNewStringsImpl (int above_row) {
 	RK_TRACE (MISC);
 
 	QStringList new_strings;
-	emit getNewStrings(&new_strings);
+	Q_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]);
@@ -164,7 +164,7 @@ void RKMultiStringSelectorV2::buttonClicked () {
 
 	if (sender () == add_button) {
 		if (add_at_bottom || (row < 0)) row = tree_view->model ()->rowCount ();
-		emit insertNewStrings(row);
+		Q_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);
@@ -180,7 +180,7 @@ void RKMultiStringSelectorV2::buttonClicked () {
 			RK_ASSERT (row < tree_view->model ()->rowCount ());
 			rowb = qMin (row + 1, tree_view->model ()->rowCount () - 1);
 		}
-		emit swapRows(row, rowb);
+		Q_EMIT swapRows(row, rowb);
 		tree_view->setCurrentIndex (tree_view->model ()->index (rowb, 0));
 	}
 	anyModelDataChange ();
@@ -203,6 +203,6 @@ void RKMultiStringSelectorV2::updateButtons () {
 
 void RKMultiStringSelectorV2::anyModelDataChange () {
 	RK_TRACE (MISC);
-	emit listChanged();
+	Q_EMIT listChanged();
 }
 
diff --git a/rkward/misc/multistringselector.h b/rkward/misc/multistringselector.h
index 1c0e1a7ba..dcd22e708 100644
--- a/rkward/misc/multistringselector.h
+++ b/rkward/misc/multistringselector.h
@@ -31,7 +31,7 @@ public:
 	virtual ~RKMultiStringSelectorV2 ();
 	void setModel (QAbstractItemModel *model, int main_column=-1);
 	void setAlwaysAddAtBottom (bool always_add_at_bottom) { add_at_bottom = always_add_at_bottom; };
-public slots:
+public Q_SLOTS:
 	void buttonClicked ();
 	void updateButtons ();
 	void anyModelDataChange ();
@@ -42,7 +42,7 @@ protected:
 	QPushButton* up_button;
 	QPushButton* down_button;
 	bool add_at_bottom;
-signals:
+Q_SIGNALS:
 	void insertNewStrings (int above_row);
 	void swapRows (int rowa, int rowb);
 /** emitted whenever there is a change in the data selection */
@@ -65,10 +65,10 @@ public:
 	void setValues (const QStringList& values);
 private:
 	QStringListModel *model;
-private slots:
+private Q_SLOTS:
 	void insertNewStringsImpl (int above_row);
 	void swapRowsImpl (int rowa, int rowb);
-signals:
+Q_SIGNALS:
 /** This signal is triggered, when the "Add"-button is pressed. Connect to this to your custom slot, and add strings to the (empty) string_list. If you don't touch the string_list or set it to empty, nothing will be added to the list. */
 	void getNewStrings (QStringList *string_list);
 };
diff --git a/rkward/misc/rkaccordiontable.cpp b/rkward/misc/rkaccordiontable.cpp
index d72243551..3c7bf5131 100644
--- a/rkward/misc/rkaccordiontable.cpp
+++ b/rkward/misc/rkaccordiontable.cpp
@@ -156,7 +156,7 @@ public:
 	static const quint32 trailing_item_id = 0xFFFFFFFE;
 	int add_trailing_columns;
 	int add_trailing_rows;
-public slots:
+public Q_SLOTS:
 	void r_rowsInserted (const QModelIndex& parent, int start, int end) {
 		RK_TRACE (MISC);
 		RK_ASSERT (!parent.isValid ());
@@ -172,13 +172,13 @@ public slots:
 		endRemoveRows ();
 	}
 	void r_dataChanged (const QModelIndex& from, const QModelIndex& to) {
-		emit dataChanged(mapFromSource(from), mapFromSource(to));
+		Q_EMIT dataChanged(mapFromSource(from), mapFromSource(to));
 	}
 	void r_headerDataChanged(Qt::Orientation o,int from,int to) {
-		emit headerDataChanged(o, from, to);
+		Q_EMIT headerDataChanged(o, from, to);
 	}
 	void r_layoutChanged () {
-		emit layoutChanged();
+		Q_EMIT layoutChanged();
 	}
 };
 
@@ -382,7 +382,7 @@ void RKAccordionTable::rowClicked (QModelIndex row) {
 	}
 	if (!row.parent ().isValid ()) {
 		if (row.row () >= pmodel->rowCount () - pmodel->add_trailing_rows) {
-			emit addRow(row.row());
+			Q_EMIT addRow(row.row());
 		}
 	}
 }
@@ -394,7 +394,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());
+		Q_EMIT activated(current.row());
 	}
 }
 
@@ -483,7 +483,7 @@ void RKAccordionTable::removeClicked () {
 		RK_ASSERT (row >= 0);
 		return;
 	}
-	emit removeRow(row);
+	Q_EMIT removeRow(row);
 }
 
 void RKAccordionTable::setModel (QAbstractItemModel* model) {
diff --git a/rkward/misc/rkaccordiontable.h b/rkward/misc/rkaccordiontable.h
index 44b5cefa5..9e21c680f 100644
--- a/rkward/misc/rkaccordiontable.h
+++ b/rkward/misc/rkaccordiontable.h
@@ -25,13 +25,13 @@ public:
 	void setShowAddRemoveButtons (bool show);
 
 	QSize sizeHint () const override;                                                  // reimplemented to assure a proper size for the content
-public slots:
+public Q_SLOTS:
 	void rowExpanded (QModelIndex row);
 	void rowClicked (QModelIndex row);
 	void updateWidget ();
 	void removeClicked ();
 	void activateRow (int row);
-signals:
+Q_SIGNALS:
 	void activated (int row);
 	void addRow (int where);
 	void removeRow (int which);
diff --git a/rkward/misc/rkdbusapi.h b/rkward/misc/rkdbusapi.h
index 1b6faf9a7..7116ae88b 100644
--- a/rkward/misc/rkdbusapi.h
+++ b/rkward/misc/rkdbusapi.h
@@ -18,7 +18,7 @@ public:
 /** Creates an object (should be a singleton) to relay incoming DBus calls, and registers it on the session bus. */
 	explicit RKDBusAPI (QObject *parent);
 	~RKDBusAPI () {};
-public slots:
+public Q_SLOTS:
 	Q_SCRIPTABLE void openAnyUrl (const QStringList &urls, bool warn_external=true);
 };
 
diff --git a/rkward/misc/rkdynamicsearchline.cpp b/rkward/misc/rkdynamicsearchline.cpp
index 3263ffb0c..391588e14 100644
--- a/rkward/misc/rkdynamicsearchline.cpp
+++ b/rkward/misc/rkdynamicsearchline.cpp
@@ -61,5 +61,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);
+	Q_EMIT searchChanged(filter);
 }
diff --git a/rkward/misc/rkdynamicsearchline.h b/rkward/misc/rkdynamicsearchline.h
index 4568290f0..ef876d726 100644
--- a/rkward/misc/rkdynamicsearchline.h
+++ b/rkward/misc/rkdynamicsearchline.h
@@ -26,9 +26,9 @@ public:
 /** If a model is set, will call setFilterRegExp() when the search string is changed. */
 	void setModelToFilter (QSortFilterProxyModel* _model) { model = _model; };
 	QString regexpTip () const;
-signals:
+Q_SIGNALS:
 	void searchChanged (const QRegExp& search);
-private slots:
+private Q_SLOTS:
 	void textChanged ();
 	void delayedSearch ();
 private:
diff --git a/rkward/misc/rkfindbar.cpp b/rkward/misc/rkfindbar.cpp
index 4e1a116e0..22b704d7c 100644
--- a/rkward/misc/rkfindbar.cpp
+++ b/rkward/misc/rkfindbar.cpp
@@ -135,7 +135,7 @@ void RKFindBar::doSearch (bool backward) {
 	show ();
 	bool found = false;
 	QString term = term_edit->currentText ();
-	emit findRequest(term, backward, this, &found);
+	Q_EMIT findRequest(term, backward, this, &found);
 	if (!(found || term.isEmpty ())) indicateSearchFail();
 }
 
diff --git a/rkward/misc/rkfindbar.h b/rkward/misc/rkfindbar.h
index 17e088105..810ead569 100644
--- a/rkward/misc/rkfindbar.h
+++ b/rkward/misc/rkfindbar.h
@@ -36,14 +36,14 @@ However, these can't be inserted into anything other than QToolBar or QMenu... *
 	QCheckBox* getOption (const FindOptions option);
 	bool isOptionSet (const FindOptions option) const;
 	void indicateSearchFail ();
-public slots:
+public Q_SLOTS:
 	void activate ();
 	void activateWithFindAsYouType ();
 	void forward ();
 	void backward ();
-signals:
+Q_SIGNALS:
 	void findRequest (const QString& text, bool backwards, const RKFindBar *findbar, bool *result);
-private slots:
+private Q_SLOTS:
 /** search term _or_ search options changed. Triggers a forward search, if FindAsYouType is active */
 	void searchChanged ();
 private:
diff --git a/rkward/misc/rkjobsequence.cpp b/rkward/misc/rkjobsequence.cpp
index 3c11f068f..b9bfdb16c 100644
--- a/rkward/misc/rkjobsequence.cpp
+++ b/rkward/misc/rkjobsequence.cpp
@@ -45,7 +45,7 @@ void RKJobSequence::nextJob () {
 	RK_TRACE (MISC);
 
 	if (outstanding_jobs.isEmpty ()) {
-		emit finished(this);
+		Q_EMIT finished(this);
 		deleteLater ();
 		return;
 	}
diff --git a/rkward/misc/rkjobsequence.h b/rkward/misc/rkjobsequence.h
index b2ab4b494..39478f0a5 100644
--- a/rkward/misc/rkjobsequence.h
+++ b/rkward/misc/rkjobsequence.h
@@ -23,9 +23,9 @@ public:
 	bool hadError () const;
 	QStringList errors () const;
 	void start ();
-private slots:
+private Q_SLOTS:
 	void jobDone (KJob* job);
-signals:
+Q_SIGNALS:
 	void finished (RKJobSequence *seq);
 private:
 	void nextJob ();
diff --git a/rkward/misc/rkobjectlistview.cpp b/rkward/misc/rkobjectlistview.cpp
index 7e9b46c95..44106e38e 100644
--- a/rkward/misc/rkobjectlistview.cpp
+++ b/rkward/misc/rkobjectlistview.cpp
@@ -145,7 +145,7 @@ void RKObjectListView::contextMenuEvent (QContextMenuEvent* event) {
 
 	menu_object = objectAtIndex (indexAt (event->pos ()));
 	bool suppress = false;
-	emit aboutToShowContextMenu(menu_object, &suppress);
+	Q_EMIT aboutToShowContextMenu(menu_object, &suppress);
 
 	if (!suppress) menu->popup (event->globalPos ());
 }
@@ -495,5 +495,5 @@ void RKObjectListViewSettings::updateSelfNow () {
 
 	invalidateFilter ();
 
-	emit settingsChanged();
+	Q_EMIT settingsChanged();
 }
diff --git a/rkward/misc/rkobjectlistview.h b/rkward/misc/rkobjectlistview.h
index 822b85a7b..fa5405814 100644
--- a/rkward/misc/rkobjectlistview.h
+++ b/rkward/misc/rkobjectlistview.h
@@ -52,11 +52,11 @@ from your custom menu items, to figure out, which object you should operate on.
 	RObject* objectAtIndex (const QModelIndex& index) const;
 /** Takes care initializing the RKObjectListView */
 	void initialize ();
-signals:
+Q_SIGNALS:
 /** This signal is emitted just before the context-menu is shown. If you connect to this signal, you can make some adjustments to the context-menu.
 If you set *suppress to true, showing the context menu will be suppressed. */
 	void aboutToShowContextMenu (RObject *object, bool *suppress);
-public slots:
+public Q_SLOTS:
 	void updateComplete ();
 	void updateStarted ();
 	void settingsChanged ();
@@ -92,9 +92,9 @@ public:
 	void addSettingsToMenu (QMenu* menu, QAction* before);
 
 	QWidget* filterWidget (QWidget *parent);
-signals:
+Q_SIGNALS:
 	void settingsChanged ();
-public slots:
+public Q_SLOTS:
 	void filterSettingsChanged ();
 	void updateSelfNow ();
 	void resetFilters ();
diff --git a/rkward/misc/rkoutputdirectory.cpp b/rkward/misc/rkoutputdirectory.cpp
index 431055c67..23f5207ad 100644
--- a/rkward/misc/rkoutputdirectory.cpp
+++ b/rkward/misc/rkoutputdirectory.cpp
@@ -597,7 +597,7 @@ void RKOutputDirectory::setKnownModified(bool modified) {
 	RK_TRACE(APP);
 	if (known_modified != modified) {
 		known_modified = modified;
-		emit stateChange(isActive(), modified);
+		Q_EMIT stateChange(isActive(), modified);
 	}
 }
 
diff --git a/rkward/misc/rkoutputdirectory.h b/rkward/misc/rkoutputdirectory.h
index b3baa7152..e66bf59e7 100644
--- a/rkward/misc/rkoutputdirectory.h
+++ b/rkward/misc/rkoutputdirectory.h
@@ -76,7 +76,7 @@ public:
 	static void purgeAllNoAsk();
 
 	void setKnownModified(bool modified);
-signals:
+Q_SIGNALS:
 	void stateChange(bool active, bool modified);
 private:
 	RKOutputDirectory();
diff --git a/rkward/misc/rkprogresscontrol.cpp b/rkward/misc/rkprogresscontrol.cpp
index 6fc1547d6..5d37521d9 100644
--- a/rkward/misc/rkprogresscontrol.cpp
+++ b/rkward/misc/rkprogresscontrol.cpp
@@ -169,7 +169,7 @@ void RKProgressControl::dialogDestroyed () {
 				RInterface::instance()->cancelCommand(*it);
 			}
 		}
-		emit cancelled();
+		Q_EMIT cancelled();
 	}
 }
 
diff --git a/rkward/misc/rkprogresscontrol.h b/rkward/misc/rkprogresscontrol.h
index 874e58b9e..81bf250a5 100644
--- a/rkward/misc/rkprogresscontrol.h
+++ b/rkward/misc/rkprogresscontrol.h
@@ -71,9 +71,9 @@ public:
 /** Causes the dialog to delete itself, once all outstanding commands have finished. Usually set from doModel()/doNonModal(), instead. */
 	void autoDeleteWhenDone ();
 	QString fullCommandOutput ();
-signals:
+Q_SIGNALS:
 	void cancelled ();
-public slots:
+public Q_SLOTS:
 /** needed internally so we can easily keep track of whether the dialog is alive or not */
 	void dialogDestroyed ();
 /** the corresponding action has finished. If there have been no errors, the dialog is also closed. Otherwise, the text of the "cancel" button is changed to "finished". */
diff --git a/rkward/misc/rksaveobjectchooser.cpp b/rkward/misc/rksaveobjectchooser.cpp
index f9406bf4b..78c191f8d 100644
--- a/rkward/misc/rksaveobjectchooser.cpp
+++ b/rkward/misc/rksaveobjectchooser.cpp
@@ -132,7 +132,7 @@ void RKSaveObjectChooser::objectRemoved (RObject* removed) {
 		setRootObject (0);
 	} else if (removed == current_object) {
 		stopListenForObject (removed);
-		current_full_name.clear ();	// hack to achieve proper emit of change signal
+		current_full_name.clear ();	// hack to achieve proper Q_EMIT of change signal
 		QTimer::singleShot (0, this, SLOT (updateState()));
 	} else {
 		RK_ASSERT (false);
@@ -187,7 +187,7 @@ void RKSaveObjectChooser::updateState () {
 
 	if ((new_name != current_full_name) || (sender () == overwrite_confirm)) {
 		current_full_name = new_name;
-		emit changed(isOk());
+		Q_EMIT changed(isOk());
 	}
 }
 
diff --git a/rkward/misc/rksaveobjectchooser.h b/rkward/misc/rksaveobjectchooser.h
index 7f072304f..3f60ce9c3 100644
--- a/rkward/misc/rksaveobjectchooser.h
+++ b/rkward/misc/rksaveobjectchooser.h
@@ -31,10 +31,10 @@ public:
 	void setStyleSheet (const QString &style);
 	RObject* rootObject () const { return root_object; };
 	void setRootObject (RObject* new_root);
-private slots:
+private Q_SLOTS:
 	void updateState ();
 	void selectRootObject ();
-signals:
+Q_SIGNALS:
 	void changed (bool);
 protected:
 	void objectRemoved (RObject* removed) override;
diff --git a/rkward/misc/rkspecialactions.cpp b/rkward/misc/rkspecialactions.cpp
index 5a3ce0d40..25ef58261 100644
--- a/rkward/misc/rkspecialactions.cpp
+++ b/rkward/misc/rkspecialactions.cpp
@@ -33,7 +33,7 @@ void RKPasteSpecialAction::doSpecialPaste() {
 	RKPasteSpecialDialog* dialog = new RKPasteSpecialDialog(pwin);
 	int res = dialog->exec();
 	if (res == QDialog::Accepted) {
-		emit pasteText(dialog->resultingText());
+		Q_EMIT pasteText(dialog->resultingText());
 	}
 	dialog->deleteLater();
 }
diff --git a/rkward/misc/rkspecialactions.h b/rkward/misc/rkspecialactions.h
index c1d317e45..1c395d865 100644
--- a/rkward/misc/rkspecialactions.h
+++ b/rkward/misc/rkspecialactions.h
@@ -18,10 +18,10 @@ class RKPasteSpecialAction : public QAction {
 public:
 	explicit RKPasteSpecialAction (QObject* parent);
 	~RKPasteSpecialAction ();
-public slots:
+public Q_SLOTS:
 /** The actual workhorse of the action. */
 	void doSpecialPaste ();
-signals:
+Q_SIGNALS:
 /** Connect to this signal to receive the resulting text to be pasted */
 	void pasteText (const QString&);
 };
@@ -63,7 +63,7 @@ public:
 	
 	QString resultingText ();
 	void accept() override;
-public slots:
+public Q_SLOTS:
 	void updateState ();
 private:
 	QString prepString (const QString& src, const Quoting quot) const;
diff --git a/rkward/misc/rkspinbox.cpp b/rkward/misc/rkspinbox.cpp
index 6283644a2..d22654388 100644
--- a/rkward/misc/rkspinbox.cpp
+++ b/rkward/misc/rkspinbox.cpp
@@ -94,7 +94,7 @@ QValidator::State RKSpinBox::validate (QString &input, int &pos) const {
 void RKSpinBox::emitValueChange () {
 	RK_TRACE (MISC);
 
-	emit valueChanged(0);
+	Q_EMIT valueChanged(0);
 }
 
 void RKSpinBox::updateValue (int change) {
diff --git a/rkward/misc/rkspinbox.h b/rkward/misc/rkspinbox.h
index 41138c0f2..1f4039532 100644
--- a/rkward/misc/rkspinbox.h
+++ b/rkward/misc/rkspinbox.h
@@ -58,7 +58,7 @@ protected:
 /** reimplemented from QSpinBox to adjust the internal value */
 	void stepBy (int steps) override;
 	QValidator::State validate (QString &input, int &pos ) const override;
-private slots:
+private Q_SLOTS:
 	void updateValue (int value);
 	void emitValueChange ();
 private:
diff --git a/rkward/misc/rkstandardactions.cpp b/rkward/misc/rkstandardactions.cpp
index 3869d125b..a9b481ee2 100644
--- a/rkward/misc/rkstandardactions.cpp
+++ b/rkward/misc/rkstandardactions.cpp
@@ -75,7 +75,7 @@ public:
 		setText (i18n ("&Function reference"));
 		connect (this, &QAction::triggered, this, &RKSearchRHelpAction::doSearch);
 	};
-public slots:
+public Q_SLOTS:
 	void doSearch () {
 		RK_TRACE (MISC);
 		QString symbol, package;
@@ -117,7 +117,7 @@ public:
 	QAction *action () {
 		return menu->menuAction ();
 	}
-public slots:
+public Q_SLOTS:
 	void init () {
 		RK_TRACE (MISC);
 		QString symbol, package;
diff --git a/rkward/misc/rktableview.cpp b/rkward/misc/rktableview.cpp
index 894146a7d..55e083403 100644
--- a/rkward/misc/rktableview.cpp
+++ b/rkward/misc/rktableview.cpp
@@ -92,7 +92,7 @@ void RKTableView::keyPressEvent (QKeyEvent *e) {
 	RK_TRACE (EDITOR);
 
 	if ((e->key () == Qt::Key_Delete) || (e->key () == Qt::Key_Backspace)) {
-		emit blankSelectionRequest();
+		Q_EMIT blankSelectionRequest();
 		e->accept ();
 	} else {
 		QTableView::keyPressEvent (e);
@@ -258,8 +258,8 @@ bool RKItemDelegate::eventFilter (QObject* object, QEvent* event) {
 void RKItemDelegate::editorDone (QWidget* editor, RKItemDelegate::EditorDoneReason reason) {
 	RK_TRACE (EDITOR);
 
-	if (reason != EditorReject) emit commitData(editor);
-	emit doCloseEditor(editor, reason);
+	if (reason != EditorReject) Q_EMIT commitData(editor);
+	Q_EMIT doCloseEditor(editor, reason);
 	locked_for_modal_editor = false;
 }
 
diff --git a/rkward/misc/rktableview.h b/rkward/misc/rktableview.h
index b045abd83..068274eae 100644
--- a/rkward/misc/rktableview.h
+++ b/rkward/misc/rktableview.h
@@ -38,10 +38,10 @@ public:
 		EditorReject,
 		EditorExit
 	};
-signals:
+Q_SIGNALS:
 	// much like QAbstractItemDelegate::closeEditor(), but with our own flexible EndEditHint
 	void doCloseEditor (QWidget* editor, RKItemDelegate::EditorDoneReason);
-public slots:
+public Q_SLOTS:
 	void editorDone (QWidget* editor, RKItemDelegate::EditorDoneReason reason);
 private:
 	RKVarEditModel* datamodel;
@@ -71,12 +71,12 @@ public:
 	QItemSelectionRange getSelectionBoundaries () const;
 	int trailing_rows;
 	int trailing_columns;
-signals:
+Q_SIGNALS:
 	void blankSelectionRequest ();
 protected:
-/** will emit blankSelectionRequest() on DEL and BACKSPACE. Also scrolls to current index on key presses. */
+/** will Q_EMIT blankSelectionRequest() on DEL and BACKSPACE. Also scrolls to current index on key presses. */
 	void keyPressEvent (QKeyEvent *e) override;
-private slots:
+private Q_SLOTS:
 	void editorDone (QWidget* editor, RKItemDelegate::EditorDoneReason reason);
 };
 
diff --git a/rkward/misc/rkxmlguipreviewarea.cpp b/rkward/misc/rkxmlguipreviewarea.cpp
index d89192a4f..f20f115ee 100644
--- a/rkward/misc/rkxmlguipreviewarea.cpp
+++ b/rkward/misc/rkxmlguipreviewarea.cpp
@@ -79,7 +79,7 @@ RKXMLGUIPreviewArea::RKXMLGUIPreviewArea (const QString &label, QWidget* parent)
 	QToolButton *tb = new QToolButton();
 	tb->setAutoRaise(true);
 	tb->setIcon(RKStandardIcons::getIcon(RKStandardIcons::ActionDelete));
-	connect(tb, &QAbstractButton::clicked, this, [this]() { hide(); emit previewClosed(this); });
+	connect(tb, &QAbstractButton::clicked, this, [this]() { hide(); Q_EMIT previewClosed(this); });
 
 	QToolButton *menu_button = new QToolButton(this);
 	menu_button->setPopupMode(QToolButton::InstantPopup);
@@ -249,7 +249,7 @@ void RKPreviewManager::setStatusMessage (const QString& message) {
 	RKMDIWindow *window = RKWorkplace::mainWorkplace ()->getNamedWindow (id);
 	if (window) window->setStatusMessage (message);
 
-	emit statusChanged();
+	Q_EMIT statusChanged();
 }
 
 QString RKPreviewManager::shortStatusLabel() const {
diff --git a/rkward/misc/rkxmlguipreviewarea.h b/rkward/misc/rkxmlguipreviewarea.h
index 846eef951..e0850965c 100644
--- a/rkward/misc/rkxmlguipreviewarea.h
+++ b/rkward/misc/rkxmlguipreviewarea.h
@@ -30,9 +30,9 @@ public:
 	QString label() const;
 	void setLabel(const QString &label);
 	void setWindow(RKMDIWindow* window);
-protected slots:
+protected Q_SLOTS:
 	void prepareMenu ();
-signals:
+Q_SIGNALS:
 	void previewClosed (RKXMLGUIPreviewArea *preview);
 private:
 	QLabel *lab;
@@ -62,9 +62,9 @@ public:
 	bool needsCommand () const { return !updating && (update_pending == UpdatePending); };
 	QString previewId () const { return id; };
 	QString shortStatusLabel () const;
-signals:
+Q_SIGNALS:
 	void statusChanged ();
-private slots:
+private Q_SLOTS:
 	void previewCommandDone (RCommand *command);
 private:
 	void setStatusMessage (const QString &);
diff --git a/rkward/misc/rkxmlguisyncer_p.h b/rkward/misc/rkxmlguisyncer_p.h
index 05a8cd5d9..46ba2ab01 100644
--- a/rkward/misc/rkxmlguisyncer_p.h
+++ b/rkward/misc/rkxmlguisyncer_p.h
@@ -25,8 +25,8 @@ public:
 	explicit RKXMLGUISyncerNotifier (QObject *parent) : QObject (parent) {};
 	~RKXMLGUISyncerNotifier () {};
 
-	void emitChangeSignal (KXMLGUIClient *client) { emit changed(client); };
-signals:
+	void emitChangeSignal (KXMLGUIClient *client) { Q_EMIT changed(client); };
+Q_SIGNALS:
 	void changed (KXMLGUIClient *client);
 };
 
@@ -50,7 +50,7 @@ public:
 	QTimer rebuild_guis_timer;
 
 	KDirWatch *file_watcher;
-public slots:
+public Q_SLOTS:
 	void uiRcFileChanged (const QString &path);
 	void actionCollectionDestroyed (QObject *object);
 	void guiFactoryDestroyed (QObject *object);
diff --git a/rkward/plugin/rkabstractoptionselector.h b/rkward/plugin/rkabstractoptionselector.h
index 0ada50703..005c7beec 100644
--- a/rkward/plugin/rkabstractoptionselector.h
+++ b/rkward/plugin/rkabstractoptionselector.h
@@ -31,7 +31,7 @@ public:
 	QVariant value (const QString &modifier=QString ()) override { return (string->value (modifier)); };
 /** reimplemented from RKComponent to add enabledness properties for the options, dynamically, if requested */
 	RKComponentBase* lookupComponent (const QString &identifier, QString *remainder) override;
-public slots:
+public Q_SLOTS:
 	void itemSelected (int id);
 	void propertyChanged (RKComponentPropertyBase *property);
 	void ItemPropertyChanged (RKComponentPropertyBase *property);
diff --git a/rkward/plugin/rkcheckbox.h b/rkward/plugin/rkcheckbox.h
index 003d4165a..b60cb4148 100644
--- a/rkward/plugin/rkcheckbox.h
+++ b/rkward/plugin/rkcheckbox.h
@@ -32,7 +32,7 @@ public:
 		return (state->value (modifier));
 	};
 	QStringList getUiLabelPair () const override;
-public slots:
+public Q_SLOTS:
 	void changedStateFromUi (int);
 	void changedState (RKComponentPropertyBase *);
 private:
diff --git a/rkward/plugin/rkcomponent.cpp b/rkward/plugin/rkcomponent.cpp
index f64e019a3..a28f26c9c 100644
--- a/rkward/plugin/rkcomponent.cpp
+++ b/rkward/plugin/rkcomponent.cpp
@@ -377,7 +377,7 @@ void RKComponent::changed () {
 		parentComponent ()->changed ();
 	}
 
-	emit componentChanged(this);
+	Q_EMIT componentChanged(this);
 }
 
 RKStandardComponent *RKComponent::standardComponent (QString *id_adjust) const {
diff --git a/rkward/plugin/rkcomponent.h b/rkward/plugin/rkcomponent.h
index 4780ef8a9..898032052 100644
--- a/rkward/plugin/rkcomponent.h
+++ b/rkward/plugin/rkcomponent.h
@@ -176,7 +176,7 @@ public:
 	virtual void addComponentToCurrentPage (RKComponent *component);
 /** @returns true if the component is inactive, i.e. disabled, or hidden in the GUI */
 	bool isInactive ();
-public slots:
+public Q_SLOTS:
 /** This handles changes in the default properties (enabledness, visibility, requiredness). You will use similar slots in derived classes to handle
 specialized properties */
 	void propertyValueChanged (RKComponentPropertyBase *property);
@@ -204,10 +204,10 @@ public:
 
 /** Find the id of this component. NOTE: this is slow. Better to store the id in the first place, if needed */
 	QString getIdInParent () const;
-protected slots:
+protected Q_SLOTS:
 /** if a child component self-destructs, it should remove itself from its parent *before* destructing. Don't use in a regular destructor. Call only if the child dies unexpectedly */
 	void removeFromParent ();
-signals:
+Q_SIGNALS:
 /** emitted from changed() */
 	void componentChanged (RKComponent* component);
 protected:
diff --git a/rkward/plugin/rkcomponentcontext.h b/rkward/plugin/rkcomponentcontext.h
index 983187eb4..e7bdc9ff1 100644
--- a/rkward/plugin/rkcomponentcontext.h
+++ b/rkward/plugin/rkcomponentcontext.h
@@ -39,7 +39,7 @@ protected:
 	~RKContextHandler ();
 /** add a QAction to the context. To be called from RKContext::makeContextHandler(). */
 	void addAction (const QString &id, RKComponentHandle *handle);
-private slots:
+private Q_SLOTS:
 /** slot to handle plugin activation */
 	void componentActionActivated ();
 private:
diff --git a/rkward/plugin/rkcomponentmap.h b/rkward/plugin/rkcomponentmap.h
index ed6c6512e..d8fd85ddf 100644
--- a/rkward/plugin/rkcomponentmap.h
+++ b/rkward/plugin/rkcomponentmap.h
@@ -240,7 +240,7 @@ public:
 	QStringList listPlugins ();
 	void setPluginStatus (const QStringList &ids, const QStringList &contexts, const QStringList& visible);
 	bool isPluginMapLoaded (const QString& abs_filename) const;
-public slots:
+public Q_SLOTS:
 /** Slot called, when a menu-item for a component is selected. Responsible for creating the GUI. */
 	void activateComponent ();
 private:
diff --git a/rkward/plugin/rkcomponentproperties.cpp b/rkward/plugin/rkcomponentproperties.cpp
index 6bfb9c6c2..9f3b59a3c 100644
--- a/rkward/plugin/rkcomponentproperties.cpp
+++ b/rkward/plugin/rkcomponentproperties.cpp
@@ -53,7 +53,7 @@ Currently these modifiers are known (but check the sources if in doubt):
 See RKComponentPropertyConvert
 
 \section RKComponentPropertyInternals Internal workings
-RKComponentProperties are QObjects, and communicate with each other via signals and slots. On each change they emit a RKComponentPropertyBase::valueChanged (RKComponentPropertyBase *) signal with a pointer to self as parameter.
+RKComponentProperties are QObjects, and communicate with each other via signals and slots. On each change they Q_EMIT a RKComponentPropertyBase::valueChanged (RKComponentPropertyBase *) signal with a pointer to self as parameter.
 
 Properties can be connected to each other using RKComponentPropertyBase::connectToGovernor (). The calling property will connect to the governor's valueChange () signal, and keep itself in sync.
 
@@ -115,7 +115,7 @@ bool RKComponentPropertyBase::setValue (const QString &string) {
 	RK_TRACE (PLUGIN);
 
 	_value = string;
-	emit valueChanged(this);
+	Q_EMIT valueChanged(this);
 	return true;
 }
 
@@ -300,7 +300,7 @@ void RKComponentPropertyStringList::doChange () {
 	RK_TRACE (PLUGIN);
 	is_valid = checkListLength ();
 	_value.clear ();
-	emit valueChanged(this);
+	Q_EMIT valueChanged(this);
 }
 
 ///////////////////////////////////////////// Bool //////////////////////////////////////////
@@ -399,7 +399,7 @@ void RKComponentPropertyBool::setBoolValue (bool new_value) {
 	RK_TRACE (PLUGIN);
 
 	internalSetValue (new_value);
-	emit valueChanged(this);
+	Q_EMIT valueChanged(this);
 }
 
 bool RKComponentPropertyBool::boolValue () {
@@ -428,7 +428,7 @@ bool RKComponentPropertyBool::setValue (const QString &string) {
 	RK_TRACE (PLUGIN);
 
 	internalSetValue (string);
-	emit valueChanged(this);
+	Q_EMIT valueChanged(this);
 	return isValid ();
 }
 
@@ -452,7 +452,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);
+	Q_EMIT valueChanged(this);
 }
 
 
@@ -473,7 +473,7 @@ bool RKComponentPropertyInt::setIntValue (int new_value) {
 	RK_TRACE (PLUGIN);
 
 	internalSetValue (new_value);
-	emit valueChanged(this);
+	Q_EMIT valueChanged(this);
 	return (isValid ());
 }
 
@@ -481,7 +481,7 @@ bool RKComponentPropertyInt::setValue (const QString &string) {
 	RK_TRACE (PLUGIN);
 
 	internalSetValue (string);
-	emit valueChanged(this);
+	Q_EMIT valueChanged(this);
 	return (isValid ());
 }
 
@@ -586,7 +586,7 @@ void RKComponentPropertyInt::governorValueChanged (RKComponentPropertyBase *prop
 		internalSetValue(value.toString());
 	}
 
-	emit valueChanged(this);
+	Q_EMIT valueChanged(this);
 }
 
 QIntValidator *RKComponentPropertyInt::getValidator () {
@@ -631,7 +631,7 @@ bool RKComponentPropertyDouble::setDoubleValue (double new_value) {
 	RK_TRACE (PLUGIN);
 
 	internalSetValue (new_value);
-	emit valueChanged(this);
+	Q_EMIT valueChanged(this);
 	return (isValid ());
 }
 
@@ -639,7 +639,7 @@ bool RKComponentPropertyDouble::setValue (const QString &string) {
 	RK_TRACE (PLUGIN);
 
 	internalSetValue (string);
-	emit valueChanged(this);
+	Q_EMIT valueChanged(this);
 	return (isValid ());
 }
 
@@ -744,7 +744,7 @@ void RKComponentPropertyDouble::governorValueChanged (RKComponentPropertyBase *p
 		internalSetValue (value.toString ());
 	}
 
-	emit valueChanged(this);
+	Q_EMIT valueChanged(this);
 }
 
 QDoubleValidator *RKComponentPropertyDouble::getValidator () {
@@ -815,7 +815,7 @@ bool RKComponentPropertyRObjects::addObjectValue (RObject *object) {
 
 	if (addObjectValueSilent (object)) {
 		updateValidity ();
-		emit valueChanged(this);
+		Q_EMIT valueChanged(this);
 		return isValid ();
 	}
 	return false;
@@ -843,7 +843,7 @@ void RKComponentPropertyRObjects::objectRemoved (RObject *object) {
 		problems.remove (object);
 		stopListenForObject (object);
 		updateValidity ();
-		emit valueChanged(this);
+		Q_EMIT valueChanged(this);
 	}
 }
 
@@ -857,7 +857,7 @@ void RKComponentPropertyRObjects::removeAt (int index) {
 	problems.remove (obj);
 	if (!object_list.contains (obj)) stopListenForObject (obj);
 	updateValidity ();
-	emit valueChanged(this);
+	Q_EMIT valueChanged(this);
 }
 
 void RKComponentPropertyRObjects::setClassFilter (const QStringList &classes) {
@@ -902,7 +902,7 @@ bool RKComponentPropertyRObjects::setObjectValueSilent (RObject* object) {
 bool RKComponentPropertyRObjects::setObjectValue (RObject *object) {
 	setObjectValueSilent (object);
 	updateValidity ();
-	emit valueChanged(this);
+	Q_EMIT valueChanged(this);
 	return isValid ();
 }
 
@@ -915,7 +915,7 @@ void RKComponentPropertyRObjects::setObjectList (const RObject::ObjectList &newl
 			addObjectValueSilent (newlist[i]);
 		}
 		updateValidity ();
-		emit valueChanged(this);
+		Q_EMIT valueChanged(this);
 	}
 }
 
@@ -1008,7 +1008,7 @@ bool RKComponentPropertyRObjects::setValueList (const QStringList& values) {
 	}
 
 	updateValidity ();
-	emit valueChanged(this);
+	Q_EMIT valueChanged(this);
 	return (isValid () && ok);
 }
 
@@ -1133,7 +1133,7 @@ void RKComponentPropertyRObjects::objectMetaChanged (RObject *object) {
 			if (probs.isEmpty ()) problems.remove (object);
 			else problems.insert (object, probs);
 			updateValidity ();
-			emit valueChanged(this);
+			Q_EMIT valueChanged(this);
 		}
 	}
 }
@@ -1155,7 +1155,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) Q_EMIT valueChanged(this);
 	}
 }
 
@@ -1388,7 +1388,7 @@ void RKComponentPropertySwitch::selfChanged (RKComponentPropertyBase *) {
 
 void RKComponentPropertySwitch::sourcePropertyChanged (RKComponentPropertyBase*) {
 	RK_TRACE (PLUGIN);
-	emit valueChanged(this);	// new value will be pulled by anyone interested
+	Q_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 a9b874b74..3abc4092a 100644
--- a/rkward/plugin/rkcomponentproperties.h
+++ b/rkward/plugin/rkcomponentproperties.h
@@ -45,11 +45,11 @@ public:
 Generally with few exceptions, you can only connect to properties that are either of the same class as this property, or of an extended class. Maybe in the future we will add some sophisticated converters allowing to connect vastly different types of properties in a meaningful way.
 If you specify a modifier, only the sub-value indicated by the modifier will be retrieved from the governing property on governorValueChanged. In this case reconcile_requirements is ignored. */
 	virtual void connectToGovernor (RKComponentPropertyBase *governor, const QString &modifier=QString (), bool reconcile_requirements=true);
-signals:
+Q_SIGNALS:
 /** property has changed its value. Any connected RKComponentPropertys/RKComponents should update their state
 @param property A pointer to the changed property for easy reference */
 	void valueChanged (RKComponentPropertyBase *property);
-public slots:
+public Q_SLOTS:
 /** the (Qt-)slot in which (by default) the (RKComponent-)property is notified, when a property it depends on has changed. Generally you should reimplement this function to add special handling for the properties you know about. */
 	virtual void governorValueChanged (RKComponentPropertyBase *property);
 protected:
@@ -132,7 +132,7 @@ public:
 /** @param value_true string value if true/on
 @param value_false string value if false/off
 @param default_state value to use, if invalid string value was set */
-	RKComponentPropertyBool (QObject *parent, bool required, bool default_state=true, const QString &value_true="true", const QString &value_false="false");
+	RKComponentPropertyBool (QObject *parent, bool required, bool default_state=true, const QString &value_true=QStringLiteral("true"), const QString &value_false=QStringLiteral("false"));
 /** destructor */
 	~RKComponentPropertyBool ();
 /** Set this property to the inverted, i.e. true if set to false and vice-versa. Used for the "not" sub-property. */
@@ -375,13 +375,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; Q_EMIT valueChanged(this); };
 /** see setPreprocess () */
-	void setCalculate (const QString &code) { calculate_code = code; emit valueChanged(this); };
+	void setCalculate (const QString &code) { calculate_code = code; Q_EMIT valueChanged(this); };
 /** see setPreprocess () */
-	void setPrintout (const QString &code) { printout_code = code; emit valueChanged(this); };
+	void setPrintout (const QString &code) { printout_code = code; Q_EMIT valueChanged(this); };
 /** see setPreview () */
-	void setPreview (const QString &code) { preview_code = code; emit valueChanged(this); };
+	void setPreview (const QString &code) { preview_code = code; Q_EMIT valueChanged(this); };
 
 	bool isValid () override { return (!(preprocess_code.isNull () || calculate_code.isNull () || printout_code.isNull ())); };
 
@@ -435,7 +435,7 @@ public:
 	void connectToGovernor (RKComponentPropertyBase *governor, const QString &modifier=QString (), bool reconcile_requirements=true) override;
 /** reimplemented to do raise a warning, and do nothing else. */
 	bool setValue (const QString &value) override;
-public slots:
+public Q_SLOTS:
 /** unfortunately, as the parent component likely does not know about us, we have to notify it manually of any changes. That's done from this slot */
 	void selfChanged (RKComponentPropertyBase *);
 /** a source property changed. Check the state */
@@ -472,7 +472,7 @@ public:
 
 	QVariant value (const QString &modifier=QString ()) override;
 	int type () override { return PropertySwitch; };
-public slots:
+public Q_SLOTS:
 /** unfortuntely, as the parent component likely does not know about us, we have to notify it manually of any changes. That's done from this slot */
 	void selfChanged (RKComponentPropertyBase *);
 /** a source property changed. Check the state */
diff --git a/rkward/plugin/rkdropdown.h b/rkward/plugin/rkdropdown.h
index f284537c2..b83fc923f 100644
--- a/rkward/plugin/rkdropdown.h
+++ b/rkward/plugin/rkdropdown.h
@@ -23,7 +23,7 @@ public:
 	RKDropDown (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget);
 	~RKDropDown ();
 	int type () override { return ComponentDropDown; };
-public slots:
+public Q_SLOTS:
 	// workaround for a qt bug (3.3.7)
 	void comboItemActivated (int id);
 protected:
diff --git a/rkward/plugin/rkformula.h b/rkward/plugin/rkformula.h
index 58f811c46..2d0e6e7be 100644
--- a/rkward/plugin/rkformula.h
+++ b/rkward/plugin/rkformula.h
@@ -36,7 +36,7 @@ public:
 
 /** RTTI */
 	int type () override { return ComponentFormula; };
-public slots:
+public Q_SLOTS:
 	void typeChange (int id);
 	void addButtonClicked ();
 	void removeButtonClicked ();
diff --git a/rkward/plugin/rkinput.h b/rkward/plugin/rkinput.h
index b4ebfcc66..f02dd484f 100644
--- a/rkward/plugin/rkinput.h
+++ b/rkward/plugin/rkinput.h
@@ -31,7 +31,7 @@ public:
 	QStringList getUiLabelPair () const override;
 	int type () override { return ComponentInput; };
 	bool isValid () override;
-public slots:
+public Q_SLOTS:
 	void textChanged ();
 	void textChangedFromUi ();
 	void requirednessChanged (RKComponentPropertyBase *);
diff --git a/rkward/plugin/rkmatrixinput.cpp b/rkward/plugin/rkmatrixinput.cpp
index c05787d47..ff2a3667f 100644
--- a/rkward/plugin/rkmatrixinput.cpp
+++ b/rkward/plugin/rkmatrixinput.cpp
@@ -178,7 +178,7 @@ void RKMatrixInput::setCellValue (int row, int column, const QString& value) {
 	}
 	col.storage[row] = value;
 	updateColumn (column);
-	emit model->dataChanged(model->index(row, column), model->index(row, column));
+	Q_EMIT model->dataChanged(model->index(row, column), model->index(row, column));
 }
 
 void RKMatrixInput::setColumnValue (int column, const QString& value) {
@@ -187,7 +187,7 @@ void RKMatrixInput::setColumnValue (int column, const QString& value) {
 	if (!expandStorageForColumn (column)) return;
 	columns[column].storage = value.split ('\t', RKCompatibility::KeepEmptyParts());
 	updateColumn (column);
-	emit model->dataChanged (model->index(0, column), model->index(row_count->intValue() + trailing_rows, column));
+	Q_EMIT model->dataChanged (model->index(0, column), model->index(row_count->intValue() + trailing_rows, column));
 }
 
 void RKMatrixInput::updateColumn (int column) {
@@ -301,7 +301,7 @@ void RKMatrixInput::updateAll () {
 	}
 	if (new_valid != is_valid) {
 		is_valid = new_valid;
-		emit model->headerDataChanged(Qt::Horizontal, 0, column_count->intValue() - 1);
+		Q_EMIT model->headerDataChanged(Qt::Horizontal, 0, column_count->intValue() - 1);
 	}
 	changed ();
 }
@@ -323,9 +323,9 @@ void RKMatrixInput::dimensionPropertyChanged (RKComponentPropertyBase *property)
 		}
 	}
 
-	emit model->layoutAboutToBeChanged();
+	Q_EMIT model->layoutAboutToBeChanged();
 	updateAll();
-	emit model->layoutChanged();
+	Q_EMIT model->layoutChanged();
 }
 
 void RKMatrixInput::tsvPropertyChanged () {
diff --git a/rkward/plugin/rkmatrixinput.h b/rkward/plugin/rkmatrixinput.h
index d3c76f56a..4dc00bf23 100644
--- a/rkward/plugin/rkmatrixinput.h
+++ b/rkward/plugin/rkmatrixinput.h
@@ -29,12 +29,12 @@ public:
 	int type () override { return ComponentMatrixInput; };
 	bool isValid () override { return is_valid; };
 	QVariant value (const QString &modifier=QString ()) override;
-public slots:
+public Q_SLOTS:
 	void cut ();
 	void copy ();
 	void paste ();
 	void clearSelectedCells ();
-private slots:
+private Q_SLOTS:
 	void dimensionPropertyChanged (RKComponentPropertyBase *property);
 	void tsvPropertyChanged ();
 private:
diff --git a/rkward/plugin/rkoptionset.cpp b/rkward/plugin/rkoptionset.cpp
index b7be14f08..13f3b603f 100644
--- a/rkward/plugin/rkoptionset.cpp
+++ b/rkward/plugin/rkoptionset.cpp
@@ -248,7 +248,7 @@ void RKOptionSet::fetchPropertyValuesRecursive (PropertyValueMap *list, bool inc
 void RKOptionSet::serializationPropertyChanged (RKComponentPropertyBase* property) {
 	if (updating) return;
 	updating = true;
-	if (model) emit model->layoutAboutToBeChanged();
+	if (model) Q_EMIT model->layoutAboutToBeChanged();
 
 	RK_TRACE (PLUGIN);
 	RK_ASSERT (property == serialization_of_set);
@@ -325,7 +325,7 @@ void RKOptionSet::serializationPropertyChanged (RKComponentPropertyBase* propert
 	active_row = -1;
 	current_row->setIntValue (qMin (0, row - 1));
 
-	if (model) emit model->layoutChanged();
+	if (model) Q_EMIT model->layoutChanged();
 	changed ();
 }
 
@@ -488,7 +488,7 @@ void RKOptionSet::setRowState (int row, bool finished, bool valid) {
 		valid ? --n_invalid_rows : ++n_invalid_rows;
 		changed = true;
 	}
-	if (changed && model) emit model->dataChanged(model->index(row, 0), model->index(row, model->columnCount() - 1));
+	if (changed && model) Q_EMIT model->dataChanged(model->index(row, 0), model->index(row, model->columnCount() - 1));
 }
 
 void RKOptionSet::changed () {
@@ -504,7 +504,7 @@ void RKOptionSet::changed () {
 	ComponentStatus s = recursiveStatus ();
 	if (s != last_known_status) {
 		last_known_status = s;
-		if (model) emit model->headerDataChanged(Qt::Horizontal, 0, model->columnCount() - 1);
+		if (model) Q_EMIT model->headerDataChanged(Qt::Horizontal, 0, model->columnCount() - 1);
 	}
 
 	RKComponent::changed ();
@@ -527,7 +527,7 @@ void RKOptionSet::governingPropertyChanged (RKComponentPropertyBase *property) {
 		target->setValueAt (row, value);
 
 		if (model && (inf.display_index >= 0)) {
-			emit model->dataChanged(model->index(inf.display_index, row), model->index(inf.display_index, row));
+			Q_EMIT model->dataChanged(model->index(inf.display_index, row), model->index(inf.display_index, row));
 		}
 	}
 
@@ -550,7 +550,7 @@ void RKOptionSet::columnPropertyChanged (RKComponentPropertyBase *property) {
 
 	if (target == keycolumn) handleKeycolumnUpdate ();
 	else {
-		if (model) emit model->dataChanged(model->index(ci.display_index, 0), model->index(ci.display_index, model->rowCount()));
+		if (model) Q_EMIT model->dataChanged(model->index(ci.display_index, 0), model->index(ci.display_index, model->rowCount()));
 		applyContentsFromExternalColumn (target, active_row);
 	}
 }
@@ -817,7 +817,7 @@ QVariant RKOptionSetDisplayModel::data (const QModelIndex& index, int role) cons
 
 void RKOptionSetDisplayModel::doResetNow () {
 	RK_TRACE (PLUGIN);
-	emit layoutChanged();
+	Q_EMIT layoutChanged();
 	set->updateCurrentRowInDisplay ();
 }
 
@@ -846,7 +846,7 @@ QVariant RKOptionSetDisplayModel::headerData (int section, Qt::Orientation orien
 void RKOptionSetDisplayModel::triggerReset() {
 	RK_TRACE (PLUGIN);
 	if (!reset_timer.isActive ()) {
-		emit layoutAboutToBeChanged();
+		Q_EMIT layoutAboutToBeChanged();
 		reset_timer.start ();
 	}
 }
diff --git a/rkward/plugin/rkoptionset.h b/rkward/plugin/rkoptionset.h
index 013ba0d9a..f8f430b1d 100644
--- a/rkward/plugin/rkoptionset.h
+++ b/rkward/plugin/rkoptionset.h
@@ -36,7 +36,7 @@ public:
 	ComponentStatus recursiveStatus () override;
 	/** reimplemented from RKComponent */
 	void changed () override;
-private slots:
+private Q_SLOTS:
 	void governingPropertyChanged (RKComponentPropertyBase *property);
 	void columnPropertyChanged (RKComponentPropertyBase *property);
 	void currentRowPropertyChanged (RKComponentPropertyBase *property);
@@ -142,7 +142,7 @@ friend class RKOptionSet;
 	Qt::ItemFlags flags (const QModelIndex& index) const override;
 	Qt::DropActions supportedDropActions () const override;
 	Qt::DropActions supportedDragActions () const override;
-private slots:
+private Q_SLOTS:
 	void doResetNow ();
 };
 
diff --git a/rkward/plugin/rkpluginbrowser.h b/rkward/plugin/rkpluginbrowser.h
index 3ce14eae5..173994cdb 100644
--- a/rkward/plugin/rkpluginbrowser.h
+++ b/rkward/plugin/rkpluginbrowser.h
@@ -37,7 +37,7 @@ public:
 	QStringList getUiLabelPair () const override;
 	int type () override { return ComponentBrowser; };
 	ComponentStatus recursiveStatus () override;
-public slots:
+public Q_SLOTS:
 	void textChangedFromUi ();
 	void textChanged (RKComponentPropertyBase *);
 	void validateInput ();
diff --git a/rkward/plugin/rkpluginframe.h b/rkward/plugin/rkpluginframe.h
index ea9fd1b09..22d3a9e1c 100644
--- a/rkward/plugin/rkpluginframe.h
+++ b/rkward/plugin/rkpluginframe.h
@@ -32,7 +32,7 @@ public:
 
 /** re-implemented to create "checked" property on demand. */
 	RKComponentBase* lookupComponent (const QString &identifier, QString *remainder) override;
-private slots:
+private Q_SLOTS:
 /** called when checked property changes */
 	void propertyChanged (RKComponentPropertyBase *property);
 	void checkedChanged (bool new_state);
diff --git a/rkward/plugin/rkpluginsaveobject.h b/rkward/plugin/rkpluginsaveobject.h
index cce7371c9..6e4de9768 100644
--- a/rkward/plugin/rkpluginsaveobject.h
+++ b/rkward/plugin/rkpluginsaveobject.h
@@ -31,7 +31,7 @@ public:
 	QStringList getUiLabelPair () const override;
 	int type () override { return ComponentSaveObject; };
 	bool isValid () override;
-public slots:
+public Q_SLOTS:
 	void externalChange ();
 	void internalChange ();
 private:
diff --git a/rkward/plugin/rkpluginspinbox.h b/rkward/plugin/rkpluginspinbox.h
index 623fbc351..3dfd4fb60 100644
--- a/rkward/plugin/rkpluginspinbox.h
+++ b/rkward/plugin/rkpluginspinbox.h
@@ -31,7 +31,7 @@ public:
 
 	RKComponentPropertyInt *intvalue;
 	RKComponentPropertyDouble *realvalue;
-public slots:
+public Q_SLOTS:
 	void valueChangedFromUi ();
 	void valueChanged (RKComponentPropertyBase *property);
 private:
diff --git a/rkward/plugin/rkpreviewbox.h b/rkward/plugin/rkpreviewbox.h
index 0a2003df7..d4c2ca3f5 100644
--- a/rkward/plugin/rkpreviewbox.h
+++ b/rkward/plugin/rkpreviewbox.h
@@ -31,7 +31,7 @@ public:
 	int type () override { return ComponentPreviewBox; };
 	RKComponentPropertyBool *state;
 	QVariant value (const QString &modifier=QString ()) override;
-public slots:
+public Q_SLOTS:
 	void changedStateFromUi ();
 	void changedState (RKComponentPropertyBase *);
 	void changedCode (RKComponentPropertyBase *);
diff --git a/rkward/plugin/rkstandardcomponent.cpp b/rkward/plugin/rkstandardcomponent.cpp
index d958b2180..6c4930528 100644
--- a/rkward/plugin/rkstandardcomponent.cpp
+++ b/rkward/plugin/rkstandardcomponent.cpp
@@ -353,7 +353,7 @@ void RKStandardComponent::buildAndInitialize (const QDomElement &doc_element, co
 		QTimer::singleShot (0, gui, SLOT (show()));
 	}
 	changed ();
-	emit standardInitializationComplete();
+	Q_EMIT standardInitializationComplete();
 }
 
 RKXMLGUIPreviewArea* RKStandardComponent::addDockedPreview (RKComponentPropertyBool* controller, const QString& label, const QString &id) {
diff --git a/rkward/plugin/rkstandardcomponent.h b/rkward/plugin/rkstandardcomponent.h
index 2ebc73586..0eb973ebc 100644
--- a/rkward/plugin/rkstandardcomponent.h
+++ b/rkward/plugin/rkstandardcomponent.h
@@ -75,9 +75,9 @@ public:
 	RKComponentScriptingProxy* scriptingProxy ();
 
 	RKXMLGUIPreviewArea *addDockedPreview (RKComponentPropertyBool *controller, const QString& label, const QString &id = QString ());
-signals:
+Q_SIGNALS:
 	void standardInitializationComplete ();
-public slots:
+public Q_SLOTS:
 /** this gets called by the script-backend, when it's done. Might enable the
 	submit button or destruct the plugin. */
 	void backendIdle ();
diff --git a/rkward/plugin/rkstandardcomponentgui.h b/rkward/plugin/rkstandardcomponentgui.h
index bbcb0699f..8016cb33a 100644
--- a/rkward/plugin/rkstandardcomponentgui.h
+++ b/rkward/plugin/rkstandardcomponentgui.h
@@ -78,7 +78,7 @@ public:
 	RKXMLGUIPreviewArea* addDockedPreview (RKComponentPropertyBool *controller, const QString& label, const QString &id=QString (), bool bottom = false);
 /** Do anything needed after the dialog is created and its contents have been built. Base class adds the preview regions to the splitter */
 	virtual void finalize ();
-public slots:
+public Q_SLOTS:
 	void ok ();
 	void cancel ();
 	void toggleCode ();
@@ -87,7 +87,7 @@ public slots:
 	void updateCodeNow ();
 	void switchInterface () { component->switchInterface (); };
 	void copyCode ();
-private slots:
+private Q_SLOTS:
 	void previewVisibilityChanged (RKComponentPropertyBase*);
 	void previewCloseButtonClicked (RKXMLGUIPreviewArea *area);
 	void doPostShowCleanup ();
@@ -145,7 +145,7 @@ public:
 	void updateState ();
 
 	RKStandardComponentStack *getStack () { return stack; };
-public slots:
+public Q_SLOTS:
 	void next ();
 	void prev ();
 private:
diff --git a/rkward/plugin/rktabpage.h b/rkward/plugin/rktabpage.h
index 5d070889f..df928f331 100644
--- a/rkward/plugin/rktabpage.h
+++ b/rkward/plugin/rktabpage.h
@@ -31,7 +31,7 @@ public:
 
 	int type () override { return ComponentTab; };
 
-public slots:
+public Q_SLOTS:
 /** called when visibile or enabled properties change */
 	void visibleEnabledChanged (RKComponentPropertyBase *property);
 private:
diff --git a/rkward/plugin/rktext.h b/rkward/plugin/rktext.h
index 06fdde830..dd3992524 100644
--- a/rkward/plugin/rktext.h
+++ b/rkward/plugin/rktext.h
@@ -28,7 +28,7 @@ public:
 	RKComponentPropertyBase *text;
 	QVariant value (const QString &modifier=QString ()) override { return (text->value (modifier)); };
 	int type () override { return ComponentText; };
-public slots:
+public Q_SLOTS:
 	void textChanged (RKComponentPropertyBase *);
 private:
 	QLabel *label;
diff --git a/rkward/plugin/rkvalueselector.h b/rkward/plugin/rkvalueselector.h
index 0850a4a58..1fd4451b8 100644
--- a/rkward/plugin/rkvalueselector.h
+++ b/rkward/plugin/rkvalueselector.h
@@ -27,7 +27,7 @@ public:
 	int type () override { return ComponentValueSelector; };
 	QVariant value (const QString &modifier=QString ()) override;
 	QStringList getUiLabelPair () const override;
-private slots:
+private Q_SLOTS:
 	void selectionPropertyChanged ();
 	void listSelectionChanged ();
 	void labelsPropertyChanged ();
diff --git a/rkward/plugin/rkvarselector.h b/rkward/plugin/rkvarselector.h
index cd641cb57..2ceb046e4 100644
--- a/rkward/plugin/rkvarselector.h
+++ b/rkward/plugin/rkvarselector.h
@@ -31,7 +31,7 @@ public:
 	RKVarSelector (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget);
 	~RKVarSelector ();
 	int type () override { return ComponentVarSelector; };
-private slots:
+private Q_SLOTS:
 	void objectSelectionChanged ();
 	void rootChanged ();
 	void showFilterWidget ();
diff --git a/rkward/plugin/rkvarslot.h b/rkward/plugin/rkvarslot.h
index ad4358245..176e5cbfb 100644
--- a/rkward/plugin/rkvarslot.h
+++ b/rkward/plugin/rkvarslot.h
@@ -36,7 +36,7 @@ public:
 /** reimplemented to call updateLook (), in case enabledness changed */
 	void changed () override { updateLook (); RKComponent::changed (); };
 	void updateLook ();
-public slots:
+public Q_SLOTS:
 /** Called when the select-button is pressed */
 	void selectPressed ();
 	void removePressed ();
diff --git a/rkward/rbackend/rcommand.h b/rkward/rbackend/rcommand.h
index 08c5a6534..e7f0ce3c8 100644
--- a/rkward/rbackend/rcommand.h
+++ b/rkward/rbackend/rcommand.h
@@ -62,7 +62,7 @@ typedef QList<ROutput*> ROutputList;
  */
 class RCommandNotifier : public QObject {
 	Q_OBJECT
-signals:
+Q_SIGNALS:
 /** given command has finished (not necessarily successfully) */
 	void commandFinished(RCommand *command);
 /** new output for the given command */
@@ -73,9 +73,9 @@ private:
 friend class RCommand;
 	RCommandNotifier();
 	~RCommandNotifier();
-	void emitFinished(RCommand *command) { emit commandFinished(command); };
-	void emitOutput(RCommand *command, const ROutput* output) { emit commandOutput(command, output); };
-	void emitLineIn(RCommand *command) { emit commandLineIn(command); };
+	void emitFinished(RCommand *command) { Q_EMIT commandFinished(command); };
+	void emitOutput(RCommand *command, const ROutput* output) { Q_EMIT commandOutput(command, output); };
+	void emitLineIn(RCommand *command) { Q_EMIT commandLineIn(command); };
 };
 
 /** For introductory information on using RCommand, see \ref UsingTheInterfaceToR 
@@ -233,11 +233,11 @@ struct GenericRRequestResult {
 	}
 	GenericRRequestResult& addMessages(const GenericRRequestResult &other) {
 		if (!other.error.isEmpty()) {
-			if (!error.isEmpty()) error.append('\n');
+			if (!error.isEmpty()) error.append(QLatin1Char('\n'));
 			error.append(other.error);
 		}
 		if (!other.warning.isEmpty()) {
-			if (!warning.isEmpty()) warning.append('\n');
+			if (!warning.isEmpty()) warning.append(QLatin1Char('\n'));
 			warning.append(other.warning);
 		}
 		return *this;
diff --git a/rkward/rbackend/rcommandstack.cpp b/rkward/rbackend/rcommandstack.cpp
index b5af5b025..44b5c4b9d 100644
--- a/rkward/rbackend/rcommandstack.cpp
+++ b/rkward/rbackend/rcommandstack.cpp
@@ -372,6 +372,6 @@ void RCommandStackModel::itemChange (RCommandChain* item) {
 	RK_TRACE (RBACKEND);
 
 	QModelIndex item_index = indexFor (item);
-	emit dataChanged(item_index, item_index);
+	Q_EMIT dataChanged(item_index, item_index);
 }
 
diff --git a/rkward/rbackend/rkbackendtransmitter.h b/rkward/rbackend/rkbackendtransmitter.h
index 49e52ec70..34c24c73e 100644
--- a/rkward/rbackend/rkbackendtransmitter.h
+++ b/rkward/rbackend/rkbackendtransmitter.h
@@ -25,7 +25,7 @@ public:
 	void writeRequest (RBackendRequest *request) override;
 	void requestReceived (RBackendRequest *request) override;
 	void handleTransmissionError (const QString &message) override;
-public slots:
+public Q_SLOTS:
 	void doExit(); // To be called from main thread via QMetaMethod::invoke
 private:
 	void timerEvent (QTimerEvent *event) override;
diff --git a/rkward/rbackend/rkfrontendtransmitter.h b/rkward/rbackend/rkfrontendtransmitter.h
index 630460e99..ef14c5917 100644
--- a/rkward/rbackend/rkfrontendtransmitter.h
+++ b/rkward/rbackend/rkfrontendtransmitter.h
@@ -32,7 +32,7 @@ public:
 	/** Simple convenience function similar to QIODevice::waitForReadyRead(), but waiting for a full line to be available.
 	    In particular on Windows, we often receive _less_ than a full line per chunk. */
 	static QString waitReadLine (QIODevice *con, int msecs);
-private slots:
+private Q_SLOTS:
 	void connectAndEnterLoop ();
 	void backendExit (int exitcode);
 private:
diff --git a/rkward/rbackend/rkrinterface.cpp b/rkward/rbackend/rkrinterface.cpp
index 325ab23d2..f05d404ec 100644
--- a/rkward/rbackend/rkrinterface.cpp
+++ b/rkward/rbackend/rkrinterface.cpp
@@ -208,7 +208,7 @@ void RInterface::tryNextCommand () {
 				return;
 			}
 
-			if (previously_idle) emit backendStatusChanged(Busy);
+			if (previously_idle) Q_EMIT backendStatusChanged(Busy);
 			previously_idle = false;
 
 			doNextCommand (command);
@@ -217,7 +217,7 @@ void RInterface::tryNextCommand () {
 	}
 
 	if (on_top_level) {
-		if (!previously_idle) emit backendStatusChanged(Idle);
+		if (!previously_idle) Q_EMIT backendStatusChanged(Idle);
 		previously_idle = true;
 	}
 }
@@ -585,7 +585,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();
+		Q_EMIT backendWorkdirChanged();
 	} else if (call == "highlightRCode") {
 		return GenericRRequestResult(RKCommandHighlighter::commandToHTML(calllist.mid(1).join('\n')));
 	} else if (call == "quit") {
@@ -910,7 +910,7 @@ void RInterface::processRBackendRequest (RBackendRequest *request) {
 			QString message = request->params["message"].toString ();
 			message += i18n ("\nThe R backend will be shut down immediately. This means, you can not use any more functions that rely on it. I.e. you can do hardly anything at all, not even save the workspace (but if you're lucky, R already did that). What you can do, however, is save any open command-files, the output, or copy data out of open data editors. Quit RKWard after that. Sorry!");
 			RKErrorDialog::reportableErrorMessage (0, message, QString (), i18n ("R engine has died"), "r_engine_has_died");
-			emit backendStatusChanged(Dead);
+			Q_EMIT backendStatusChanged(Dead);
 			while (!all_current_commands.isEmpty()) {
 				auto c = all_current_commands.takeLast();
 				c->status |= RCommand::Failed;
diff --git a/rkward/rbackend/rkrinterface.h b/rkward/rbackend/rkrinterface.h
index 1a47aad61..1e5e777d8 100644
--- a/rkward/rbackend/rkrinterface.h
+++ b/rkward/rbackend/rkrinterface.h
@@ -144,7 +144,7 @@ protected:
 	void _issueCommand(RCommand *command, RCommandChain *chain=0);
 /** constructor */
 	RInterface();
-signals:
+Q_SIGNALS:
 	void backendWorkdirChanged();
 /** Note: status is actually RInterface::RStatus */
 	void backendStatusChanged(int new_status);
diff --git a/rkward/rbackend/rksessionvars.cpp b/rkward/rbackend/rksessionvars.cpp
index 60b846dc2..ba536325d 100644
--- a/rkward/rbackend/rksessionvars.cpp
+++ b/rkward/rbackend/rksessionvars.cpp
@@ -46,7 +46,7 @@ void RKSessionVars::setInstalledPackages (const QStringList &new_list) {
 	RK_TRACE (RBACKEND);
 
 	installed_packages = new_list;
-	emit installedPackagesChanged();
+	Q_EMIT installedPackagesChanged();
 }
 
 void RKSessionVars::setRVersion (const QString& version_string) {
diff --git a/rkward/rbackend/rksessionvars.h b/rkward/rbackend/rksessionvars.h
index ef5a06026..e672d63d6 100644
--- a/rkward/rbackend/rksessionvars.h
+++ b/rkward/rbackend/rksessionvars.h
@@ -35,7 +35,7 @@ Anything else (everything after the fourth dot, or after the first character tha
 is returned as suffix (via the suffix pointer; if that is 0, an error is reported, instead). */
 	static QStringList frontendSessionInfo ();
 	static QString RBinary() { return r_binary; }
-signals:
+Q_SIGNALS:
 	void installedPackagesChanged ();
 protected:
 friend class RInterface;
diff --git a/rkward/rbackend/rktransmitter.h b/rkward/rbackend/rktransmitter.h
index 8729bc7c7..16c176871 100644
--- a/rkward/rbackend/rktransmitter.h
+++ b/rkward/rbackend/rktransmitter.h
@@ -52,7 +52,7 @@ protected:
 	void setConnection (QLocalSocket *connection);
 	QLocalSocket *connection;
 	QString token;
-private slots:
+private Q_SLOTS:
 	/** Note: this blocks until a complete request has been received. Connected to the "readyRead"-signal of the connection. Calls requestReceived() once the request has been read. */
 	void fetchTransmission ();
 	void disconnected ();
diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp b/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
index a569b2801..c1b64526d 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
@@ -591,8 +591,8 @@ void RKGraphicsDevice::setActive (bool active) {
 	} else {
 		view->setWindowTitle(i18nc("Window title", "%1 (Inactive)", base_title));
 	}
-	emit activeChanged(active);
-	emit captionChanged(view->windowTitle());
+	Q_EMIT activeChanged(active);
+	Q_EMIT captionChanged(view->windowTitle());
 }
 
 void RKGraphicsDevice::goInteractive (const QString& prompt) {
@@ -607,7 +607,7 @@ void RKGraphicsDevice::goInteractive (const QString& prompt) {
 	view->setToolTip (prompt);
 	view->show ();
 	view->raise ();
-	emit goingInteractive(true, prompt);
+	Q_EMIT goingInteractive(true, prompt);
 }
 
 void RKGraphicsDevice::locator () {
@@ -646,7 +646,7 @@ void RKGraphicsDevice::newPageDialogDone (int result) {
 	RK_TRACE (GRAPHICS_DEVICE);
 
 	RK_ASSERT (dialog);
-	emit newPageConfirmDone(result == QDialog::Accepted);
+	Q_EMIT newPageConfirmDone(result == QDialog::Accepted);
 	interaction_opcode = -1;
 	stopInteraction ();
 }
@@ -687,7 +687,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());
+				Q_EMIT locatorDone(true, me->x(), me->y());
 				interaction_opcode = -1;
 			}
 			stopInteraction ();
@@ -754,10 +754,10 @@ void RKGraphicsDevice::stopInteraction () {
 	RK_TRACE (GRAPHICS_DEVICE);
 
 	if (interaction_opcode == RKDLocator) {
-		emit locatorDone(false, 0.0, 0.0);
+		Q_EMIT locatorDone(false, 0.0, 0.0);
 	} else if (interaction_opcode == RKDNewPageConfirm) {
 		RK_ASSERT (dialog);
-		emit newPageConfirmDone(true);
+		Q_EMIT newPageConfirmDone(true);
 	} else if (interaction_opcode == RKDStartGettingEvents) {
 		// not much to do, fortunately, as getting graphics events is non-blocking
 		stored_events.clear ();
@@ -776,7 +776,7 @@ void RKGraphicsDevice::stopInteraction () {
 		checkSize ();
 		view->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred);
 	}
-	emit goingInteractive(false, QString());
+	Q_EMIT goingInteractive(false, QString());
 	interaction_opcode = -1;
 }
 
diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice.h b/rkward/rbackend/rkwarddevice/rkgraphicsdevice.h
index 4ff45bc30..8900982b2 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice.h
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice.h
@@ -105,15 +105,15 @@ public:
 	int endRecordGroup();
 	void useGroup(int index, const QTransform &matrix);
 	void destroyGroup(int index);
-public slots:
+public Q_SLOTS:
 	void stopInteraction ();
-signals:
+Q_SIGNALS:
 	void goingInteractive (bool interactive, const QString &prompt);
 	void activeChanged (bool);
 	void locatorDone (bool ok, double x, double y);
 	void newPageConfirmDone (bool accepted);
 	void captionChanged (const QString &caption);
-private slots:
+private Q_SLOTS:
 	void updateNow ();
 	void newPageDialogDone (int result);
 	void viewKilled ();
diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp
index 5e6549cfd..7181a88f9 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.cpp
@@ -248,7 +248,7 @@ void RKGraphicsDeviceFrontendTransmitter::newData () {
 			if (!device) {
 				if (opcode == RKDCancel) {
 					RK_DEBUG (GRAPHICS_DEVICE, DL_WARNING, "Graphics operation canceled");
-					emit stopInteraction();
+					Q_EMIT stopInteraction();
 				} else if (opcode == RKDQueryResolution) {
 					auto screen = QGuiApplication::primaryScreen();
 					streamer.outstream << (qint32) screen->logicalDotsPerInchX() << (qint32) screen->logicalDotsPerInchY();
diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.h b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.h
index f509af31a..0e062bcfe 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.h
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_frontendtransmitter.h
@@ -25,12 +25,12 @@ public:
 	~RKGraphicsDeviceFrontendTransmitter ();
 	QString serverName () const { return server_name; };
 	static double lwdscale;
-public slots:
+public Q_SLOTS:
 	void newData ();
 	void newConnection ();
 	void locatorDone (bool ok, double x, double y);
 	void newPageConfirmDone (bool accepted);
-signals:
+Q_SIGNALS:
 	void stopInteraction ();
 private:
 	void setupServer ();
diff --git a/rkward/rkconsole.h b/rkward/rkconsole.h
index a3f11e492..a3bc03aa2 100644
--- a/rkward/rkconsole.h
+++ b/rkward/rkconsole.h
@@ -136,7 +136,7 @@ friend class RKConsolePart;
 	void pipeCommandThroughConsoleLocal (const QString &command);
 
 	RKConsolePart *console_part;
-public slots:
+public Q_SLOTS:
 /** We intercept paste commands and get them executed through submitBatch.
 @sa submitBatch */
 	void paste ();
diff --git a/rkward/rkward.cpp b/rkward/rkward.cpp
index db59c030e..758892b4e 100644
--- a/rkward/rkward.cpp
+++ b/rkward/rkward.cpp
@@ -213,7 +213,7 @@ void RKWardMainWindow::closeEvent (QCloseEvent *e) {
 
 	e->ignore();
 	if (doQueryQuit()) {
-		emit aboutToQuitRKWard();
+		Q_EMIT aboutToQuitRKWard();
 		new RKQuitAgent(this);
 	}
 }
diff --git a/rkward/rkward.h b/rkward/rkward.h
index 287be09c8..2d5136fdb 100644
--- a/rkward/rkward.h
+++ b/rkward/rkward.h
@@ -65,9 +65,9 @@ protected:
 	void initToolViewsAndR ();
 	/** reimplemented from KMainWindow to call our doQueryClose (), and then (if quitting was not cancelled), invoke an RKQuitAgent to wait for the R-backend to finish up before actually quitting. */
 	virtual void closeEvent (QCloseEvent *e) override;
-signals:
+Q_SIGNALS:
 	void aboutToQuitRKWard ();
-public slots:
+public Q_SLOTS:
 	void setWorkspaceUnmodified () { setWorkspaceMightBeModified (false); };
 	/** open a workspace. If the current workspace is not empty, ask whether to save first.
     @see setNoAskSave ()
@@ -122,7 +122,7 @@ public slots:
 /** HACK this is only to make the compiler happy with -Woverloaded-virtual */
 	void setCaption (const QString &dummy, bool) override { setCaption (dummy); };
 	void openUrlsFromCommandLineOrDBus (bool warn_external, QStringList urls);
-private slots:
+private Q_SLOTS:
 	void partChanged (KParts::Part *new_part);
 private:
 /** Prompt for a local file to open, providing a choice of how to open the file (as R script, text, workspace, auto) */
diff --git a/rkward/robjectviewer.h b/rkward/robjectviewer.h
index 020abc05c..7f4061175 100644
--- a/rkward/robjectviewer.h
+++ b/rkward/robjectviewer.h
@@ -38,7 +38,7 @@ public:
 		PrintPage = 1,
 		StructurePage = 2
 	};
-public slots:
+public Q_SLOTS:
 	void currentTabChanged (int new_current);
 protected:
 	friend class RKWorkplace;
@@ -74,7 +74,7 @@ public:
 	void invalidate (const QString& reason);
 	void initialize ();
 	void setText (const QString& text);
-public slots:
+public Q_SLOTS:
 	virtual void update ();
 protected:
 	virtual RCommand* makeCommand() = 0;
diff --git a/rkward/scriptbackends/qtscriptbackend.cpp b/rkward/scriptbackends/qtscriptbackend.cpp
index c688a2b4f..3e77f4591 100644
--- a/rkward/scriptbackends/qtscriptbackend.cpp
+++ b/rkward/scriptbackends/qtscriptbackend.cpp
@@ -138,7 +138,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();
+	Q_EMIT haveError();
 	destroy ();
 }
 
@@ -151,7 +151,7 @@ void QtScriptBackend::commandDone (const QString &result) {
 void QtScriptBackend::needData (const QString &identifier, const int hint) {
 	RK_TRACE (PHP);
 
-	emit requestValue(identifier, hint);
+	Q_EMIT requestValue(identifier, hint);
 }
 
 
@@ -211,7 +211,7 @@ void QtScriptBackendThread::setData (const QVariant &data) {
 QVariant QtScriptBackendThread::getValue (const QString &identifier, const int hint) {
 	RK_TRACE (PHP);
 
-	emit needData(identifier, hint);
+	Q_EMIT needData(identifier, hint);
 	QVariant ret;
 	while (true) {
 		if (killed) return QVariant ();
@@ -256,7 +256,7 @@ bool QtScriptBackendThread::scriptError(const QJSValue &val) {
 	if (!val.isError()) return false;
 
 	QString message = i18n("Script Error in %1, line %2: %3\nBacktrace:\n%4", val.property("fileName").toString(), val.property("lineNumber").toInt(), val.toString(), val.property("stack").toString());  // TODO: correct?
-	emit error(message);
+	Q_EMIT error(message);
 
 	return true;
 }
@@ -272,7 +272,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));
+		Q_EMIT error(i18n("The file \"%1\" (needed by \"%2\") could not be found. Please check your installation.", _filename, _scriptfile));
 		return false;
 	}
 
@@ -292,7 +292,7 @@ void QtScriptBackendThread::run () {
 	if (!includeFile (_commonfile)) return;  // TODO: import this as a module and re-use the engine in the next thread?
 	if (!includeFile (_scriptfile)) return;
 
-	emit commandDone("startup complete");
+	Q_EMIT commandDone("startup complete");
 
 	QString command;
 	while (true) {
@@ -317,7 +317,7 @@ void QtScriptBackendThread::run () {
 		// do it!
 		QJSValue result = engine.evaluate (command);
 		if (scriptError(result)) return;
-		emit commandDone(result.toString());
+		Q_EMIT commandDone(result.toString());
 
 		command.clear ();
 	}
diff --git a/rkward/scriptbackends/qtscriptbackend.h b/rkward/scriptbackends/qtscriptbackend.h
index 880f42b45..17a683dfc 100644
--- a/rkward/scriptbackends/qtscriptbackend.h
+++ b/rkward/scriptbackends/qtscriptbackend.h
@@ -38,7 +38,7 @@ public:
 #ifdef JSBACKEND_PERFORMANCE_TEST
 	static void _performanceTest();
 #endif
-public slots:
+public Q_SLOTS:
 	void threadError (const QString &message);
 	void commandDone (const QString &result);
 	void needData (const QString &identifier, const int hint);
@@ -77,11 +77,11 @@ public:
 	void setData (const QVariant &data);
 	void kill () { killed = true; };
 	void goToSleep (bool sleep);
-signals:
+Q_SIGNALS:
 	void commandDone (const QString &result);
 	void needData (const QString &identifier, const int hint);
 	void error (const QString &error);
-protected slots:
+protected Q_SLOTS:
 	QVariant getValue (const QString &identifier);
 	QVariant getList (const QString &identifier);
 	QVariant getString (const QString &identifier);
diff --git a/rkward/scriptbackends/rkcomponentscripting.cpp b/rkward/scriptbackends/rkcomponentscripting.cpp
index 25a7537ab..6956cfa22 100644
--- a/rkward/scriptbackends/rkcomponentscripting.cpp
+++ b/rkward/scriptbackends/rkcomponentscripting.cpp
@@ -70,7 +70,7 @@ void RKComponentScriptingProxy::handleScriptError(const QJSValue &val, const QSt
 	if (val.isError()) {
 		QString message = i18n("Script Error at '%1' line %2: %3\n", file.isEmpty() ? i18n("inlined code") : file, val.property("lineNumber").toInt(), val.toString());
 		KMessageBox::detailedError (0, message, val.property("stack").toString());
-		emit haveError();
+		Q_EMIT haveError();
 	}
 }
 
diff --git a/rkward/scriptbackends/rkcomponentscripting.h b/rkward/scriptbackends/rkcomponentscripting.h
index ad7dd3f4a..157407e38 100644
--- a/rkward/scriptbackends/rkcomponentscripting.h
+++ b/rkward/scriptbackends/rkcomponentscripting.h
@@ -32,7 +32,7 @@ public:
 	~RKComponentScriptingProxy ();
 
 	void initialize (const QString& file, const QString& command);
-public slots:
+public Q_SLOTS:
 	void componentChanged (RKComponent* changed);
 	void propertyChanged (RKComponentPropertyBase* changed);
 
@@ -53,9 +53,9 @@ public:
 	Q_INVOKABLE QVariantList getObjectInfo (const QString &name);
 	Q_INVOKABLE QString getObjectParent (const QString &name);
 	Q_INVOKABLE QString getObjectChild (const QString &name);
-signals:
+Q_SIGNALS:
 	void haveError ();
-private slots:
+private Q_SLOTS:
 	void scriptRCommandFinished (RCommand* command);
 private:
 	RKComponent* component;
diff --git a/rkward/scriptbackends/scriptbackend.cpp b/rkward/scriptbackends/scriptbackend.cpp
index 23fde6a34..a5ef09766 100644
--- a/rkward/scriptbackends/scriptbackend.cpp
+++ b/rkward/scriptbackends/scriptbackend.cpp
@@ -92,16 +92,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);
+				Q_EMIT commandDone(current_flags);
 			}
 		} else {
-			emit commandDone(current_flags);
+			Q_EMIT commandDone(current_flags);
 		}
 	}
 	busy = false;
 	tryNextFunction ();
 	if (!busy) {
-		emit idle();
+		Q_EMIT idle();
 	}
 }
 
diff --git a/rkward/scriptbackends/scriptbackend.h b/rkward/scriptbackends/scriptbackend.h
index 2be2e5c3e..b63caa765 100644
--- a/rkward/scriptbackends/scriptbackend.h
+++ b/rkward/scriptbackends/scriptbackend.h
@@ -52,7 +52,7 @@ public:
 	virtual bool isBusy () { return busy; };
 	
 	virtual void writeData (const QVariant &data) = 0;
-signals:
+Q_SIGNALS:
 	void commandDone (int);
 	void idle ();
 	void requestValue (const QString &, const int);
diff --git a/rkward/scriptbackends/simplebackend.cpp b/rkward/scriptbackends/simplebackend.cpp
index 7e6e78050..6902e2f97 100644
--- a/rkward/scriptbackends/simplebackend.cpp
+++ b/rkward/scriptbackends/simplebackend.cpp
@@ -110,7 +110,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);
+		Q_EMIT requestValue(token, RKStandardComponent::StringValue);
 		return;
 	}
 
diff --git a/rkward/settings/rkrecenturls.cpp b/rkward/settings/rkrecenturls.cpp
index c9d59cdaa..b282e0f8a 100644
--- a/rkward/settings/rkrecenturls.cpp
+++ b/rkward/settings/rkrecenturls.cpp
@@ -78,7 +78,7 @@ void RKRecentUrls::notifyChangeProxy() {
 }
 
 void RKRecentUrls::notifyChange() {
-	emit recentUrlsChanged();
+	Q_EMIT recentUrlsChanged();
 }
 
 RKRecentUrls::RKRecentUrls(QObject* parent) : QObject(parent) {
diff --git a/rkward/settings/rkrecenturls.h b/rkward/settings/rkrecenturls.h
index e997d397b..7fdade413 100644
--- a/rkward/settings/rkrecenturls.h
+++ b/rkward/settings/rkrecenturls.h
@@ -31,7 +31,7 @@ public:
 	static QString workspaceId();
 	static QString outputId();
 	static RKRecentUrls* notifier();
-signals:
+Q_SIGNALS:
 	void recentUrlsChanged();
 private:
 	RKRecentUrls(QObject* parent);
diff --git a/rkward/settings/rksettings.cpp b/rkward/settings/rksettings.cpp
index 398214bee..2eb938fa0 100644
--- a/rkward/settings/rksettings.cpp
+++ b/rkward/settings/rksettings.cpp
@@ -283,6 +283,6 @@ RKSettingsTracker::~RKSettingsTracker () {
 
 void RKSettingsTracker::signalSettingsChange (RKSettings::SettingsPage page) {
 	RK_TRACE (SETTINGS);
-	emit settingsChanged(page);
+	Q_EMIT settingsChanged(page);
 }
 
diff --git a/rkward/settings/rksettings.h b/rkward/settings/rksettings.h
index 176df6a12..56bf8cfa8 100644
--- a/rkward/settings/rksettings.h
+++ b/rkward/settings/rksettings.h
@@ -55,14 +55,14 @@ public:
 	void enableApply ();
 	
 	static RKSettingsTracker* tracker () { return settings_tracker; };
-public slots:
+public Q_SLOTS:
 	void pageChange (KPageWidgetItem *current, KPageWidgetItem *before);
 protected:
 	RKSettings (QWidget *parent = 0);
 	~RKSettings ();
 
 	void done (int result) override;
-private slots:
+private Q_SLOTS:
 	void applyAll ();
 	void helpClicked ();
 private:
@@ -81,7 +81,7 @@ friend class RKWardMainWindow;
 	void registerPageModule(SettingsPage super, int child);
 };
 
-/** This class represents a very simple QObject. It's only purpose is to emit signals when certain settings have changed. Classes that need to
+/** This class represents a very simple QObject. It's only purpose is to Q_EMIT signals when certain settings have changed. Classes that need to
 update themselves on certain changed settings should connect to those signals. */
 class RKSettingsTracker : public QObject {
 	Q_OBJECT
@@ -90,7 +90,7 @@ public:
 	~RKSettingsTracker ();
 
 	void signalSettingsChange (RKSettings::SettingsPage page);
-signals:
+Q_SIGNALS:
 	void settingsChanged (RKSettings::SettingsPage);
 };
 
diff --git a/rkward/settings/rksettingsmodule.cpp b/rkward/settings/rksettingsmodule.cpp
index afd9d4f29..b33854878 100644
--- a/rkward/settings/rksettingsmodule.cpp
+++ b/rkward/settings/rksettingsmodule.cpp
@@ -35,7 +35,7 @@ RKSettingsModuleWidget::RKSettingsModuleWidget(QWidget *parent, RKSettingsModule
 
 void RKSettingsModuleWidget::change() {
 	changed = true;
-	emit settingsChanged();
+	Q_EMIT settingsChanged();
 }
 
 
diff --git a/rkward/settings/rksettingsmodule.h b/rkward/settings/rksettingsmodule.h
index 51deff670..afa485d10 100644
--- a/rkward/settings/rksettingsmodule.h
+++ b/rkward/settings/rksettingsmodule.h
@@ -134,14 +134,14 @@ public:
 /** Mark this module as "changed" (propagates to parent module) */
 	void change ();
 	bool hasChanges () { return changed; };
-signals:
+Q_SIGNALS:
 	void settingsChanged();
 	void apply();
 protected:
 	bool changed;
 /** temporary indirection until applyChanges() has been obsolete, everywhere */
 	void doApply() {
-		emit apply();
+		Q_EMIT apply();
 		applyChanges();
 		changed = false;
 	}
diff --git a/rkward/settings/rksettingsmoduledebug.h b/rkward/settings/rksettingsmoduledebug.h
index 997d4363d..0c02fc88e 100644
--- a/rkward/settings/rksettingsmoduledebug.h
+++ b/rkward/settings/rksettingsmoduledebug.h
@@ -32,7 +32,7 @@ public:
 	QString caption() const override;
 
 	// static members are declared in debug.h and defined in main.cpp
-public slots:
+public Q_SLOTS:
 	void settingChanged (int);
 private:
 	RKSpinBox* command_timeout_box;
diff --git a/rkward/settings/rksettingsmodulegraphics.h b/rkward/settings/rksettingsmodulegraphics.h
index 923d93962..992f796d7 100644
--- a/rkward/settings/rksettingsmodulegraphics.h
+++ b/rkward/settings/rksettingsmodulegraphics.h
@@ -55,7 +55,7 @@ public:
 	};
 	
 	static bool plotHistoryEnabled () { return graphics_hist_enable; };
-public slots:
+public Q_SLOTS:
 	void boxChanged ();
 private:
 	void updateControls ();
diff --git a/rkward/settings/rksettingsmoduleobjectbrowser.h b/rkward/settings/rksettingsmoduleobjectbrowser.h
index 285c5b629..5ab45d739 100644
--- a/rkward/settings/rksettingsmoduleobjectbrowser.h
+++ b/rkward/settings/rksettingsmoduleobjectbrowser.h
@@ -44,7 +44,7 @@ public:
 	static bool isPackageBlacklisted (const QString &package_name);
 
 	QUrl helpURL () override { return QUrl ("rkward://page/rkward_workspace_browser#settings"); };
-public slots:
+public Q_SLOTS:
 /** called when a checkbox has been changed. Signals change to RKSettings dialog to enable apply button */
 	void boxChanged (int);
 	void listChanged ();
diff --git a/rkward/settings/rksettingsmoduleoutput.h b/rkward/settings/rksettingsmoduleoutput.h
index 6ed5ccf29..48425ba3b 100644
--- a/rkward/settings/rksettingsmoduleoutput.h
+++ b/rkward/settings/rksettingsmoduleoutput.h
@@ -33,7 +33,7 @@ public:
 
 	static bool shouldCarbonCopyCommand (const RCommand *command);
 	static bool includeOutputInCarbonCopy () { return (cc_globally_enabled && cc_command_output); };
-public slots:
+public Q_SLOTS:
 	void applyChanges() override;
 private:
 	// There can be multiple instances of this widget, which need to be kept in sync.
@@ -77,7 +77,7 @@ public:
 	static bool autoShow () { return auto_show; };
 	static bool autoRaise () { return auto_raise; };
 	static bool sharedDefaultOutput() { return shared_default_output; };
-public slots:
+public Q_SLOTS:
 	void boxChanged ();
 private:
 	QComboBox *graphics_type_box;
diff --git a/rkward/settings/rksettingsmoduleplugins.cpp b/rkward/settings/rksettingsmoduleplugins.cpp
index c4b95e155..8f87d0766 100644
--- a/rkward/settings/rksettingsmoduleplugins.cpp
+++ b/rkward/settings/rksettingsmoduleplugins.cpp
@@ -538,7 +538,7 @@ bool RKSettingsModulePluginsModel::setData (const QModelIndex& index, const QVar
 			if (!plugin_maps.all_maps.contains(id)) return false;
 			auto &handle = plugin_maps.all_maps[id];
 			handle.active = value.toBool ();
-			emit dataChanged(index, index);
+			Q_EMIT dataChanged(index, index);
 			return true;
 		}
 	}
diff --git a/rkward/settings/rksettingsmoduleplugins.h b/rkward/settings/rksettingsmoduleplugins.h
index acc06ae89..e0658f8b2 100644
--- a/rkward/settings/rksettingsmoduleplugins.h
+++ b/rkward/settings/rksettingsmoduleplugins.h
@@ -106,7 +106,7 @@ friend class RKSettingsModulePluginsModel;
 	/** Registers the plugin maps that are shipped with RKWard.
 	 * @param force_add All default maps are also activated, even if they were already known, and disabled by the user. */
 	static void registerDefaultPluginMaps (AddMode add_mode);
-public slots:
+public Q_SLOTS:
 	void settingChanged ();
 	void configurePluginmaps ();
 private:
@@ -138,7 +138,7 @@ public:
 /** (re-)initialize the model */
 	void init (const RKSettingsModulePlugins::RKPluginMapList &known_plugin_maps);
 	RKSettingsModulePlugins::RKPluginMapList pluginMaps () { return plugin_maps; };
-public slots:
+public Q_SLOTS:
 	void swapRows (int rowa, int rowb);
 	void insertNewStrings (int above_row);
 private:
diff --git a/rkward/settings/rksettingsmoduler.h b/rkward/settings/rksettingsmoduler.h
index 3f5ea7f5d..737f8f6ba 100644
--- a/rkward/settings/rksettingsmoduler.h
+++ b/rkward/settings/rksettingsmoduler.h
@@ -44,9 +44,9 @@ public:
 	static QString helpBaseUrl () { return help_base_url; };
 
 	static int getDefaultWidth () { return options_width; };
-public slots:
+public Q_SLOTS:
 	void settingChanged ();
-private slots:
+private Q_SLOTS:
 	void addPaths (QStringList *string_list);
 private:
 	QLineEdit *outdec_input;
@@ -110,7 +110,7 @@ public:
 
 	QString caption() const override;
 	QIcon icon() const override;
-public slots:
+public Q_SLOTS:
 	void settingChanged ();
 	void addLibLoc (QStringList *string_list);
 	void addRepository (QStringList *string_list);
diff --git a/rkward/settings/rksettingsmodulewatch.h b/rkward/settings/rksettingsmodulewatch.h
index 48f376434..6b68235c8 100644
--- a/rkward/settings/rksettingsmodulewatch.h
+++ b/rkward/settings/rksettingsmodulewatch.h
@@ -42,7 +42,7 @@ public:
 
 	QString caption() const override;
 	QIcon icon() const override;
-public slots:
+public Q_SLOTS:
 	void changedSetting (int);
 private:
 	enum FilterType { ShowInput=1, ShowOutput=2, ShowError=4, RaiseWindow=8 };
diff --git a/rkward/windows/detachedwindowcontainer.h b/rkward/windows/detachedwindowcontainer.h
index 3a1376fc9..06df717a5 100644
--- a/rkward/windows/detachedwindowcontainer.h
+++ b/rkward/windows/detachedwindowcontainer.h
@@ -27,7 +27,7 @@ public:
 	explicit DetachedWindowContainer (RKMDIWindow *widget_to_capture, bool copy_geometry);
 /** destructor. Usually you don't call this explicitly, but rather delete/close the child view. The DetachedWindowContainer will then self destruct via viewDestroyed () */
 	~DetachedWindowContainer ();
-public slots:
+public Q_SLOTS:
 /** self-destruct, when child view is destroyed */
 	void viewDestroyed (QObject *view);
 /** re-attach to the main window */
diff --git a/rkward/windows/katepluginintegration.cpp b/rkward/windows/katepluginintegration.cpp
index 6d6ceee5e..bfdd458ae 100644
--- a/rkward/windows/katepluginintegration.cpp
+++ b/rkward/windows/katepluginintegration.cpp
@@ -116,10 +116,10 @@ QObject* KatePluginIntegrationApp::loadPlugin (const QString& identifier) {
 #endif
 		if (plugin) {
 			known_plugins[identifier].plugin = plugin;
-			emit KTextEditor::Editor::instance()->application()->pluginCreated(identifier, plugin);
+			Q_EMIT KTextEditor::Editor::instance()->application()->pluginCreated(identifier, plugin);
 			QObject* created = mainWindow()->createPluginView(plugin);
 			if (created) {
-				emit mainWindow()->main->pluginViewCreated(identifier, created);
+				Q_EMIT mainWindow()->main->pluginViewCreated(identifier, created);
 				KTextEditor::SessionConfigInterface *interface = qobject_cast<KTextEditor::SessionConfigInterface *>(created);
 				if (interface) {
 					// NOTE: Some plugins (noteably the Search in files plugin) will misbehave, unless readSessionConfig has been called!
@@ -185,10 +185,10 @@ void KatePluginIntegrationApp::unloadPlugin(const QString &identifier) {
 			KConfigGroup group = KSharedConfig::openConfig()->group(QStringLiteral("KatePlugin:%1:").arg(identifier));
 			interface->writeSessionConfig(group);
 		}
-		emit mainWindow()->main->pluginViewDeleted(identifier, view);
+		Q_EMIT mainWindow()->main->pluginViewDeleted(identifier, view);
 		delete view;
 	}
-	emit app->pluginDeleted(identifier, info.plugin);
+	Q_EMIT app->pluginDeleted(identifier, info.plugin);
 	delete info.plugin;
 	info.plugin = 0;
 }
@@ -358,12 +358,12 @@ public:
 
 	void showEvent(QShowEvent *e) override {
 		RKMDIWindow::showEvent(e);
-		emit toolVisibleChanged(true);
+		Q_EMIT toolVisibleChanged(true);
 	}
 
 	void hideEvent(QHideEvent *e) override {
 		RKMDIWindow::hideEvent(e);
-		emit toolVisibleChanged(false);
+		Q_EMIT toolVisibleChanged(false);
 	}
 
 /** This is a bit lame, but the plugin does not add itself to the parent widget's layout by itself. So we need this override
@@ -378,7 +378,7 @@ public:
 		}
 		RKMDIWindow::childEvent(ev);
 	}
-signals:
+Q_SIGNALS:
 	void toolVisibleChanged(bool);
 };
 
@@ -474,7 +474,7 @@ void KatePluginIntegrationWindow::activeWindowChanged(RKMDIWindow* window) {
 	RK_TRACE (APP);
 
 	if (window->isType(RKMDIWindow::CommandEditorWindow)) {
-		emit main->viewChanged(static_cast<RKCommandEditorWindow *>(window)->getView());
+		Q_EMIT main->viewChanged(static_cast<RKCommandEditorWindow *>(window)->getView());
 	}
 }
 
diff --git a/rkward/windows/katepluginintegration.h b/rkward/windows/katepluginintegration.h
index cd14e3682..f4ff21f57 100644
--- a/rkward/windows/katepluginintegration.h
+++ b/rkward/windows/katepluginintegration.h
@@ -34,7 +34,7 @@ public:
 	void loadPlugins(const QStringList &plugins);
 	KatePluginIntegrationWindow *mainWindow() const { return window; };
 	int knownPluginCount() const { return known_plugins.size(); };
-private slots:
+private Q_SLOTS:
 friend class KatePluginIntegrationWindow;
 	void saveConfigAndUnload();
 	// These are the implementations of the KTextEditor::Application interface.
@@ -72,7 +72,7 @@ public:
 	KTextEditor::MainWindow *mainWindow() const { return main; };
 	KXMLGUIClient* persistentGuiClient() { return this; }
 	KXMLGUIClient* dynamicGuiClient() const { return dynamic_actions_client; }
-private slots:
+private Q_SLOTS:
 	// These are the implementations of the KTextEditor::MainWindow interface.
 	// NOTE that they are not technically overrides, but get invoked via QMetaObject::invokeMethod()
 	QWidget *createToolView(KTextEditor::Plugin *plugin, const QString &identifier, KTextEditor::MainWindow::ToolViewPosition pos, const QIcon &icon, const QString &text);
@@ -117,7 +117,7 @@ friend class KatePluginIntegrationApp;
 
 	KatePluginIntegrationApp *app;
 	KXMLGUIClient *dynamic_actions_client;
-private slots:
+private Q_SLOTS:
 	void catchXMLGUIClientsHack(KXMLGUIClient* client);
 	void activeWindowChanged(RKMDIWindow *window);
 private:
diff --git a/rkward/windows/rcontrolwindow.h b/rkward/windows/rcontrolwindow.h
index 6ef0db0c1..c50faab25 100644
--- a/rkward/windows/rcontrolwindow.h
+++ b/rkward/windows/rcontrolwindow.h
@@ -41,7 +41,7 @@ public:
 	void hideEvent (QHideEvent *e) override;
 /** Static reference to the control window */
 	static RControlWindow* getControl () { return control_window; };
-public slots:
+public Q_SLOTS:
 /** cancel button was clicked. Cancel selected commands (unless they are RCommand::Sync). */
 	void cancelButtonClicked ();
 /** pause button was clicked. Pause/Resume processing of the stack */
diff --git a/rkward/windows/rkcallstackviewer.h b/rkward/windows/rkcallstackviewer.h
index 9c8e5703b..43b539d41 100644
--- a/rkward/windows/rkcallstackviewer.h
+++ b/rkward/windows/rkcallstackviewer.h
@@ -25,7 +25,7 @@ public:
 /** reimplemented to create the real widget only when the viewer is shown for the first time */
 	void showEvent (QShowEvent *e) override;
 	static RKCallstackViewer *instance () { return _instance; };
-public slots:
+public Q_SLOTS:
 	void newDebugState ();
 private:
 	void createRealWidget ();
@@ -44,7 +44,7 @@ public:
 	~RKCallstackViewerWidget ();
 
 	void updateState ();
-private slots:
+private Q_SLOTS:
 	void frameChanged (int frame_number);
 private:
 	QListWidget *frame_selector;
diff --git a/rkward/windows/rkcodecompletion.cpp b/rkward/windows/rkcodecompletion.cpp
index 830c34ad5..3639418c2 100644
--- a/rkward/windows/rkcodecompletion.cpp
+++ b/rkward/windows/rkcodecompletion.cpp
@@ -945,7 +945,7 @@ void RKFileCompletionModelWorker::run () {
 		exes = comp.allMatches ();
 	}
 
-	emit completionsReady(string, exes, files);
+	Q_EMIT completionsReady(string, exes, files);
 }
 
 RKFileCompletionModel::RKFileCompletionModel (RKCompletionManager* manager) : RKCompletionModelBase (manager) {
@@ -1050,7 +1050,7 @@ void RKDynamicCompletionsAddition::update(const QString &mode, const QString &fr
 		current_filterlist = filterlist;
 		if (status == Ready) filterResults(); // no update was triggered, above, need to update filter, manually
 	}
-	if (status == Ready) emit resultsComplete();
+	if (status == Ready) Q_EMIT resultsComplete();
 }
 
 void RKDynamicCompletionsAddition::doUpdateFromR() {
@@ -1084,7 +1084,7 @@ void RKDynamicCompletionsAddition::doUpdateFromR() {
 		}
 		filterResults();
 		status = Ready;
-		emit resultsComplete();
+		Q_EMIT resultsComplete();
 	});
 	RInterface::issueCommand(command);
 }
diff --git a/rkward/windows/rkcodecompletion.h b/rkward/windows/rkcodecompletion.h
index 89d73d595..88f0107d1 100644
--- a/rkward/windows/rkcodecompletion.h
+++ b/rkward/windows/rkcodecompletion.h
@@ -39,9 +39,9 @@ public:
 	KTextEditor::View* view () const { return (_view); };
 	void setLinePrefixes(const QString &_prefix, const QString &_continuation_prefix) { prefix = _prefix; continuation_prefix = _continuation_prefix; };
 	void modelGainedLateData(RKCompletionModelBase *model);
-public slots:
+public Q_SLOTS:
 	void userTriggeredCompletion ();
-private slots:
+private Q_SLOTS:
 	void lineWrapped (KTextEditor::Document *document, const KTextEditor::Cursor &position);
 	void lineUnwrapped (KTextEditor::Document *document, int line);
 	void textInserted (KTextEditor::Document *document, const KTextEditor::Cursor &position, const QString &text);
@@ -176,7 +176,7 @@ class RKFileCompletionModelWorker : public QThread {
 	Q_OBJECT
 public:
 	explicit RKFileCompletionModelWorker (const QString &string);
-signals:
+Q_SIGNALS:
 	void completionsReady (const QString &string, const QStringList &exes, const QStringList &files);
 private:
 	void run () override;
@@ -193,7 +193,7 @@ public:
 	void updateCompletionList (const QString& fragment);
 	QVariant data (const QModelIndex& index, int role=Qt::DisplayRole) const override;
 	QStringList rawPartialCompletions() const;
-private slots:
+private Q_SLOTS:
 	void completionsReady (const QString &string, const QStringList &exes, const QStringList &files);
 private:
 	void launchThread ();
@@ -211,7 +211,7 @@ public:
 	const QStringList results() const { return filtered_results; };
 	const QString fragment() const { return current_fragment; };
 	const QString mode() const { return current_mode; };
-signals:
+Q_SIGNALS:
 	void resultsComplete();
 private:
 	void doUpdateFromR();
diff --git a/rkward/windows/rkcommandeditorwindow.cpp b/rkward/windows/rkcommandeditorwindow.cpp
index 6182887a0..72ca4daf4 100644
--- a/rkward/windows/rkcommandeditorwindow.cpp
+++ b/rkward/windows/rkcommandeditorwindow.cpp
@@ -85,14 +85,14 @@ QMap<QString, KTextEditor::Document*> RKCommandEditorWindow::unnamed_documents;
 KTextEditor::Document* createDocument(bool with_signals) {
 	if (with_signals) {
 #if KTEXTEDITOR_VERSION < QT_VERSION_CHECK(5,80,0)
-		emit KTextEditor::Editor::instance()->application()->aboutToCreateDocuments();
+		Q_EMIT KTextEditor::Editor::instance()->application()->aboutToCreateDocuments();
 #endif
 	}
 	KTextEditor::Document* ret = KTextEditor::Editor::instance()->createDocument (RKWardMainWindow::getMain ());
 	if (with_signals) {
-		emit KTextEditor::Editor::instance()->application()->documentCreated(ret);
+		Q_EMIT KTextEditor::Editor::instance()->application()->documentCreated(ret);
 #if KTEXTEDITOR_VERSION < QT_VERSION_CHECK(5,80,0)
-		emit KTextEditor::Editor::instance()->application()->documentsCreated(QList<KTextEditor::Document*>() << ret);
+		Q_EMIT KTextEditor::Editor::instance()->application()->documentsCreated(QList<KTextEditor::Document*>() << ret);
 #endif
 	}
 	return ret;
@@ -194,7 +194,7 @@ RKCommandEditorWindow::RKCommandEditorWindow (QWidget *parent, const QUrl &_url,
 	else RK_ASSERT (false);
 	m_view = m_doc->createView (this, RKWardMainWindow::getMain ()->katePluginIntegration ()->mainWindow ()->mainWindow());
 	if (visible_to_kateplugins) {
-		emit RKWardMainWindow::getMain ()->katePluginIntegration ()->mainWindow ()->mainWindow()->viewCreated (m_view);
+		Q_EMIT RKWardMainWindow::getMain ()->katePluginIntegration ()->mainWindow ()->mainWindow()->viewCreated (m_view);
 	}
 	preview = new RKXMLGUIPreviewArea (QString(), this);
 	preview_manager = new RKPreviewManager (this);
@@ -311,16 +311,16 @@ RKCommandEditorWindow::~RKCommandEditorWindow () {
 		// if this is the only view, destroy the document. Note that doc has to be destroyed before view. konsole plugin (and possibly others) assumes it.
 		RK_ASSERT(views.at(0) == m_view);
 		if (visible_to_kateplugins) {
-			emit KTextEditor::Editor::instance()->application()->documentWillBeDeleted(m_doc);
+			Q_EMIT KTextEditor::Editor::instance()->application()->documentWillBeDeleted(m_doc);
 #if KTEXTEDITOR_VERSION < QT_VERSION_CHECK(5,80,0)
-			emit KTextEditor::Editor::instance()->application()->aboutToDeleteDocuments(QList<KTextEditor::Document*>() << m_doc);
+			Q_EMIT KTextEditor::Editor::instance()->application()->aboutToDeleteDocuments(QList<KTextEditor::Document*>() << m_doc);
 #endif
 		}
 		m_doc->deleteLater();
 		if (visible_to_kateplugins) {
-			emit KTextEditor::Editor::instance()->application()->documentDeleted(m_doc);
+			Q_EMIT KTextEditor::Editor::instance()->application()->documentDeleted(m_doc);
 #if KTEXTEDITOR_VERSION < QT_VERSION_CHECK(5,80,0)
-			emit KTextEditor::Editor::instance()->application()->documentsDeleted(QList<KTextEditor::Document*>() << m_doc);
+			Q_EMIT KTextEditor::Editor::instance()->application()->documentsDeleted(QList<KTextEditor::Document*>() << m_doc);
 #endif
 		}
 		if (!delete_on_close.isEmpty ()) KIO::del (delete_on_close)->start ();
diff --git a/rkward/windows/rkcommandeditorwindow.h b/rkward/windows/rkcommandeditorwindow.h
index 40c7113dd..58f886b48 100644
--- a/rkward/windows/rkcommandeditorwindow.h
+++ b/rkward/windows/rkcommandeditorwindow.h
@@ -115,7 +115,7 @@ public:
 	void highlightLine (int linenum);
 /** Returns the (main, non-preview) texteditor view in this editor. */
 	KTextEditor::View* getView () const { return m_view; };
-public slots:
+public Q_SLOTS:
 /** update Tab caption according to the current url. Display the filename-component of the URL, or - if not available - a more elaborate description of the url. Also appends a "[modified]" if appropriate */
 	void updateCaption ();
 	void focusIn (KTextEditor::View *);
@@ -140,7 +140,7 @@ protected:
 /** reimplemented from RKMDIWindow: give the editor window a chance to object to being closed (if unsaved) */
 	void closeEvent (QCloseEvent *e) override;
 	void setWindowStyleHint (const QString& hint) override;
-private slots:
+private Q_SLOTS:
 /** mark current selection as a block */
 	void markBlock ();
 /** unmark a block */
diff --git a/rkward/windows/rkcommandlog.cpp b/rkward/windows/rkcommandlog.cpp
index 04af68d29..bf151f473 100644
--- a/rkward/windows/rkcommandlog.cpp
+++ b/rkward/windows/rkcommandlog.cpp
@@ -262,7 +262,7 @@ RKCommandLogView::~RKCommandLogView () {
 void RKCommandLogView::contextMenuEvent(QContextMenuEvent *event) {
 	RK_TRACE(APP);
 
-	emit popupMenuRequest(event->globalPos());
+	Q_EMIT popupMenuRequest(event->globalPos());
 	event->accept();
 }
 
diff --git a/rkward/windows/rkcommandlog.h b/rkward/windows/rkcommandlog.h
index 839e2343e..037cffded 100644
--- a/rkward/windows/rkcommandlog.h
+++ b/rkward/windows/rkcommandlog.h
@@ -42,7 +42,7 @@ friend class RCommand;
 	void rCommandDone (RCommand *command);
 	RKCommandLog (QWidget *parent, bool tool_window, const char *name=0);
 	~RKCommandLog ();
-public slots:
+public Q_SLOTS:
 /** configures the log_view-window */
 	void configureLog ();
 /** clears the log_view-window */
@@ -71,9 +71,9 @@ class RKCommandLogView : public QTextEdit {
 public:
 	explicit RKCommandLogView (RKCommandLog *parent);
 	~RKCommandLogView ();
-public slots:
+public Q_SLOTS:
 	void selectAll ();
-signals:
+Q_SIGNALS:
 	void popupMenuRequest (const QPoint &pos);
 protected:
 	void contextMenuEvent (QContextMenuEvent *event) override;
@@ -91,7 +91,7 @@ public:
 	~RKCommandLogPart ();
 
 	void initActions ();
-public slots:
+public Q_SLOTS:
 	void doPopupMenu (const QPoint &pos);
 private:
 	RKCommandLog *log;
diff --git a/rkward/windows/rkdebugconsole.h b/rkward/windows/rkdebugconsole.h
index cce0adbcb..cbdd27af9 100644
--- a/rkward/windows/rkdebugconsole.h
+++ b/rkward/windows/rkdebugconsole.h
@@ -26,9 +26,9 @@ public:
 
 	// reimplemented to refuse closing while inside the debugger
 	bool close (CloseWindowMode ask_save) override;
-public slots:
+public Q_SLOTS:
 	void newDebugState ();
-private slots:
+private Q_SLOTS:
 	void sendReplySlot ();
 private:
 	QPushButton* addButton(const QString &command, const QString &text, const QString &tip);
diff --git a/rkward/windows/rkfilebrowser.h b/rkward/windows/rkfilebrowser.h
index 775148f17..1884b3306 100644
--- a/rkward/windows/rkfilebrowser.h
+++ b/rkward/windows/rkfilebrowser.h
@@ -48,7 +48,7 @@ public:
 	~RKFileBrowserWidget ();
 
 	bool eventFilter (QObject* o, QEvent* e) override;
-public slots:
+public Q_SLOTS:
 	void setURL (const QUrl &url);
 	void urlChangedInView (const QUrl &url);
 	void stringChangedInCombo (const QString &url);
diff --git a/rkward/windows/rkhelpsearchwindow.h b/rkward/windows/rkhelpsearchwindow.h
index d49b3d935..1cc8dd609 100644
--- a/rkward/windows/rkhelpsearchwindow.h
+++ b/rkward/windows/rkhelpsearchwindow.h
@@ -37,7 +37,7 @@ Will figure out the word under the cursor, and provide help on that (if there is
 	void getContextHelp (const QString &context_line, int cursor_pos);
 	void getFunctionHelp (const QString &function_name, const QString &package=QString(), const QString &type=QString ());
 	static RKHelpSearchWindow *mainHelpSearch () { return main_help_search; };
-public slots:
+public Q_SLOTS:
 	void slotFindButtonClicked();
 	void resultDoubleClicked (const QModelIndex& index);
 	void updateInstalledPackages ();
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index 5e00e4b37..094e7d90e 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -161,11 +161,11 @@ public:
 	}
 #endif
 
-signals:
+Q_SIGNALS:
 	void pageInternalNavigation (const QUrl& url);
 protected:
 #ifdef NO_QT_WEBENGINE
-/** reimplemented to always emit linkClicked() for pages that need special handling (importantly, rkward://-urls). */
+/** reimplemented to always Q_EMIT linkClicked() for pages that need special handling (importantly, rkward://-urls). */
 	bool acceptNavigationRequest (QWebFrame* frame, const QNetworkRequest& request, QWebPage::NavigationType type) override {
 		QUrl navurl = request.url ();
 		QUrl cururl (mainFrame ()->url ());
@@ -199,7 +199,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);
+			Q_EMIT pageInternalNavigation(navurl);
 			return true;
 		}
 
diff --git a/rkward/windows/rkhtmlwindow.h b/rkward/windows/rkhtmlwindow.h
index 297cb300f..4bbf6404c 100644
--- a/rkward/windows/rkhtmlwindow.h
+++ b/rkward/windows/rkhtmlwindow.h
@@ -72,7 +72,7 @@ public:
 	RKOutputDirectory *outputDirectory() const { return dir; };
 
 	WindowMode mode () { return window_mode; };
-public slots:
+public Q_SLOTS:
 	void slotPrint();
 	void slotExport();
 	void slotSave();
@@ -91,7 +91,7 @@ public slots:
 	void zoomOut ();
 	void setTextEncoding (QTextCodec* encoding);
 	void updateState();
-private slots:
+private Q_SLOTS:
 	void scrollToBottom ();
 	void mimeTypeDetermined (KIO::Job*, const QString& type);
 	void mimeTypeJobFail (KJob*);
@@ -223,7 +223,7 @@ private:
 	QString current_default_path;
 	KDirWatch *file_watcher;
 	QMultiHash<QString, RKHTMLWindow *> windows;
-private slots:
+private Q_SLOTS:
 	void fileChanged (const QString &path);
 	void windowDestroyed (QObject *window);
 	void rewatchOutput ();
diff --git a/rkward/windows/rkmdiwindow.cpp b/rkward/windows/rkmdiwindow.cpp
index 42c63a52b..ced310347 100644
--- a/rkward/windows/rkmdiwindow.cpp
+++ b/rkward/windows/rkmdiwindow.cpp
@@ -105,7 +105,7 @@ QString RKMDIWindow::shortCaption () {
 void RKMDIWindow::setCaption(const QString &caption) {
 	RK_TRACE(APP);
 	QWidget::setWindowTitle(caption);
-	emit captionChanged(this);
+	Q_EMIT captionChanged(this);
 	if (tool_window_bar) tool_window_bar->captionChanged(this);
 }
 
@@ -141,7 +141,7 @@ void RKMDIWindow::activate (bool with_focus) {
 		}
 	}
 
-	emit windowActivated(this);
+	Q_EMIT windowActivated(this);
 	if (with_focus) {
 		if (old_focus) old_focus->clearFocus ();
 		topLevelWidget ()->activateWindow ();
@@ -214,7 +214,7 @@ bool RKMDIWindow::eventFilter (QObject *watched, QEvent *e) {
 
 			KParts::PartActivateEvent *ev = static_cast<KParts::PartActivateEvent *>(e);
 			if (ev->activated()) {
-				emit windowActivated(this);
+				Q_EMIT windowActivated(this);
 				setFocus();      // focus doesn't always work correctly for the kate part
 				active = true;
 			} else {
diff --git a/rkward/windows/rkmdiwindow.h b/rkward/windows/rkmdiwindow.h
index 3230cce16..51b632ccb 100644
--- a/rkward/windows/rkmdiwindow.h
+++ b/rkward/windows/rkmdiwindow.h
@@ -68,8 +68,8 @@ protected:
 @param type Type of window (see RKMDIWindow::Type).*/
 	RKMDIWindow (QWidget *parent, int type, bool tool_window=false, const char *name=0);
 	virtual ~RKMDIWindow ();
-public slots:
-/** Reimplemented from QWidget::setCaption () to emit the signal captionChanged () when the caption is changed. */
+public Q_SLOTS:
+/** Reimplemented from QWidget::setCaption () to Q_EMIT the signal captionChanged () when the caption is changed. */
 	void setCaption (const QString &caption);
 public:
 /** @returns true, if the window's document was modified (and would need to be saved) */
@@ -130,13 +130,13 @@ is simply busy (e.g. when saving the current plot to history). */
  *  For the time being, only a single buddy is allowed, and it must outlive all mdi windows. */
 	void addUiBuddy(KXMLGUIClient* buddy);
 	KXMLGUIClient* uiBuddy() const { return ui_buddy; };
-signals:
+Q_SIGNALS:
 /** This signal is emitted, whenever the window caption was changed.
 @param RKMDIWindow* a pointer to this window */
 	void captionChanged (RKMDIWindow *);
 /** This signal is emitted, when the window was activated *with* focus */
 	void windowActivated (RKMDIWindow *);
-protected slots:
+protected Q_SLOTS:
 	void showWindowHelp ();
 	void showWindowSettings ();
 	void clearStatusMessage ();
@@ -160,7 +160,7 @@ protected:
 friend class RKWorkplace;
 /** type of this window */
 	int type;
-private slots:
+private Q_SLOTS:
 	void slotActivateForFocusFollowsMouse ();
 protected:
 	QAction* file_save_as_action;
diff --git a/rkward/windows/rktoolwindowbar.h b/rkward/windows/rktoolwindowbar.h
index d54fe4816..69d704634 100644
--- a/rkward/windows/rktoolwindowbar.h
+++ b/rkward/windows/rktoolwindowbar.h
@@ -41,7 +41,7 @@ public:
 	void restoreSize (const KConfigGroup &cg);
 	void saveSize (KConfigGroup &cg) const;
 	void captionChanged(RKMDIWindow* window);
-private slots:
+private Q_SLOTS:
 	void tabClicked (int id);
 	void changeAttachment ();
 	void moveToolWindow (int target);
diff --git a/rkward/windows/rktoplevelwindowgui.h b/rkward/windows/rktoplevelwindowgui.h
index f9f2fa369..82f586f40 100644
--- a/rkward/windows/rktoplevelwindowgui.h
+++ b/rkward/windows/rktoplevelwindowgui.h
@@ -25,7 +25,7 @@ public:
 	explicit RKTopLevelWindowGUI (KXmlGuiWindow *for_window);
 	~RKTopLevelWindowGUI ();
 	void initToolWindowActions ();
-public slots:
+public Q_SLOTS:
 	// windows menu
 	/** Raise the help search window */
 	void showHelpSearch ();
@@ -54,7 +54,7 @@ public slots:
 	void configureShortcuts ();
 	/** configure key bindings. Reimplemented to show notice before the actual dialog. */
 	void configureToolbars ();
-private slots:
+private Q_SLOTS:
 	void toggleToolView ();
 	void previousWindow ();
 	void nextWindow ();
diff --git a/rkward/windows/rkwindowcatcher.h b/rkward/windows/rkwindowcatcher.h
index 2cc9dc4b0..b85b61c96 100644
--- a/rkward/windows/rkwindowcatcher.h
+++ b/rkward/windows/rkwindowcatcher.h
@@ -125,7 +125,7 @@ public:
 /** returns the window corresponding the to given R device number (or 0 if no such window exists) */
 	static RKCaughtX11Window* getWindow (int device_number) { return device_windows.value (device_number); };
 	void updateHistoryActions (int history_length, int position, const QStringList &labels);
-public slots:
+public Q_SLOTS:
 	void deviceInteractive (bool interactive, const QString &prompt);
 	
 /** Fixed size action was (potentially) toggled. Update to the new state */
@@ -161,7 +161,7 @@ public slots:
 	bool close (RKMDIWindow::CloseWindowMode ask_save) override;
 	void setKilledInR () { killed_in_r = true; };
 	void setWindowStyleHint (const QString& hint) override;
-private slots:
+private Q_SLOTS:
 	void doEmbed ();
 private:
 	void forceClose ();
diff --git a/rkward/windows/rkworkplace.cpp b/rkward/windows/rkworkplace.cpp
index 518e31ec5..c65725453 100644
--- a/rkward/windows/rkworkplace.cpp
+++ b/rkward/windows/rkworkplace.cpp
@@ -174,7 +174,7 @@ void RKWorkplace::setWorkspaceURL (const QUrl &url, bool keep_config) {
 			delete _workspace_config;
 			_workspace_config = 0;
 		}
-		emit workspaceUrlChanged(url);
+		Q_EMIT workspaceUrlChanged(url);
 	}
 }
 
@@ -1168,7 +1168,7 @@ void RKMDIWindowHistory::windowActivated (RKMDIWindow *window) {
 
 	updateSwitcher ();
 
-	emit activeWindowChanged (window);
+	Q_EMIT activeWindowChanged (window);
 }
 
 void RKMDIWindowHistory::next (QAction* prev_action, QAction *next_action) {
diff --git a/rkward/windows/rkworkplace.h b/rkward/windows/rkworkplace.h
index 1cee2574c..b75b6b929 100644
--- a/rkward/windows/rkworkplace.h
+++ b/rkward/windows/rkworkplace.h
@@ -49,11 +49,11 @@ public:
 	RKMDIWindow *previousDocumentWindow ();
 	void next (QAction *prev_action, QAction *next_action);
 	void prev (QAction *prev_action, QAction *next_action);
-public slots:
+public Q_SLOTS:
 	void windowActivated (RKMDIWindow *window);
-signals:
+Q_SIGNALS:
 	void activeWindowChanged (RKMDIWindow *window);
-private slots:
+private Q_SLOTS:
 	void switcherDestroyed ();
 private:
 	void updateSwitcher ();
@@ -217,16 +217,16 @@ Has no effect, if RKSettingsModuleGeneral::workplaceSaveMode () != RKSettingsMod
 /** Inform the workplace that this window is handled outside the regular attached/detached mechanisms (such as preview windows). Internally, this just sets the window to detached, without giving it a DetachedWindowContainer.
 This seems good enough for now, but may be something to revisit in case of unexpected problems. */
 	void setWindowNotManaged(RKMDIWindow *window);
-signals:
+Q_SIGNALS:
 /** emitted when the workspace Url has changed */
 	void workspaceUrlChanged (const QUrl &url);
-public slots:
+public Q_SLOTS:
 /** When windows are attached to the workplace, their QObject::destroyed () signal is connected to this slot. Thereby deleted objects are removed from the workplace automatically */
 	void removeWindow (QObject *window);
 	void saveSettings ();
 /** Proxy for QDesktopServices::setUrlHandler(), set in c'tor. Simply calls RKHTMLWindow::handleRKWardUrl(). */
 	void openRKWardUrl(const QUrl& url);
-private slots:
+private Q_SLOTS:
 	void namedWindowDestroyed (QObject *);
 	void namedWindowOwnerDestroyed (QObject *);
 private:
diff --git a/rkward/windows/rkworkplaceview.cpp b/rkward/windows/rkworkplaceview.cpp
index 0e1ad4ab7..32269793d 100644
--- a/rkward/windows/rkworkplaceview.cpp
+++ b/rkward/windows/rkworkplaceview.cpp
@@ -129,7 +129,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) Q_EMIT becameEmpty(this);
 	workplace_view->updateActions ();
 }
 
@@ -484,7 +484,7 @@ void RKWorkplaceView::setCaption(const QString &caption) {
 	RK_TRACE(APP);
 
 	QWidget::setWindowTitle(caption);
-	emit captionChanged(caption);
+	Q_EMIT captionChanged(caption);
 }
 
 void RKWorkplaceView::restoreLayout(const QString& desc) {
diff --git a/rkward/windows/rkworkplaceview.h b/rkward/windows/rkworkplaceview.h
index 0f6d806e4..871a90b78 100644
--- a/rkward/windows/rkworkplaceview.h
+++ b/rkward/windows/rkworkplaceview.h
@@ -35,9 +35,9 @@ protected:
 	void tabRemoved (int index) override;
 	void tabInserted (int index) override;
 	bool eventFilter (QObject* obj, QEvent* event) override;
-signals:
+Q_SIGNALS:
 	void becameEmpty (RKWorkplaceViewPane* pane);
-private slots:
+private Q_SLOTS:
 /** handle context menu requests */
 	void showContextMenu (const QPoint &pos);
 /** handle close request from context menu */
@@ -74,7 +74,7 @@ public:
 
 /** @returns the currently active window */
 	RKMDIWindow *activePage () const;
-/** reimplemented form QWidget::setCaption () to emit captionChanged () when the caption changes */
+/** reimplemented form QWidget::setCaption () to Q_EMIT captionChanged () when the caption changes */
 	void setCaption (const QString &caption);
 /** initialize the window left/right actions */
 	void initActions (KActionCollection *ac);
@@ -90,14 +90,14 @@ public:
 /** For use right after workplace restoration: Purge any panes set up by restoreLayout(), but left empty */
 	void purgeEmptyPanes ();
 	void splitView(Qt::Orientation orientation) { splitView (orientation, QString()); };
-signals:
+Q_SIGNALS:
 /** a new page / window was activated
 @param widget the newly activated window */
 	void pageChanged (RKMDIWindow *widget);
 /** caption has changed
 @param new_caption the new caption */
 	void captionChanged (const QString &new_caption);
-private slots:
+private Q_SLOTS:
 /** called when the caption of a window changes. Updates the tab-label, and - if appropriate - the caption of this widget */
 	void childCaptionChanged (RKMDIWindow *widget);
 /** Active the page left of the current tab */
diff --git a/rkward/windows/robjectbrowser.h b/rkward/windows/robjectbrowser.h
index 6e26d5928..eb88bc77f 100644
--- a/rkward/windows/robjectbrowser.h
+++ b/rkward/windows/robjectbrowser.h
@@ -55,7 +55,7 @@ Q_OBJECT
 public:
 	explicit RObjectBrowserInternal (QWidget *parent, RObjectBrowser *browser);
 	~RObjectBrowserInternal ();
-private slots:
+private Q_SLOTS:
 	void updateButtonClicked ();
 	void contextMenuCallback (RObject *object, bool *suppress);
 



More information about the rkward-tracker mailing list