- Auslisten aller im Projekt definierten Funktionen
- Suche nach toten Funktionen im Projekt - Doppelklick auf Funktion öffnet die Datei mit der Deklaration
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include "LineNumberArea.h"
|
||||
#include "ColorIndicator.h"
|
||||
#include "SignatureHelper.h"
|
||||
#include "FunctionIndex.h"
|
||||
|
||||
#include "core/Settings.h"
|
||||
#include "highlighter/HighlighterFactory.h"
|
||||
@@ -289,6 +290,44 @@ void CodeEditor::paintEvent(QPaintEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void CodeEditor::setFunctionIndex(FunctionIndex *index)
|
||||
{
|
||||
m_functionIndex = index;
|
||||
}
|
||||
|
||||
void CodeEditor::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
// Zuerst normales Verhalten — markiert das Wort unter dem Cursor
|
||||
QPlainTextEdit::mouseDoubleClickEvent(event);
|
||||
|
||||
if (!m_functionIndex || !m_functionIndex->isReady())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Markiertes Wort auslesen
|
||||
const QString word = textCursor().selectedText().trimmed();
|
||||
if (word.isEmpty() || word.contains(' '))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Im Funktionsindex nachschlagen
|
||||
const FunctionScanner::FunctionInfo info = m_functionIndex->lookup(word);
|
||||
if (info.filePath.isEmpty())
|
||||
{
|
||||
return; // Nicht gefunden — normales Verhalten bleibt
|
||||
}
|
||||
|
||||
// Nicht zur eigenen Definition springen wenn wir bereits dort sind
|
||||
if (info.filePath == m_filePath && info.line == textCursor().blockNumber() + 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
emit navigateToRequested(info.filePath, info.line);
|
||||
}
|
||||
|
||||
void CodeEditor::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
// Zuerst prüfen ob ein Farbquadrat geklickt wurde
|
||||
|
||||
Reference in New Issue
Block a user