Details
-
Bug
-
Resolution: Won't Do
-
P2: Important
-
None
-
Qt Creator 4.8.2
-
None
-
Windows 10 x64
Description
(I'm using example from my previously reported bug, just because I can use screenshot from there to demonstrate expected behavior. I tried to reproduce "Spin Box Delegate Example" from standard examples)
Steps to reproduce:
- Create new Qt Widget Application
- Add new C++ class (named Delegate, for example), with Base Class: QObject
- In the header file of this class Include QItemDelegate
- Change inheritance of this class from QObject to QItemDelegate
- In "public:" section start typing "QWidget *createEditor(" – or copy completed version of this string from attached code and try typing next string "void setEditorData("
Expected behavior:
Editor will suggest default parameters, inherited from parent class as auto-completion (see screenshot "old.png")
Actual behavior:
It will ignore inherited parameters from parent class and show regular suggestions as auto-completion (see screenshot "new.jpg")
Code:
#ifndef DELEGATE_H #define DELEGATE_H #include <QObject> #include <QItemDelegate> class Delegate : public QItemDelegate { Q_OBJECT public: explicit Delegate(QObject *parent = nullptr); QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; void setEditorData( signals: public slots: }; #endif // DELEGATE_H
Additional info:
Partly (see update section below) solving by deactivating the Clang Code Model with Help > About Plugins > Clang Code Model
https://forum.qt.io/topic/100762/qt-creator-clang-code-model-problems-collection
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.