Fehle in Tooltip gefixt

This commit is contained in:
2026-09-07 20:16:07 +02:00
parent cee8f57ab7
commit 37b6343506
8 changed files with 44 additions and 5 deletions

View File

@@ -563,6 +563,16 @@ void CodeEditor::keyPressEvent(QKeyEvent *event)
{
const int tabSize = m_settings->tabSize();
// -----------------------------------------------------------------------
// Escape: Signatur-Tooltip sofort schließen (unabhängig vom Cursor-
// Kontext). Das Variablen-Popup behandelt Escape bereits selbst weiter
// unten in m_varCompleter->handleKeyPress().
// -----------------------------------------------------------------------
if (event->key() == Qt::Key_Escape)
{
m_signatureHelper->dismiss();
}
// -----------------------------------------------------------------------
// Shift+Tab: Einrückung zurückziehen
// -----------------------------------------------------------------------
@@ -758,5 +768,6 @@ void CodeEditor::focusOutEvent(QFocusEvent *event)
{
QPlainTextEdit::focusOutEvent(event);
m_varCompleter->notifyFocusLost();
m_signatureHelper->notifyFocusLost();
}

View File

@@ -57,6 +57,23 @@ void SignatureHelper::loadDatabase()
}
}
// ---------------------------------------------------------------------------
// Editor hat den Fokus verloren — Tooltip schließen, damit es nicht
// als verwaistes Fenster über allen Workspaces stehen bleibt.
// ---------------------------------------------------------------------------
void SignatureHelper::notifyFocusLost()
{
m_tooltip->hide();
}
// ---------------------------------------------------------------------------
// Tooltip sofort schließen (z. B. per Escape)
// ---------------------------------------------------------------------------
void SignatureHelper::dismiss()
{
m_tooltip->hide();
}
// ---------------------------------------------------------------------------
// Cursor-Bewegung auswerten
// ---------------------------------------------------------------------------

View File

@@ -24,6 +24,17 @@ class SignatureHelper : public QObject
public:
explicit SignatureHelper(CodeEditor *editor);
// Muss aufgerufen werden, wenn der Editor den Fokus verliert
// (z. B. beim Tab-Wechsel oder wenn eine andere Anwendung/ein anderer
// Workspace aktiviert wird) — schließt ein evtl. offenes Tooltip.
// Ohne diesen Hook kann das Tooltip als "Geisterfenster" über allen
// Workspaces stehen bleiben, siehe Bugreport.
void notifyFocusLost();
// Schließt das Tooltip sofort, unabhängig vom Cursor-Kontext.
// Wird u.a. bei Escape aufgerufen.
void dismiss();
private slots:
void onCursorPositionChanged();