| Summary: | "Create Slot" completion gives invalid code if in same file as class declaration | ||
|---|---|---|---|
| Product: | [Applications] kdevelop | Reporter: | Nicolás Alvarez <nalvarez> |
| Component: | Language Support: CPP (old) | Assignee: | kdevelop-bugs-null |
| Status: | CONFIRMED --- | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | 4.2.3 | ||
| Target Milestone: | --- | ||
| Platform: | Compiled Sources | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
Thank you for the bug report. As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists. If this bug is no longer persisting or relevant please change the status to resolved. This "create slot" feature seems to be missing altogether in the new C++ plugin... |
Test case: class Main: public QObject { Q_OBJECT signals: int mysig(); public slots: int existingSlot(); private: int func() { } }; Inside func, type "connect(this, SIGNAL(mysig()), mynewslot" and invoke completion, which will suggest creating a slot called "mynewslot()". Selecting that option adds the new slot declaration inside the 'public slots' section, below existingSlot, thus moving the func() declaration one line down. KDevelop doesn't handle that line change properly, and func turns into: int func() { SLOT(mynewslot())); connect(this, SIGNAL(mysig()), mynewslot } This problem happens any time the code being completed is in the same file and after the place where the slot declaration is added; not only if func() is being defined inside the class declaration.