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 <hjk@qt.io>
This commit is contained in:
Andrii Semkiv
2024-09-27 15:12:13 +02:00
parent 17b1cf0544
commit 5e8285a5dc

View File

@@ -334,8 +334,7 @@ public:
void positionShow(const TextEditorWidget *editorWidget); void positionShow(const TextEditorWidget *editorWidget);
void updateTooltip() { QTimer::singleShot(0, [this] { updateTooltip2(); }); } void updateTooltip();
void updateTooltip2();
void setState(DebuggerTooltipState newState); void setState(DebuggerTooltipState newState);
void destroy() { close(); } 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 // If we are in "Acquired" or "Released", this is an update
// after normal WatchModel update. // after normal WatchModel update.
void DebuggerToolTipWidget::updateTooltip2() void DebuggerToolTipWidget::updateTooltip()
{ {
if (!engine) { if (!engine) {
setState(Released); setState(Released);
@@ -633,12 +632,7 @@ void DebuggerToolTipWidget::updateTooltip2()
// FIXME: The engine should decide on whether it likes // FIXME: The engine should decide on whether it likes
// the context. // the context.
const bool sameFrame = context.matchesFrame(frame) const bool sameFrame = context.matchesFrame(frame) || context.fileName.endsWith(".py");
|| context.fileName.endsWith(".py");
DEBUG("UPDATE TOOLTIP: STATE " << state << context.iname
<< "PINNED: " << widget->isPinned
<< "SHOW NEEDED: " << widget->isPinned
<< "SAME FRAME: " << sameFrame);
if (state == PendingUnshown) { if (state == PendingUnshown) {
setState(PendingShown); setState(PendingShown);
@@ -716,7 +710,7 @@ void DebuggerToolTipWidget::positionShow(const TextEditorWidget *editorWidget)
// << screenPos << te.widget << " visible=" << visible); // << screenPos << te.widget << " visible=" << visible);
if (visible) { if (visible) {
move(screenPos); topLevelWidget()->move(screenPos);
show(); show();
} else { } else {
hide(); hide();