Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-22295

No proper completion of declarations/overrides

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • P2: Important
    • None
    • Qt Creator 4.8.2
    • C/C++/Obj-C++ Support
    • 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: 

      1. Create new Qt Widget Application
      2. Add new C++ class (named Delegate, for example), with Base Class: QObject
      3. In the header file of this class Include QItemDelegate
      4. Change inheritance of this class from QObject to QItemDelegate
      5. 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.

      Attachments

        1. new.jpg
          new.jpg
          56 kB
        2. old.png
          old.png
          17 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kosjar Nikolai Kosjar
            maxxii Maksim Piontkovskiy
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes