Bug 276794 - "Create Slot" completion gives invalid code if in same file as class declaration
Summary: "Create Slot" completion gives invalid code if in same file as class declaration
Status: CONFIRMED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (other bugs)
Version First Reported In: 4.2.3
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-30 03:19 UTC by Nicolás Alvarez
Modified: 2021-03-17 02:12 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolás Alvarez 2011-06-30 03:19:27 UTC
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.
Comment 1 Justin Zobel 2021-03-09 22:48:38 UTC
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.
Comment 2 Nicolás Alvarez 2021-03-17 02:12:19 UTC
This "create slot" feature seems to be missing altogether in the new C++ plugin...