forked from qt-creator/qt-creator
CppTools: Remove processEvents call from follow symbol
processEvents is a bad way of dealing with asynchronous requests. Use QFutureWatcher for that purpose. Change-Id: I3839cb9db80a6d391f6af1178e96986a325b7b99 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -57,7 +57,9 @@ namespace Internal {
|
||||
class ProFileEditorWidget : public TextEditorWidget
|
||||
{
|
||||
protected:
|
||||
virtual Link findLinkAt(const QTextCursor &, bool resolveTarget = true,
|
||||
virtual void findLinkAt(const QTextCursor &,
|
||||
Utils::ProcessLinkCallback &&processLinkCallback,
|
||||
bool resolveTarget = true,
|
||||
bool inNextSplit = false) override;
|
||||
void contextMenuEvent(QContextMenuEvent *) override;
|
||||
};
|
||||
@@ -72,9 +74,10 @@ static bool isValidFileNameChar(const QChar &c)
|
||||
|| c == QLatin1Char('\\');
|
||||
}
|
||||
|
||||
Utils::Link ProFileEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||
bool /*resolveTarget*/,
|
||||
bool /*inNextSplit*/)
|
||||
void ProFileEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||
Utils::ProcessLinkCallback &&processLinkCallback,
|
||||
bool /*resolveTarget*/,
|
||||
bool /*inNextSplit*/)
|
||||
{
|
||||
Link link;
|
||||
|
||||
@@ -86,7 +89,7 @@ Utils::Link ProFileEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||
// check if the current position is commented out
|
||||
const int hashPos = block.indexOf(QLatin1Char('#'));
|
||||
if (hashPos >= 0 && hashPos < positionInBlock)
|
||||
return link;
|
||||
return processLinkCallback(link);
|
||||
|
||||
// find the beginning of a filename
|
||||
QString buffer;
|
||||
@@ -159,7 +162,7 @@ Utils::Link ProFileEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||
}
|
||||
|
||||
if (buffer.isEmpty())
|
||||
return link;
|
||||
return processLinkCallback(link);
|
||||
|
||||
// remove trailing '\' since it can be line continuation char
|
||||
if (buffer.at(buffer.size() - 1) == QLatin1Char('\\')) {
|
||||
@@ -181,13 +184,13 @@ Utils::Link ProFileEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||
if (QFileInfo::exists(subProject))
|
||||
fileName = subProject;
|
||||
else
|
||||
return link;
|
||||
return processLinkCallback(link);
|
||||
}
|
||||
link.targetFileName = QDir::cleanPath(fileName);
|
||||
link.linkTextStart = cursor.position() - positionInBlock + beginPos + 1;
|
||||
link.linkTextEnd = cursor.position() - positionInBlock + endPos;
|
||||
}
|
||||
return link;
|
||||
processLinkCallback(link);
|
||||
}
|
||||
|
||||
void ProFileEditorWidget::contextMenuEvent(QContextMenuEvent *e)
|
||||
|
||||
Reference in New Issue
Block a user