Bug 439337 - clazy-qt6-deprecated-api-fixes creates invalid code
Summary: clazy-qt6-deprecated-api-fixes creates invalid code
Status: REPORTED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Jörg Bornemann
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-30 14:59 UTC by Nicolas Fella
Modified: 2021-08-03 07:14 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.