In class MyClass there is... Declaration (header file): QString getText( QWidget *pParent, const QString &sInInitText, bool &bParam, const QString &sInLabel = QString::null, unsigned int par = 2, const QString &sInWndTitle = QString::null ); Definition (cpp file): QString MyClass::getText( QWidget *pParent, const QString &sInInitText, bool &bParam, const QString &sInLabel, unsigned int par, const QString &sInWndTitle ) { ... } Being in cpp file try to remove "unsigned" from "par" argument (second counting from end). Choose "Update declaration signature" (pressing Alt+1) on "Adapt signature" helper window. Reproducible: Always Actual Results: QString getText(QWidget *pParent, GetTextMode getMode, const QString &sInInitText, bool &bParam, const QString &sInLabel, int par, const QString &sInWndTitle = QString::null); As you can see disappeared default values from second and third arguments (counting from end) Expected Results: QString getText( QWidget *pParent, GetTextMode getMode, const QString &sInInitText, bool &bParam, const QString &sInLabel = QString::null, int par = 2, const QString &sInWndTitle = QString::null ); Removing both default values could make sense if I would have "par" argument as const and I would removed "const". Then get getting invalid initialization from compile. Or if I would change the type of second (counting from end) argument.
kdevelop and kdevplatform cloned at 30.11.2015
I've seen this myself and it's due to missing API in libclang, we'll have to tokenize probably to find the default arguments and insert them manually. Also, we should add proper API upstream to leverage it in the future for this use-case.
Git commit ba2ecbaeba206644c1134569e6da40047096487a by Milian Wolff. Committed on 04/12/2015 at 17:06. Pushed by mwolff into branch '5.0'. Keep default arguments when adapting signature from definition side. Simplify the code, fix the bug, and also keep default arguments when we prepend an argument. In such cases, default-initialize the new arg with `= {} /* TODO */`. FIXED-IN: 5.0.0 M +11 -6 languages/clang/codegen/adaptsignatureassistant.cpp M +26 -0 languages/clang/tests/test_assistants.cpp http://commits.kde.org/kdevelop/ba2ecbaeba206644c1134569e6da40047096487a