[Qt-creator] code completion anomaly

Mark Brand mabrand at mabrand.nl
Fri Jan 29 14:33:03 CET 2010


>     "aaa->" triggers code completion but should not.
>
>     "aaa." should trigger code completion but does not.
>

> Creator seems to have issues with nested classes. It actually used to
> crash in this case but that bug was fixed (once I finally convinced
> Nokia it was a problem...).
>
> My adivce is to not use nested classes.

Some people actually like to use trivial nested classes to aid in code
completion. It can be convenient to type in something like "aaa." and
then quickly choose what you want. Think of it as a namespace within a
class.

Two new discoveries:

1) Code completion is not the only problem.  "Find usages" doesn't work
either.

2) If you separate the member declaration from the nested class
declaration, neither problem occurs. This a good workaround. See example
below:

class MainWindow : public QMainWindow {
    Q_OBJECT
public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    Ui::MainWindow *ui;

    class AAA
    {
    public:
        int a;
        int b;
        int c;
    } aaa;  //code completion and "find usages" don't work

    AAA bbb; //code completion and "find usages" work
};


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-creator-old/attachments/20100129/f1649c9f/attachment.html 


More information about the Qt-creator-old mailing list