Commit 0c62b29f authored by Nikolai Kosjar's avatar Nikolai Kosjar

CppEditor: Fix position of virtual override list

...when using the mouse (Ctrl + Left click).

Task-number: QTCREATORBUG-10479

Change-Id: I54a21c449d8bb8e608d383752beb3b31c9c81783
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 61c0de88
......@@ -560,6 +560,7 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
params.startClass = klass;
params.function = function;
params.snapshot = snapshot;
params.cursorPosition = cursor.position();
params.openInNextSplit = inNextSplit;
if (m_virtualFunctionAssistProvider->configure(params)) {
......
......@@ -113,9 +113,8 @@ public:
: m_params(params)
{}
IAssistProposal *immediateProposal(const TextEditor::IAssistInterface *assistInterface)
IAssistProposal *immediateProposal(const TextEditor::IAssistInterface *)
{
QTC_ASSERT(assistInterface, return 0);
QTC_ASSERT(m_params.function, return 0);
BasicProposalItem *hintItem = new VirtualFunctionProposalItem(CPPEditorWidget::Link());
......@@ -126,14 +125,13 @@ public:
QList<BasicProposalItem *> items;
items << itemFromSymbol(maybeDefinitionFor(m_params.function));
items << hintItem;
return new VirtualFunctionProposal(assistInterface->position(),
return new VirtualFunctionProposal(m_params.cursorPosition,
new BasicProposalItemListModel(items),
m_params.openInNextSplit);
}
IAssistProposal *perform(const IAssistInterface *assistInterface)
IAssistProposal *perform(const IAssistInterface *)
{
QTC_ASSERT(assistInterface, return 0);
QTC_ASSERT(m_params.startClass, return 0);
QTC_ASSERT(m_params.function, return 0);
QTC_ASSERT(!m_params.snapshot.isEmpty(), return 0);
......@@ -148,7 +146,7 @@ public:
items << itemFromSymbol(maybeDefinitionFor(symbol));
items.first()->setOrder(1000); // Ensure top position for function of static type
return new VirtualFunctionProposal(assistInterface->position(),
return new VirtualFunctionProposal(m_params.cursorPosition,
new BasicProposalItemListModel(items),
m_params.openInNextSplit);
}
......
......@@ -46,11 +46,12 @@ public:
VirtualFunctionAssistProvider();
struct Parameters {
Parameters() : startClass(0), function(0), openInNextSplit(false) {}
Parameters() : startClass(0), function(0), cursorPosition(-1), openInNextSplit(false) {}
CPlusPlus::Class *startClass;
CPlusPlus::Function *function;
CPlusPlus::Snapshot snapshot;
int cursorPosition;
bool openInNextSplit;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment