[education/rkward] rkward: Port away from deprecated QButtonGroup::buttonClicked(int). Move porting aids to separate header file.

Thomas Friedrichsmeier null at kde.org
Sat May 14 21:24:09 BST 2022


Git commit 7a7f17541d51f1fc76ee616b11d4f2cc7f2a153c by Thomas Friedrichsmeier.
Committed on 14/05/2022 at 20:23.
Pushed by tfry into branch 'master'.

Port away from deprecated QButtonGroup::buttonClicked(int). Move porting aids to separate header file.

M  +2    -2    rkward/core/rkvariable.cpp
M  +2    -1    rkward/dialogs/rkreadlinedialog.cpp
M  +1    -0    rkward/misc/CMakeLists.txt
M  +1    -17   rkward/misc/rkcommonfunctions.cpp
M  +0    -4    rkward/misc/rkcommonfunctions.h
A  +28   -0    rkward/misc/rkcompatibility.cpp     [License: GPL(v2.0+)]
A  +43   -0    rkward/misc/rkcompatibility.h     [License: GPL(v2.0+)]
M  +4    -3    rkward/misc/rkspecialactions.cpp
M  +3    -3    rkward/plugin/rkcomponentmeta.cpp
M  +3    -2    rkward/plugin/rkcomponentproperties.cpp
M  +2    -1    rkward/plugin/rkformula.cpp
M  +3    -3    rkward/plugin/rkmatrixinput.cpp
M  +3    -2    rkward/plugin/rkoptionset.cpp
M  +2    -1    rkward/plugin/rkradio.cpp
M  +2    -1    rkward/plugin/rkstandardcomponentgui.cpp
M  +3    -3    rkward/plugin/rkvarslot.cpp
M  +3    -2    rkward/rkconsole.cpp
M  +2    -1    rkward/rkward.cpp
M  +2    -1    rkward/settings/rksettingsmoduledebug.cpp
M  +2    -1    rkward/settings/rksettingsmodulegeneral.cpp
M  +3    -2    rkward/settings/rksettingsmodulegraphics.cpp
M  +2    -1    rkward/settings/rksettingsmoduleplugins.cpp
M  +3    -2    rkward/windows/rkhtmlwindow.cpp
M  +2    -1    rkward/windows/rkwindowcatcher.cpp
M  +2    -2    rkward/windows/rkworkplace.cpp

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

diff --git a/rkward/core/rkvariable.cpp b/rkward/core/rkvariable.cpp
index 23c708eb..055402dd 100644
--- a/rkward/core/rkvariable.cpp
+++ b/rkward/core/rkvariable.cpp
@@ -13,7 +13,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "rcontainerobject.h"
 #include "robjectlist.h"
 #include "../rbackend/rkrinterface.h"
-#include "../misc/rkcommonfunctions.h"
+#include "../misc/rkcompatibility.h"
 
 #include "rkmodificationtracker.h"
 
