Files
qt-creator/src/plugins/clangcodemodel/clangfunctionhintmodel.h
Nikolai Kosjar b4e2ab36a7 Clang: Remember selected function signature hint
...when typing more arguments:

    struct Foo {};
    void f(int, int);
    void f(Foo, Foo);
    void f(char, char);

    void c()
    {
        f( // 1. Trigger completion with Ctrl+Space
           // 2. Chose item "f(Foo, Foo)"
           // 3. Type: Foo(),
           // OK, signature hint "f(Foo, Foo)" is displayed again
    }

FunctionHintProposalWidget and IFunctionHintProposalModel are
instantiated for each calculation, so remember the selected hint in the
CodeAssist. Keep the latest 20 entries.

Task-number: QTCREATORBUG-11688
Change-Id: I579fc6d8a35dd8fa398e4b3170ddc05a85252d1a
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-08 13:29:20 +00:00

53 lines
1.8 KiB
C++

/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <codecompletion.h>
#include <texteditor/codeassist/ifunctionhintproposalmodel.h>
namespace ClangCodeModel {
namespace Internal {
class ClangFunctionHintModel : public TextEditor::IFunctionHintProposalModel
{
public:
ClangFunctionHintModel(const ClangBackEnd::CodeCompletions &functionSymbols);
void reset() override;
int size() const override;
QString text(int index) const override;
QString id(int index) const override;
int activeArgument(const QString &prefix) const override;
private:
ClangBackEnd::CodeCompletions m_functionSymbols;
mutable int m_currentArgument;
};
} // namespace Internal
} // namespace ClangCodeModel