Bug 439337

Summary: clazy-qt6-deprecated-api-fixes creates invalid code
Product: [Developer tools] clazy Reporter: Nicolas Fella <nicolas.fella>
Component: generalAssignee: Jörg Bornemann <joerg.bornemann>
Status: RESOLVED UNMAINTAINED    
Severity: normal CC: alexander.lohnau, smartins
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Nicolas Fella 2021-06-30 14:59:20 UTC
Consider this code:

QDir d;
QFileInfo fi;
d = fi.absolutePath();

clazy warns that setPath() should be used. The fixit results in the following code:

QDir d;
QFileInfo fi;

d.setPath(fi);

which fails to build against Qt 6.1.2:

error: no matching function for call to 'QDir::setPath(QFileInfo&)'
Comment 1 Nicolas Fella 2021-06-30 15:36:13 UTC
Another similar instance of broken code:

diff --git a/core/kdeconnectpluginconfig.cpp b/core/kdeconnectpluginconfig.cpp
index fe48733d..e560c0f8 100644
--- a/core/kdeconnectpluginconfig.cpp
+++ b/core/kdeconnectpluginconfig.cpp
@@ -31,7 +31,7 @@ KdeConnectPluginConfig::KdeConnectPluginConfig()
 KdeConnectPluginConfig::KdeConnectPluginConfig(const QString& deviceId, const QString& pluginName)
     : d(new KdeConnectPluginConfigPrivate())
 {
-    d->m_configDir = KdeConnectConfig::instance().pluginConfigDir(deviceId, pluginName);
+    operator->.setPath(instancedeviceIdpluginName);
     QDir().mkpath(d->m_configDir.path());
 
     d->m_config = new QSettings(d->m_configDir.absoluteFilePath(QStringLiteral("config")), QSettings::IniFormat);
@@ -161,7 +161,7 @@ QString KdeConnectPluginConfig::pluginName()
 
 void KdeConnectPluginConfig::loadConfig()
 {
-    d->m_configDir = KdeConnectConfig::instance().pluginConfigDir(m_deviceId, m_pluginName);
+    operator->.setPath(instance);
     QDir().mkpath(d->m_configDir.path());
 
     d->m_config = new QSettings(d->m_configDir.absoluteFilePath(QStringLiteral("config")), QSettings::IniFormat);
Comment 2 Sergio Martins 2021-07-19 10:57:09 UTC
Joerg , are you still the contact person for the qt6- checks ?
Comment 3 Jörg Bornemann 2021-08-03 07:14:57 UTC
(In reply to Sergio Martins from comment #2)
> Joerg , are you still the contact person for the qt6- checks ?

Yes, it's me or Lucie.
Comment 4 Alexander Lohnau 2025-09-04 17:13:14 UTC
The Qt6 porting checks are deprecated with clazy 1.16