@@ -862,7 +862,7 @@ RKVariable::FormattingOptions RKVariable::parseFormattingOptionsString (const QS
 	formatting_options.precision_mode = FormattingOptions::PrecisionDefault;
 	formatting_options.precision = 0;
 
-	QStringList list = string.split ('#', RKCommonFunctions::SkipEmptyParts());
+	QStringList list = string.split ('#', RKCompatibility::SkipEmptyParts());
 	QString option, parameter;
 	for (QStringList::const_iterator it = list.constBegin (); it != list.constEnd (); ++it) {
 		option = (*it).section (':', 0, 0);
diff --git a/rkward/dialogs/rkreadlinedialog.cpp b/rkward/dialogs/rkreadlinedialog.cpp
index 65d2da85..6984db02 100644
--- a/rkward/dialogs/rkreadlinedialog.cpp
+++ b/rkward/dialogs/rkreadlinedialog.cpp
@@ -20,6 +20,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "../rbackend/rcommand.h"
 #include "../misc/rkdialogbuttonbox.h"
 #include "../misc/rkcommonfunctions.h"
+#include "../misc/rkcompatibility.h"
 
 #include "../debug.h"
 
@@ -35,7 +36,7 @@ RKReadLineDialog::RKReadLineDialog (QWidget *parent, const QString &caption, con
 
 	layout->addWidget (new QLabel (caption, this));
 
-	int screen_width = RKCommonFunctions::availableGeometry(this).width();
+	int screen_width = RKCompatibility::availableGeometry(this).width();
 
 	QString context = command->fullOutput ();
 	if (!context.isEmpty ()) {
diff --git a/rkward/misc/CMakeLists.txt b/rkward/misc/CMakeLists.txt
index 81a4ed09..1fbc822a 100644
--- a/rkward/misc/CMakeLists.txt
+++ b/rkward/misc/CMakeLists.txt
@@ -7,6 +7,7 @@ SET(misc_STAT_SRCS
    xmlhelper.cpp
    multistringselector.cpp
    rkcommonfunctions.cpp
+   rkcompatibility.cpp
    rkprogresscontrol.cpp
    rksaveobjectchooser.cpp
    rkdummypart.cpp
diff --git a/rkward/misc/rkcommonfunctions.cpp b/rkward/misc/rkcommonfunctions.cpp
index e5b3faa4..04b26f85 100644
--- a/rkward/misc/rkcommonfunctions.cpp
+++ b/rkward/misc/rkcommonfunctions.cpp
@@ -11,12 +11,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include <qregexp.h>
 #include <QDir>
 #include <QStandardPaths>
-#include <QApplication>
-#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
-#	include <QDesktopWidget>
-#else
-#	include <QScreen>
-#endif
+#include <QCoreApplication>
 #include <QLabel>
 
 #include <KLocalizedString>
@@ -276,15 +271,4 @@ namespace RKCommonFunctions {
 		QObject::connect (ret, &QLabel::linkActivated, RKWorkplace::mainWorkplace (), &RKWorkplace::openAnyUrlString);
 		return ret;
 	}
-
-	QRect availableGeometry(QWidget* for_widget) {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
-		auto screen = for_widget->screen();
-		if (screen) return screen->availableGeometry();
-		return QApplication::primaryScreen()->availableGeometry();
-#else
-		return ::QApplication::desktop()->availableGeometry(for_widget);
-#endif
-	}
-
 }	// namespace
diff --git a/rkward/misc/rkcommonfunctions.h b/rkward/misc/rkcommonfunctions.h
index 6f07df56..e9f1e939 100644
--- a/rkward/misc/rkcommonfunctions.h
+++ b/rkward/misc/rkcommonfunctions.h
@@ -57,10 +57,6 @@ namespace RKCommonFunctions {
 /** create a QLabel that has wordwarp enabled, *and* clickable links (opened inside RKWard), in a single line of code. */
 	QLabel* linkedWrappedLabel (const QString &text);
 
-//// NOTE: Functions / constants below are porting aids, to be removed, eventually. ////
-/** Small wrapper around QScreen::availableGeometry(), mostly to ease porting */
-	QRect availableGeometry(QWidget *for_widget);
-
 /** Porting aid: Qt::SplitBehaviorFlags was added in Qt 5.14, deprecating the previous flags in QString. Remove, once we depend on Qt >= 5.14 */
 #if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
 	inline Qt::SplitBehaviorFlags KeepEmptyParts() { return Qt::KeepEmptyParts; };
diff --git a/rkward/misc/rkcompatibility.cpp b/rkward/misc/rkcompatibility.cpp
new file mode 100644
index 00000000..bf8084e4
--- /dev/null
+++ b/rkward/misc/rkcompatibility.cpp
@@ -0,0 +1,28 @@
+/*
+rkcommonfunctions - This file is part of the RKWard project. Created: Sat May 14 2022
+SPDX-FileCopyrightText: 2022 by Thomas Friedrichsmeier <thomas.friedrichsmeier at kdemail.net>
+SPDX-FileContributor: The RKWard Team <rkward-devel at kde.org>
+SPDX-License-Identifier: GPL-2.0-or-later
+*/
+
+#include "rkcompatibility.h"
+
+#include <QApplication>
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
+#	include <QDesktopWidget>
+#else
+#	include <QScreen>
+#endif
+
+namespace RKCompatibility {
+	QRect availableGeometry(QWidget* for_widget) {
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+		auto screen = for_widget->screen();
+		if (screen) return screen->availableGeometry();
+		return QApplication::primaryScreen()->availableGeometry();
+#else
+		return ::QApplication::desktop()->availableGeometry(for_widget);
+#endif
+	}
+};
+
diff --git a/rkward/misc/rkcompatibility.h b/rkward/misc/rkcompatibility.h
new file mode 100644
index 00000000..c8afbd23
--- /dev/null
+++ b/rkward/misc/rkcompatibility.h
@@ -0,0 +1,43 @@
+/*
+rkcommonfunctions - This file is part of the RKWard project. Created: Sat May 14 2022
+SPDX-FileCopyrightText: 2022 by Thomas Friedrichsmeier <thomas.friedrichsmeier at kdemail.net>
+SPDX-FileContributor: The RKWard Team <rkward-devel at kde.org>
+SPDX-License-Identifier: GPL-2.0-or-later
+*/
+#ifndef RKCOMPATIBILTY_H
+#define RKCOMPATIBILTY_H
+
+#include <QRect>
+#include <QString>
+#include <QButtonGroup>
+
+class QWidget;
+
+/** Some helper functions / enums for the sole purpose of working around API changes while keeping compatibility across a wide range of Qt/KF versions.
+
+By their very nature, these functions are not meant to stay, but should be removed, as soon as the incompatibility falls outside the range of supported versions.
+
+ at author Thomas Friedrichsmeier
+*/
+namespace RKCompatibility {
+//// NOTE: Functions / constants below are porting aids, to be removed, eventually. ////
+/** Small wrapper around QScreen::availableGeometry(), mostly to ease porting */
+	QRect availableGeometry(QWidget *for_widget);
+
+/** Porting aid: Qt::SplitBehaviorFlags was added in Qt 5.14, deprecating the previous flags in QString. Remove, once we depend on Qt >= 5.14 */
+#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
+	inline Qt::SplitBehaviorFlags KeepEmptyParts() { return Qt::KeepEmptyParts; };
+	inline Qt::SplitBehaviorFlags SkipEmptyParts() { return Qt::SkipEmptyParts; };
+#else
+	inline QString::SplitBehavior KeepEmptyParts() { return QString::KeepEmptyParts; };
+	inline QString::SplitBehavior SkipEmptyParts() { return QString::SkipEmptyParts; };
+#endif
+
+#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
+	inline void(QButtonGroup::* groupButtonClicked())(int) { return static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::idClicked); };
+#else
+	inline void(QButtonGroup::* groupButtonClicked())(int) { return static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked); };
+#endif
+};
+
+#endif
diff --git a/rkward/misc/rkspecialactions.cpp b/rkward/misc/rkspecialactions.cpp
index 9b82c448..5a3ce0d4 100644
--- a/rkward/misc/rkspecialactions.cpp
+++ b/rkward/misc/rkspecialactions.cpp
@@ -56,6 +56,7 @@ void RKPasteSpecialAction::doSpecialPaste() {
 #include "rksaveobjectchooser.h"
 #include "../rbackend/rkrinterface.h"
 #include "../misc/rkprogresscontrol.h"
+#include "../misc/rkcompatibility.h"
 
 RKPasteSpecialDialog::RKPasteSpecialDialog(QWidget* parent, bool standalone) : QDialog(parent) {
 	RK_TRACE (MISC);
@@ -93,7 +94,7 @@ RKPasteSpecialDialog::RKPasteSpecialDialog(QWidget* parent, bool standalone) : Q
 	dimensionality_group->addButton (rbutton, DimDataFrame);
 	rbutton->setChecked (true);
 	group_layout->addWidget (rbutton);
-	connect (dimensionality_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &RKPasteSpecialDialog::updateState);
+	connect (dimensionality_group, RKCompatibility::groupButtonClicked(), this, &RKPasteSpecialDialog::updateState);
 	rowlayout->addWidget (box);
 
 	const QMimeData* clipdata = QApplication::clipboard ()->mimeData ();
@@ -123,7 +124,7 @@ RKPasteSpecialDialog::RKPasteSpecialDialog(QWidget* parent, bool standalone) : Q
 	separator_freefield = new QLineEdit (";", box);
 	h_layout->addWidget (separator_freefield);
 	group_layout->addLayout (h_layout);
-	connect (separator_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &RKPasteSpecialDialog::updateState);
+	connect (separator_group, RKCompatibility::groupButtonClicked(), this, &RKPasteSpecialDialog::updateState);
 	rowlayout->addWidget (box);
 
 	rowlayout = new QHBoxLayout;
@@ -143,7 +144,7 @@ RKPasteSpecialDialog::RKPasteSpecialDialog(QWidget* parent, bool standalone) : Q
 	rbutton = new QRadioButton (i18n ("Quote all values"), box);
 	quoting_group->addButton (rbutton, QuoteAll);
 	group_layout->addWidget (rbutton);
-	connect (quoting_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &RKPasteSpecialDialog::updateState);
+	connect (quoting_group, RKCompatibility::groupButtonClicked(), this, &RKPasteSpecialDialog::updateState);
 	rowlayout->addWidget (box);
 
 	// Labels
diff --git a/rkward/plugin/rkcomponentmeta.cpp b/rkward/plugin/rkcomponentmeta.cpp
index 296036e3..6c4bf028 100644
--- a/rkward/plugin/rkcomponentmeta.cpp
+++ b/rkward/plugin/rkcomponentmeta.cpp
@@ -9,7 +9,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "../misc/xmlhelper.h"
 #include "../misc/rkmessagecatalog.h"
-#include "../misc/rkcommonfunctions.h"
+#include "../misc/rkcompatibility.h"
 #include "../rbackend/rksessionvars.h"
 
 #include <KLocalizedString>
@@ -93,8 +93,8 @@ QString RKComponentAboutData::toHtml () const {
 	}
 
 	if (!translator_names.isNull ()) {
-		QStringList tns = translator_names.split (QLatin1Char(','), RKCommonFunctions::KeepEmptyParts());
-		QStringList tes = translator_emails.split (QLatin1Char(','), RKCommonFunctions::KeepEmptyParts());
+		QStringList tns = translator_names.split (QLatin1Char(','), RKCompatibility::KeepEmptyParts());
+		QStringList tes = translator_emails.split (QLatin1Char(','), RKCompatibility::KeepEmptyParts());
 		ret.append ("\n<p><b>" + i18n ("Translators:") + "</b></p>\n<p><ul>");
 		for (int i = 0; i < tns.size (); ++i) {
 			QString tn = tns.value (i);
diff --git a/rkward/plugin/rkcomponentproperties.cpp b/rkward/plugin/rkcomponentproperties.cpp
index 5f194ca8..79691e81 100644
--- a/rkward/plugin/rkcomponentproperties.cpp
+++ b/rkward/plugin/rkcomponentproperties.cpp
@@ -84,6 +84,7 @@ the specialized properties (e.g. RKComponentPropertyInt::intValue () always retu
 #include "rkcomponentproperties.h"
 
 #include "../misc/rkcommonfunctions.h"
+#include "../misc/rkcompatibility.h"
 
 #include <KLocalizedString>
 
@@ -1004,13 +1005,13 @@ bool RKComponentPropertyRObjects::setValueList (const QStringList& values) {
 bool RKComponentPropertyRObjects::setValue (const QString &value) {
 	RK_TRACE (PLUGIN);
 
-	return setValueList (value.split (sep, RKCommonFunctions::SkipEmptyParts()));
+	return setValueList (value.split (sep, RKCompatibility::SkipEmptyParts()));
 }
 
 bool RKComponentPropertyRObjects::isStringValid (const QString &value) {
 	RK_TRACE (PLUGIN);
 
-	QStringList slist = value.split (sep, RKCommonFunctions::SkipEmptyParts());
+	QStringList slist = value.split (sep, RKCompatibility::SkipEmptyParts());
 
 	for (QStringList::const_iterator it = slist.cbegin (); it != slist.cend (); ++it) {
 		RObject *obj = RObjectList::getObjectList ()->findObject (*it);
diff --git a/rkward/plugin/rkformula.cpp b/rkward/plugin/rkformula.cpp
index 797ebf94..a090d7ec 100644
--- a/rkward/plugin/rkformula.cpp
+++ b/rkward/plugin/rkformula.cpp
@@ -22,6 +22,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "../core/rcontainerobject.h"
 #include "../misc/xmlhelper.h"
 #include "../misc/rkstandardicons.h"
+#include "../misc/rkcompatibility.h"
 
 #include "../debug.h"
 
@@ -65,7 +66,7 @@ RKFormula::RKFormula (const QDomElement &element, RKComponent *parent_component,
 	type_selector->addButton (button, (int) MainEffects);
 	vbox->addWidget (button = new QRadioButton (i18n ("Custom Model:"), this));
 	type_selector->addButton (button, (int) Custom);
-	connect (type_selector, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &RKFormula::typeChange);
+	connect (type_selector, RKCompatibility::groupButtonClicked(), this, &RKFormula::typeChange);
 
 	custom_model_widget = new QWidget (this);
 	QHBoxLayout *model_hbox = new QHBoxLayout (custom_model_widget);
diff --git a/rkward/plugin/rkmatrixinput.cpp b/rkward/plugin/rkmatrixinput.cpp
index 3efde48a..c05787d4 100644
--- a/rkward/plugin/rkmatrixinput.cpp
+++ b/rkward/plugin/rkmatrixinput.cpp
@@ -17,7 +17,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "../misc/rktableview.h"
 #include "../dataeditor/rktextmatrix.h"
 #include "../misc/xmlhelper.h"
-#include "../misc/rkcommonfunctions.h"
+#include "../misc/rkcompatibility.h"
 
 #include "../debug.h"
 
@@ -185,7 +185,7 @@ void RKMatrixInput::setColumnValue (int column, const QString& value) {
 	RK_TRACE (PLUGIN);
 
 	if (!expandStorageForColumn (column)) return;
-	columns[column].storage = value.split ('\t', RKCommonFunctions::KeepEmptyParts());
+	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));
 }
@@ -334,7 +334,7 @@ void RKMatrixInput::tsvPropertyChanged () {
 	RK_TRACE (PLUGIN);
 
 	columns.clear ();
-	QStringList coldata = fetchStringValue (tsv_data).split ('\n', RKCommonFunctions::KeepEmptyParts());
+	QStringList coldata = fetchStringValue (tsv_data).split ('\n', RKCompatibility::KeepEmptyParts());
 	for (int i = 0; i < coldata.size (); ++i) {
 		setColumnValue (i, coldata[i]);
 	}
diff --git a/rkward/plugin/rkoptionset.cpp b/rkward/plugin/rkoptionset.cpp
index 714e899b..1526db10 100644
--- a/rkward/plugin/rkoptionset.cpp
+++ b/rkward/plugin/rkoptionset.cpp
@@ -18,6 +18,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "rkstandardcomponent.h"
 #include "../misc/rkcommonfunctions.h"
+#include "../misc/rkcompatibility.h"
 #include "../misc/rkaccordiontable.h"
 #include "../misc/rkstandardicons.h"
 #include "../misc/xmlhelper.h"
@@ -190,7 +191,7 @@ QString serializeList (const QStringList &list) {
 }
 
 QStringList unserializeList  (const QString &serial) {
-	QStringList ret = serial.split ('\t', RKCommonFunctions::KeepEmptyParts());
+	QStringList ret = serial.split ('\t', RKCompatibility::KeepEmptyParts());
 	for (int i = 0; i < ret.size (); ++i) {
 		ret[i] = RKCommonFunctions::unescape (ret[i]);
 	}
@@ -210,7 +211,7 @@ QString serializeMap (const RKComponent::PropertyValueMap &map) {
 
 RKComponent::PropertyValueMap unserializeMap (const QString &serial) {
 	RKComponent::PropertyValueMap ret;
-	QStringList l = serial.split ('\t', RKCommonFunctions::KeepEmptyParts());
+	QStringList l = serial.split ('\t', RKCompatibility::KeepEmptyParts());
 	for (int i = 0; i < l.size (); ++i) {
 		QString &line = l[i];
 		int sep = line.indexOf ('=');
diff --git a/rkward/plugin/rkradio.cpp b/rkward/plugin/rkradio.cpp
index 2f88269f..492c24ff 100644
--- a/rkward/plugin/rkradio.cpp
+++ b/rkward/plugin/rkradio.cpp
@@ -17,6 +17,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include <KLocalizedString>
 
 #include "../misc/xmlhelper.h"
+#include "../misc/rkcompatibility.h"
 #include "../debug.h"
 
 RKRadio::RKRadio (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget) : RKAbstractOptionSelector (parent_component, parent_widget) {
@@ -37,7 +38,7 @@ RKRadio::RKRadio (const QDomElement &element, RKComponent *parent_component, QWi
 	addOptionsAndInit (element);
 
 	vbox->addWidget (group_box);
-	connect (group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &RKRadio::itemSelected);
+	connect (group, RKCompatibility::groupButtonClicked(), this, &RKRadio::itemSelected);
 }
 
 RKRadio::~RKRadio(){
diff --git a/rkward/plugin/rkstandardcomponentgui.cpp b/rkward/plugin/rkstandardcomponentgui.cpp
index 1389f0e6..7263c62d 100644
--- a/rkward/plugin/rkstandardcomponentgui.cpp
+++ b/rkward/plugin/rkstandardcomponentgui.cpp
@@ -23,6 +23,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "rkcomponentmap.h"
 #include "../misc/rkcommonfunctions.h"
+#include "../misc/rkcompatibility.h"
 #include "../misc/rkstandardicons.h"
 #include "../misc/rkxmlguipreviewarea.h"
 #include "../misc/rkstyle.h"
@@ -75,7 +76,7 @@ public:
 		setSizes (sizes);
 
 		if (QSplitter::window ()->isVisible ()) {
-			QRect boundary = RKCommonFunctions::availableGeometry(this);
+			QRect boundary = RKCompatibility::availableGeometry(this);
 			int new_width = window->width ();
 			int new_height = window->height ();
 			int new_x = window->x ();
diff --git a/rkward/plugin/rkvarslot.cpp b/rkward/plugin/rkvarslot.cpp
index 9d548aa1..517d91af 100644
--- a/rkward/plugin/rkvarslot.cpp
+++ b/rkward/plugin/rkvarslot.cpp
@@ -24,7 +24,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "../debug.h"
 #include "../misc/xmlhelper.h"
 #include "../misc/rkstandardicons.h"
-#include "../misc/rkcommonfunctions.h"
+#include "../misc/rkcompatibility.h"
 
 RKVarSlot::RKVarSlot (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget) : RKComponent (parent_component, parent_widget) {
 	RK_TRACE (PLUGIN);
@@ -99,8 +99,8 @@ RKVarSlot::RKVarSlot (const QDomElement &element, RKComponent *parent_component,
 
 	if (mode == Varslot) {
 		// initialize filters
-		static_cast<RKComponentPropertyRObjects*> (available)->setClassFilter (xml->getStringAttribute (element, "classes", QString (), DL_INFO).split (' ', RKCommonFunctions::SkipEmptyParts()));
-		static_cast<RKComponentPropertyRObjects*> (available)->setTypeFilter (xml->getStringAttribute (element, "types", QString (), DL_INFO).split (' ', RKCommonFunctions::SkipEmptyParts()));
+		static_cast<RKComponentPropertyRObjects*> (available)->setClassFilter (xml->getStringAttribute (element, "classes", QString (), DL_INFO).split (' ', RKCompatibility::SkipEmptyParts()));
+		static_cast<RKComponentPropertyRObjects*> (available)->setTypeFilter (xml->getStringAttribute (element, "types", QString (), DL_INFO).split (' ', RKCompatibility::SkipEmptyParts()));
 		static_cast<RKComponentPropertyRObjects*> (available)->setDimensionFilter (xml->getIntAttribute (element, "num_dimensions", 0, DL_INFO), xml->getIntAttribute (element, "min_length", 0, DL_INFO), xml->getIntAttribute (element, "max_length", INT_MAX, DL_INFO));
 		static_cast<RKComponentPropertyRObjects*> (available)->setObjectProblemsAreErrors (false);
 	}
diff --git a/rkward/rkconsole.cpp b/rkward/rkconsole.cpp
index 28533daa..3b3e8faf 100644
--- a/rkward/rkconsole.cpp
+++ b/rkward/rkconsole.cpp
@@ -51,6 +51,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "settings/rksettingsmoduleconsole.h"
 #include "settings/rkrecenturls.h"
 #include "misc/rkcommonfunctions.h"
+#include "misc/rkcompatibility.h"
 #include "misc/rkstandardicons.h"
 #include "misc/rkstandardactions.h"
 #include "core/robjectlist.h"
@@ -712,7 +713,7 @@ void RKConsole::userLoadHistory (const QUrl &_url) {
 
 	QFile file (filename);
 	if (!file.open (QIODevice::Text | QIODevice::ReadOnly)) return;
-	setCommandHistory (QString (file.readAll ()).split ('\n', RKCommonFunctions::SkipEmptyParts()), false);
+	setCommandHistory (QString (file.readAll ()).split ('\n', RKCompatibility::SkipEmptyParts()), false);
 	file.close ();
 
 	delete (tmpfile);
@@ -896,7 +897,7 @@ void RKConsole::pipeCommandThroughConsoleLocal (const QString &command_string) {
 		}
 	}
 	if (RKSettingsModuleConsole::addPipedCommandsToHistory() != RKSettingsModuleConsole::DontAdd) {
-		QStringList lines = command_string.split ('\n', RKCommonFunctions::SkipEmptyParts());
+		QStringList lines = command_string.split ('\n', RKCompatibility::SkipEmptyParts());
 		if ((RKSettingsModuleConsole::addPipedCommandsToHistory() == RKSettingsModuleConsole::AlwaysAdd) || (lines.count () == 1)) {
 			for (int i = 0; i < lines.count (); ++i) {
 				commands_history.append (lines[i]);
diff --git a/rkward/rkward.cpp b/rkward/rkward.cpp
index 4141c057..050d75f4 100644
--- a/rkward/rkward.cpp
+++ b/rkward/rkward.cpp
@@ -53,6 +53,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "core/renvironmentobject.h"
 #include "misc/rkstandardicons.h"
 #include "misc/rkcommonfunctions.h"
+#include "misc/rkcompatibility.h"
 #include "misc/rkxmlguisyncer.h"
 #include "misc/rkdbusapi.h"
 #include "misc/rkdialogbuttonbox.h"
@@ -770,7 +771,7 @@ void RKWardMainWindow::readOptions () {
 	KConfigGroup cg = config->group ("General Options");
 	QSize size = cg.readEntry ("Geometry", QSize ());
 	if (size.isEmpty ()) {
-		size = RKCommonFunctions::availableGeometry(this).size();
+		size = RKCompatibility::availableGeometry(this).size();
 	}
 	resize (size);
 
diff --git a/rkward/settings/rksettingsmoduledebug.cpp b/rkward/settings/rksettingsmoduledebug.cpp
index 2fa5832f..6553a17c 100644
--- a/rkward/settings/rksettingsmoduledebug.cpp
+++ b/rkward/settings/rksettingsmoduledebug.cpp
@@ -20,6 +20,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "../misc/rkspinbox.h"
 #include "../misc/rkcommonfunctions.h"
+#include "../misc/rkcompatibility.h"
 #include "../misc/rkstyle.h"
 
 #include "../debug.h"
@@ -65,7 +66,7 @@ RKSettingsModuleDebug::RKSettingsModuleDebug (RKSettings *gui, QWidget *parent)
 		box_layout->addWidget (*it);
 		(*it)->setChecked (RK_Debug::RK_Debug_Flags & debug_flags_group->id (*it));
 	}
-	connect (debug_flags_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &RKSettingsModuleDebug::settingChanged);
+	connect (debug_flags_group, RKCompatibility::groupButtonClicked(), this, &RKSettingsModuleDebug::settingChanged);
 	main_vbox->addWidget (group);
 
 
diff --git a/rkward/settings/rksettingsmodulegeneral.cpp b/rkward/settings/rksettingsmodulegeneral.cpp
index 662babf2..7630b5ba 100644
--- a/rkward/settings/rksettingsmodulegeneral.cpp
+++ b/rkward/settings/rksettingsmodulegeneral.cpp
@@ -22,6 +22,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "../misc/getfilenamewidget.h"
 #include "../misc/rkspinbox.h"
 #include "../misc/rkcommonfunctions.h"
+#include "../misc/rkcompatibility.h"
 #include "../misc/rkstandardicons.h"
 #include "../misc/rkstyle.h"
 
@@ -109,7 +110,7 @@ RKSettingsModuleGeneral::RKSettingsModuleGeneral (RKSettings *gui, QWidget *pare
 	group_layout->addWidget (button);
 	workplace_save_chooser->addButton (button, DontSaveWorkplace);	
 	if ((button = workplace_save_chooser->button (workplace_save_mode))) button->setChecked (true);
-	connect (workplace_save_chooser, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &RKSettingsModuleGeneral::change);
+	connect (workplace_save_chooser, RKCompatibility::groupButtonClicked(), this, &RKSettingsModuleGeneral::change);
 	main_vbox->addWidget (group_box);
 
 	main_vbox->addSpacing (2*RKStyle::spacingHint ());
diff --git a/rkward/settings/rksettingsmodulegraphics.cpp b/rkward/settings/rksettingsmodulegraphics.cpp
index 264bfcf2..b0ba6277 100644
--- a/rkward/settings/rksettingsmodulegraphics.cpp
+++ b/rkward/settings/rksettingsmodulegraphics.cpp
@@ -24,6 +24,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "../rbackend/rkrinterface.h"
 #include "../misc/rkspinbox.h"
 #include "../misc/rkcommonfunctions.h"
+#include "../misc/rkcompatibility.h"
 #include "../misc/rkstandardicons.h"
 #include "../core/robject.h"
 #include "../debug.h"
@@ -68,7 +69,7 @@ RKSettingsModuleGraphics::RKSettingsModuleGraphics (RKSettings *gui, QWidget *pa
 	                                  "<p>The RKWard native device is the recommended choice for most users. This corresponds to the R command <i>RK()</i>.</p>"
 	                                  "<p>The 'Platform default device' corresponds to one of <i>X11()</i>, <i>windows()</i>, or <i>quartz()</i>, depending on the platform.</p>"
 	                                  "<p>You can also specify the name of a function such as <i>cairoDevice</i>.</p>"), group);
-	connect (default_device_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &RKSettingsModuleGraphics::boxChanged);
+	connect (default_device_group, RKCompatibility::groupButtonClicked(), this, &RKSettingsModuleGraphics::boxChanged);
 	connect (default_device_other_edit, &QLineEdit::textChanged, this, &RKSettingsModuleGraphics::boxChanged);
 	h_layout1->addWidget (group);
 
@@ -98,7 +99,7 @@ RKSettingsModuleGraphics::RKSettingsModuleGraphics (RKSettings *gui, QWidget *pa
 	                                  "<li>The original platform specific devices can be used unchanged, without the addition of RKWard specific features.</li></ul>"
 	                                  "<p>Regardless of this setting, the original devices are always accessible as <i>grDevices::X11()</i>, etc.</p>"
 	                                  "<p>Using a device on a platform where it is not defined (e.g. <i>Windows()</i> on Mac OS X) will always fall back to the <i>RK()</i> device.</p>"), group);
-	connect (replace_standard_devices_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &RKSettingsModuleGraphics::boxChanged);
+	connect (replace_standard_devices_group, RKCompatibility::groupButtonClicked(), this, &RKSettingsModuleGraphics::boxChanged);
 	h_layout1->addWidget (group);
 
 	group = new QGroupBox(i18n("Default window size (for RK(), or embedded device windows)"));
diff --git a/rkward/settings/rksettingsmoduleplugins.cpp b/rkward/settings/rksettingsmoduleplugins.cpp
index cda30bfa..c4b95e15 100644
--- a/rkward/settings/rksettingsmoduleplugins.cpp
+++ b/rkward/settings/rksettingsmoduleplugins.cpp
@@ -26,6 +26,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "../misc/rkstyle.h"
 #include "../misc/multistringselector.h"
 #include "../misc/rkcommonfunctions.h"
+#include "../misc/rkcompatibility.h"
 #include "../misc/rkspinbox.h"
 #include "../misc/xmlhelper.h"
 #include "../plugin/rkcomponentmap.h"
@@ -67,7 +68,7 @@ RKSettingsModulePlugins::RKSettingsModulePlugins (RKSettings *gui, QWidget *pare
 	button_group->addButton (button, PreferWizard);
 	if ((button = button_group->button (interface_pref))) button->setChecked (true);
 
-	connect (button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &RKSettingsModulePlugins::settingChanged);
+	connect (button_group, RKCompatibility::groupButtonClicked(), this, &RKSettingsModulePlugins::settingChanged);
 	main_vbox->addWidget (button_box);
 
 	main_vbox->addSpacing (2*RKStyle::spacingHint ());
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index b94df852..40b5a83c 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -44,6 +44,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "../settings/rksettings.h"
 #include "../settings/rksettingsmoduleoutput.h"
 #include "../misc/rkcommonfunctions.h"
+#include "../misc/rkcompatibility.h"
 #include "../misc/rkstandardactions.h"
 #include "../misc/rkstandardicons.h"
 #include "../misc/xmlhelper.h"
@@ -574,7 +575,7 @@ bool RKHTMLWindow::handleRKWardURL (const QUrl &url, RKHTMLWindow *window) {
 			if (path.startsWith ('/')) path = path.mid (1);
 			int sep = path.indexOf ('/');
 			// NOTE: These links may originate externally, even from untrusted sources. The submit mode *must* remain "ManualSubmit" for this reason!
-			RKComponentMap::invokeComponent (path.left (sep), path.mid (sep+1).split ('\n', RKCommonFunctions::SkipEmptyParts()), RKComponentMap::ManualSubmit);
+			RKComponentMap::invokeComponent (path.left (sep), path.mid (sep+1).split ('\n', RKCompatibility::SkipEmptyParts()), RKComponentMap::ManualSubmit);
 		} else if (url.host () == "rhelp") {
 			// TODO: find a nice solution to render this in the current window
 			QStringList spec = url.path ().mid (1).split ('/');
@@ -1352,7 +1353,7 @@ QString RKHelpRenderer::prepareHelpLink (const QString &href, const QString &tex
 QString RKHelpRenderer::componentPathToId (const QString &path) {
 	RK_TRACE (APP);
 
-	QStringList path_segments = path.split ('/', RKCommonFunctions::SkipEmptyParts());
+	QStringList path_segments = path.split ('/', RKCompatibility::SkipEmptyParts());
 	if (path_segments.count () > 2) return 0;
 	if (path_segments.count () < 1) return 0;
 	if (path_segments.count () == 1) path_segments.push_front ("rkward");
diff --git a/rkward/windows/rkwindowcatcher.cpp b/rkward/windows/rkwindowcatcher.cpp
index 0ea14bba..fbc73819 100644
--- a/rkward/windows/rkwindowcatcher.cpp
+++ b/rkward/windows/rkwindowcatcher.cpp
@@ -26,6 +26,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "rkworkplace.h"
 #include "../misc/rkstandardicons.h"
 #include "../misc/rkcommonfunctions.h"
+#include "../misc/rkcompatibility.h"
 #include "../debug.h"
 
 RKWindowCatcher *RKWindowCatcher::_instance = 0;
@@ -345,7 +346,7 @@ void RKCaughtX11Window::doEmbed () {
 
 	// try to be helpful when the window is too large to fit on screen
 	QRect dims = window ()->frameGeometry ();
-	QRect avail = RKCommonFunctions::availableGeometry(window());
+	QRect avail = RKCompatibility::availableGeometry(window());
 	if ((dims.width () > avail.width ()) || (dims.height () > avail.height ())) {
 		KMessageBox::information (this, i18n ("The current window appears too large to fit on the screen. If this happens regularly, you may want to adjust the default graphics window size in Settings->Configure RKWard->Onscreen Graphics."), i18n ("Large window"), "dont_ask_again_large_x11_window");
 	}
diff --git a/rkward/windows/rkworkplace.cpp b/rkward/windows/rkworkplace.cpp
index b008b8e6..adad70c9 100644
--- a/rkward/windows/rkworkplace.cpp
+++ b/rkward/windows/rkworkplace.cpp
@@ -43,7 +43,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "../rbackend/rkrinterface.h"
 #include "../windows/rkwindowcatcher.h"
 #include "../rbackend/rcommand.h"
-#include "../misc/rkcommonfunctions.h"
+#include "../misc/rkcompatibility.h"
 #include "../misc/rkoutputdirectory.h"
 #include "../misc/rkxmlguipreviewarea.h"
 #include "../rkward.h"
@@ -890,7 +890,7 @@ ItemSpecification parseItemDescription (const QString &description) {
 			RK_ASSERT (false);
 			return ret;
 		}
-		ret.params = description.mid (typeend + 2, specstart - typeend - 2).split (':', RKCommonFunctions::SkipEmptyParts());
+		ret.params = description.mid (typeend + 2, specstart - typeend - 2).split (':', RKCompatibility::SkipEmptyParts());
 		ret.specification = description.mid (specstart + 2);
 	} else {
 		ret.specification = description.mid (typeend + 1);


More information about the rkward-tracker mailing list