From 5e8285a5dcdee975aa9b3175e8dc6958bcb30dd2 Mon Sep 17 00:00:00 2001 From: Andrii Semkiv Date: Fri, 27 Sep 2024 15:12:13 +0200 Subject: [PATCH] Do not move tooltip widget while in a layout Attempting to move a widget when it is a part of layout has some interesting effects. We should only try to move the tooltip widget when it is on its own. When the tooltip is a part of a `WidgetTip` container, the entire container must be moved instead. Reverted patch #576657 as no longer needed. Fixes: QTCREATORBUG-31250 Change-Id: I448fee4deef532f35ec7159e3284464c3dcb854c Reviewed-by: hjk --- src/plugins/debugger/debuggertooltipmanager.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp index 6f57ff8e286..bdea5b9f1e6 100644 --- a/src/plugins/debugger/debuggertooltipmanager.cpp +++ b/src/plugins/debugger/debuggertooltipmanager.cpp @@ -334,8 +334,7 @@ public: void positionShow(const TextEditorWidget *editorWidget); - void updateTooltip() { QTimer::singleShot(0, [this] { updateTooltip2(); }); } - void updateTooltip2(); + void updateTooltip(); void setState(DebuggerTooltipState newState); void destroy() { close(); } @@ -621,7 +620,7 @@ QDebug operator<<(QDebug d, const DebuggerToolTipContext &c) // If we are in "Acquired" or "Released", this is an update // after normal WatchModel update. -void DebuggerToolTipWidget::updateTooltip2() +void DebuggerToolTipWidget::updateTooltip() { if (!engine) { setState(Released); @@ -633,12 +632,7 @@ void DebuggerToolTipWidget::updateTooltip2() // FIXME: The engine should decide on whether it likes // the context. - const bool sameFrame = context.matchesFrame(frame) - || context.fileName.endsWith(".py"); - DEBUG("UPDATE TOOLTIP: STATE " << state << context.iname - << "PINNED: " << widget->isPinned - << "SHOW NEEDED: " << widget->isPinned - << "SAME FRAME: " << sameFrame); + const bool sameFrame = context.matchesFrame(frame) || context.fileName.endsWith(".py"); if (state == PendingUnshown) { setState(PendingShown); @@ -716,7 +710,7 @@ void DebuggerToolTipWidget::positionShow(const TextEditorWidget *editorWidget) // << screenPos << te.widget << " visible=" << visible); if (visible) { - move(screenPos); + topLevelWidget()->move(screenPos); show(); } else { hide();