Autocompletion doesn't suggest function parameters inherited from parent class



  • I reported this as a bug here, but now I began to doubt, if I am doing everything properly.
    Detailed description of this behavior is by the link above on Qt bugtracker, but to be short: when I'm trying to declare function in my class with the same name as the function in inherited class, I'm expecting editor to suggest (to autocomplete) same parameters as function in parent class have. This is how it was in some previous version of Qt:

    0_1555178123049_old.png

    And this is how it is in current version:

    0_1555178152444_new.jpg

    I am not very experienced in C++/Qt, and maybe this way of doing things is deprecated or something like that, and in current version of Qt I should do it differently. I just wanted to be sure it's a bug, and not me doing it incorrectly.


  • Lifetime Qt Champion

    Hi
    They changed the autocompletion feature and as a result its a bit different from older Creators.
    Did you try to disable the code model plugin and see if that makes a difference?

    https://forum.qt.io/topic/100762/qt-creator-clang-code-model-problems-collection



  • Yes, it is working as expected with that plugin turned off. I will leave a comment in that topic about this behaviour. Thank you!



  • I found some more things about this bug and added it in "update" section in my bug report, but for reference, in case somebody else will be interested in this in future, I will leave it here as well:

    Update: just noticed, that editor doesn't autocomplete even the name of the function (setEditorData), so that could be the reason.

    Also, with Clang Code Model turned off, when it autocompletes the name of the function (setEditorData), it automatically inserts parenthesis semicolon, but NOT autocomplete parameters. But if you delete this auto-inserted symbols - (); - and type parenthesis by yourself - only then editor will suggest auto-completion for parameters.

    Also, I found a proper way when everything works as expected (auto-completing name of the function and auto-inserting parameters even without disabling Clang Code Model) - use full name for the function, with the name of the class, like this - Delegate::setEditorData.

    But I suppose it should work even without it, because standard included example "Spin Box Delegate Example" isn't using full name for the function declaration, and, as it shown in attached screenshot - it used to work before.


Log in to reply