forked from qt-creator/qt-creator
C++: Show virtual functions menu only if resolving was requested
That is, if the user does Ctrl+LeftClick or (Ctrl+E,) F2, but not on hover. The described bug in the report occurred because we immediately jump to an item if there is only one, e.g. in case of no overrides. That could also happen on hover, which lead to the undesired effect. Change-Id: I79f6fa1f90d37ea209da022d55d48aab2c13c21a Task-number: QTCREATORBUG-12986 Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -669,33 +669,33 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
|
||||
if (Symbol *symbol = result.declaration()) {
|
||||
Symbol *def = 0;
|
||||
|
||||
// Consider to show a pop-up displaying overrides for the function
|
||||
Function *function = symbol->type()->asFunctionType();
|
||||
VirtualFunctionHelper helper(*typeOfExpression, scope, doc, snapshot, symbolFinder);
|
||||
if (resolveTarget) {
|
||||
// Consider to show a pop-up displaying overrides for the function
|
||||
Function *function = symbol->type()->asFunctionType();
|
||||
VirtualFunctionHelper helper(*typeOfExpression, scope, doc, snapshot, symbolFinder);
|
||||
|
||||
if (helper.canLookupVirtualFunctionOverrides(function)) {
|
||||
VirtualFunctionAssistProvider::Parameters params;
|
||||
params.function = function;
|
||||
params.staticClass = helper.staticClassOfFunctionCallExpression();
|
||||
params.typeOfExpression = typeOfExpression;
|
||||
params.snapshot = snapshot;
|
||||
params.cursorPosition = cursor.position();
|
||||
params.openInNextSplit = inNextSplit;
|
||||
if (helper.canLookupVirtualFunctionOverrides(function)) {
|
||||
VirtualFunctionAssistProvider::Parameters params;
|
||||
params.function = function;
|
||||
params.staticClass = helper.staticClassOfFunctionCallExpression();
|
||||
params.typeOfExpression = typeOfExpression;
|
||||
params.snapshot = snapshot;
|
||||
params.cursorPosition = cursor.position();
|
||||
params.openInNextSplit = inNextSplit;
|
||||
|
||||
if (m_virtualFunctionAssistProvider->configure(params)) {
|
||||
m_widget->invokeAssist(TextEditor::FollowSymbol,
|
||||
m_virtualFunctionAssistProvider);
|
||||
m_virtualFunctionAssistProvider->clearParams();
|
||||
if (m_virtualFunctionAssistProvider->configure(params)) {
|
||||
m_widget->invokeAssist(TextEditor::FollowSymbol,
|
||||
m_virtualFunctionAssistProvider);
|
||||
m_virtualFunctionAssistProvider->clearParams();
|
||||
}
|
||||
|
||||
// Ensure a valid link text, so the symbol name will be underlined on Ctrl+Hover.
|
||||
Link link;
|
||||
link.linkTextStart = beginOfToken;
|
||||
link.linkTextEnd = endOfToken;
|
||||
return link;
|
||||
}
|
||||
|
||||
// Ensure a valid link text, so the symbol name will be underlined on Ctrl+Hover.
|
||||
Link link;
|
||||
link.linkTextStart = beginOfToken;
|
||||
link.linkTextEnd = endOfToken;
|
||||
return link;
|
||||
}
|
||||
|
||||
if (resolveTarget) {
|
||||
Symbol *lastVisibleSymbol = doc->lastVisibleSymbolAt(line, column);
|
||||
|
||||
def = findDefinition(symbol, snapshot, symbolFinder);
|
||||
|
||||
Reference in New Issue
Block a user