[education/rkward/kf5] /: Fix some warnings

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


Git commit 08875b12af123cd19df9cefbd62ce6c0a07d26af by Thomas Friedrichsmeier.
Committed on 04/04/2024 at 22:09.
Pushed by tfry into branch 'kf5'.

Fix some warnings

M  +1    -1    CMakeLists.txt
M  +11   -11   rkward/plugin/rkcomponentproperties.cpp
M  +2    -3    rkward/windows/rkcommandeditorwindow.cpp

https://invent.kde.org/education/rkward/-/commit/08875b12af123cd19df9cefbd62ce6c0a07d26af

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2e8012bbb..b790c50ea 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,7 +35,7 @@ ENDIF(FORCE_PRETTY_MAKEFILE)
 
 ADD_DEFINITIONS(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
 
-remove_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_NO_FOREACH) # TODO remove to compley to KDECompilerSettings
+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/plugin/rkcomponentproperties.cpp b/rkward/plugin/rkcomponentproperties.cpp
index 47543eb6a..1f53e62a9 100644
--- a/rkward/plugin/rkcomponentproperties.cpp
+++ b/rkward/plugin/rkcomponentproperties.cpp
@@ -267,7 +267,7 @@ void RKComponentPropertyStringList::setValueAt (int index, const QString& value)
 
 void RKComponentPropertyStringList::governorValueChanged (RKComponentPropertyBase *property) {
 	QVariant value = property->value (governor_modifier);
-	if (value.type () == QVariant::StringList) {
+	if (value.metaType() == QMetaType(QMetaType::QStringList)) {
 		setValueList (value.toStringList ());
 	} else {
 		setValue (value.toString ());
@@ -367,10 +367,10 @@ bool RKComponentPropertyBool::stringToBool (const QString &value, bool *ok) {
 }
 
 bool RKComponentPropertyBool::variantToBool (const QVariant &value, bool *ok) {
-	if (value.type () == QVariant::Bool) {
+	if (value.metaType() == QMetaType(QMetaType::Bool)) {
 		if (ok) *ok = true;
-		return value.toBool ();
-	} else if (value.canConvert (QVariant::Int)) {
+		return value.toBool();
+	} else if (value.canConvert(QMetaType(QMetaType::Int))) {
 		bool valid;
 		bool ret = (bool) value.toInt (&valid);
 		if (valid) {
@@ -444,12 +444,12 @@ void RKComponentPropertyBool::governorValueChanged (RKComponentPropertyBase *pro
 	RK_TRACE (PLUGIN);
 
 	QVariant value = property->value (governor_modifier);
-	if (value.type () == QVariant::String) {	// Qt's conversion from string to bool does not meet our needs
-		internalSetValue (value.toString ());
-	} else if (value.canConvert (QVariant::Bool)) {
-		internalSetValue (value.toBool ());
+	if (value.metaType() == QMetaType(QMetaType::QString)) {	// Qt's conversion from string to bool does not meet our needs
+		internalSetValue (value.toString());
+	} else if (value.canConvert(QMetaType(QMetaType::Bool))) {
+		internalSetValue(value.toBool());
 	} 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 ());
+		internalSetValue(value.toString());
 	}
 	Q_EMIT valueChanged(this);
 }
@@ -1109,8 +1109,8 @@ void RKComponentPropertyRObjects::governorValueChanged (RKComponentPropertyBase
 		setObjectList (static_cast <RKComponentPropertyRObjects *> (property)->objectList ());
 	} else {
 		QVariant value = property->value ();
-		if (value.type () == QVariant::StringList) {
-			setValueList (value.toStringList ());
+		if (value.metaType() == QMetaType(QMetaType::QStringList)) {
+			setValueList (value.toStringList());
 		} else {
 			setValue (value.toString ());
 		}
diff --git a/rkward/windows/rkcommandeditorwindow.cpp b/rkward/windows/rkcommandeditorwindow.cpp
index 6dd5d1ecb..3924d6de2 100644
--- a/rkward/windows/rkcommandeditorwindow.cpp
+++ b/rkward/windows/rkcommandeditorwindow.cpp
@@ -205,8 +205,7 @@ RKCommandEditorWindow::RKCommandEditorWindow (QWidget *parent, const QUrl &_url,
 	initializeActions (part->actionCollection ());
 	// The kate part is quite a beast to embed, when it comes to shortcuts. New ones get added, conflicting with ours.
 	// In this context we show no mercy, and rip out any conflicting shortcuts.
-	auto kate_acs = m_view->findChildren<KActionCollection*>();
-	kate_acs.append(m_view->actionCollection());
+	const auto kate_acs = m_view->findChildren<KActionCollection*>() << m_view->actionCollection();
 	QList<KActionCollection*> own_acs;
 	own_acs.append(part->actionCollection());
 	own_acs.append(standardActionCollection());
@@ -216,7 +215,7 @@ RKCommandEditorWindow::RKCommandEditorWindow (QWidget *parent, const QUrl &_url,
 		for (const auto own_action : own_actions) {
 			const auto own_scs = ac->defaultShortcuts(own_action);
 			for (const auto &own_sc : own_scs) {
-				for (const auto kate_ac : qAsConst(kate_acs)) {
+				for (const auto kate_ac : kate_acs) {
 					const auto kate_actions = kate_ac->actions();
 					for (auto kate_action : kate_actions) {
 						auto action_shortcuts = kate_ac->defaultShortcuts(kate_action);



More information about the rkward-tracker mailing list