[Qt-creator] code completion anomaly
Danny Price
deepblue842 at googlemail.com
Fri Jan 29 14:38:02 CET 2010
On Fri, Jan 29, 2010 at 1:33 PM, Mark Brand <mabrand at mabrand.nl> wrote:
>
> "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.
>
You should write code based on best coding and design practice, not to
adhere to the whims of a particular IDE's syntax completion. Class nesting
is like function nesting in old C - it get's out of control fast. Pmpl is an
exception (and in that case the class is defined within the cpp file
anyway). For most other cases, class friendships are better.
>
> 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
> };
>
>
>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-creator
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-creator-old/attachments/20100129/31ae7746/attachment.html
More information about the Qt-creator-old
mailing list