Summary: | Code completion 'implement function' section shows qt signals | ||
---|---|---|---|
Product: | [Applications] kdevelop | Reporter: | Ian H <master.haber> |
Component: | Language Support: CPP (Clang-based) | Assignee: | kdevelop-bugs-null |
Status: | RESOLVED FIXED | ||
Severity: | minor | CC: | igorkuo |
Priority: | NOR | ||
Version First Reported In: | git master | ||
Target Milestone: | --- | ||
Platform: | Appimage | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/kdevelop/kdevelop/-/commit/e44d716a4adec12343dc63e64b3c6e6e2be79244 | Version Fixed In: | 6.3.250800 |
Sentry Crash Report: | |||
Attachments: | sample project |
Have you worked around Bug 499768? Is this bug limited to the AppImage? I haven't encountered such an issue. (In reply to Igor Kushnir from comment #1) > Have you worked around Bug 499768? Is this bug limited to the AppImage? I > haven't encountered such an issue. yes. i worked around it by installing clang 18 on my pc and setting the environment KDEV_CLANG_BUILTIN_DIR to the path. though i cant tell you yet if this bug is specifically the appimage or if it's just the latest nightly in general, as i havent tried to rebuild from source (the reason i'm using the nightly instead is because it's simpler than building from source) (In reply to Ian H from comment #3) > though i cant tell you yet if this bug is specifically the appimage or if > it's just the latest nightly in general, as i havent tried to rebuild from > source (the reason i'm using the nightly instead is because it's simpler > than building from source) I am using almost latest KDevelop, so probably an AppImage bug, maybe even a consequence of the (possibly incomplete) workaround. I also don't recall any recent change that could possibly cause such a bug. alright. i guess it's time for me to bite the bullet again and rebuild from source (yuck) (In reply to Ian H from comment #5) > alright. i guess it's time for me to bite the bullet again and rebuild from > source (yuck) Is KDevelop Flatpak broken too? (In reply to Igor Kushnir from comment #6) > (In reply to Ian H from comment #5) > > alright. i guess it's time for me to bite the bullet again and rebuild from > > source (yuck) > Is KDevelop Flatpak broken too? dont know. i'll try it now and report bugs when i break it. to answer your question, yes. the parsing on the flatpak version is also broken The most likely reason for this bug is that KDevelop does not locate the file it installs (e.g. into /usr/share): kdevclangsupport/wrappedQtHeaders/QtCore/qobjectdefs.h. In this case hovering over a signal or a slot declaration produces a navigation tooltip that does not designate the function as a signal or a slot, and the completion helper does not skip signals when it offers completions. The current implementation in kdevelop/plugins/clang/duchain/parsesession.cpp searches for the directory kdevclangsupport/wrappedQtHeaders in QStandardPaths::GenericDataLocation. If it fails to find the directory or finds an empty directory left over from a previously installed and uninstalled KDevelop version (in a location with a higher priority than the location where the file qobjectdefs.h is currently installed), signal and slot detection does not work. I am in the process of fixing this so that KDevelop searches for the file qobjectdefs.h rather than for the directory, which may be empty. A possibly relevant merge request was started @ https://invent.kde.org/kdevelop/kdevelop/-/merge_requests/771 Git commit e44d716a4adec12343dc63e64b3c6e6e2be79244 by Igor Kushnir. Committed on 15/05/2025 at 09:33. Pushed by igorkushnir into branch 'master'. ParseSessionData: locate an installed file, not directory Uninstalling a program such as KDevelop removes its installed files but not directories. Consider the following scenario: 1) the user installs KDevelop into the prefix /usr/local; 2) the user uninstalls KDevelop; 3) the user installs KDevelop into the prefix /usr. Assuming that /usr/local has a higher priority than /usr, locating the directory "kdevclangsupport/wrappedQtHeaders" in ParseSessionData() produces the path /usr/local/share/kdevclangsupport/wrappedQtHeaders. The file /usr/local/share/kdevclangsupport/wrappedQtHeaders/QtCore/qobjectdefs.h was removed during the uninstallation step, so KDevelop cannot detect signals and slots anymore. Locate the file kdevclangsupport/wrappedQtHeaders/QtCore/qobjectdefs.h instead and truncate last segments of its path to obtain the parent and grandparent directory paths. The empty directories left over from previous KDevelop installations into higher-priority locations are ignored now. A side effect of this commit is that now the path kdevclangsupport/wrappedQtHeaders/QtCore is added before rather than after the path kdevclangsupport/wrappedQtHeaders. This should be fine. FIXED-IN: 6.3.250800 M +11 -8 plugins/clang/duchain/parsesession.cpp https://invent.kde.org/kdevelop/kdevelop/-/commit/e44d716a4adec12343dc63e64b3c6e6e2be79244 |
Created attachment 178190 [details] sample project SUMMARY The code completion (ctrl+space) with regards to using the implement function will show every qt signal that is in the 'signals' section in the code. in some cases this is 50+ signals that always show needing to be implemented (when they shouldn't be) i have attached a small cmake project STEPS TO REPRODUCE 1. Open code completion 2. 'type f' to show foo class implementations OBSERVED RESULT the signal in the foo class will be in the list EXPECTED RESULT signals should not be in the list to implement, as they are not supposed to be implemented outside of moc SOFTWARE/OS VERSIONS Windows: macOS: (available in the Info Center app, or by running `kinfo` in a terminal window) Linux/KDE Plasma: KDE Plasma Version: KDE Frameworks Version: Qt Version: ADDITIONAL INFORMATION