From 767b41f80fde96189234ade6f5efa26c620187da Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 22 Nov 2024 13:36:40 +0100 Subject: [PATCH] Tooltips: Fix widget tool tip positioning on macOS There is a weird behavior of Qt on macOS, that widget tooltips are moved up by 20 pixels when calling show(). This is pretty annoying, because the tooltip gets under the mouse pointer and interrupts user interaction. This only happens if all of - the widget has multiple subwidgets - the layout has size constraint QLayout::SetFixedSize - adjustSize is called are true. Remove the explicit adjustSize, that doesn't seem to make any difference, except for avoiding the issue with show(). Task-number: QTBUG-131479 Change-Id: I2285bf77b0980940b48ac22f931a45b6a73ad06e Reviewed-by: Christian Stenger Reviewed-by: David Schulz --- src/libs/utils/tooltip/tips.cpp | 4 +++- src/plugins/debugger/debuggertooltipmanager.cpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libs/utils/tooltip/tips.cpp b/src/libs/utils/tooltip/tips.cpp index 180b8f960f2..5f0a1ed42d5 100644 --- a/src/libs/utils/tooltip/tips.cpp +++ b/src/libs/utils/tooltip/tips.cpp @@ -5,6 +5,7 @@ #include "tooltip.h" #include "../qtcassert.h" +#include "../hostosinfo.h" #include #include @@ -249,7 +250,8 @@ void WidgetTip::configure(const QPoint &pos) move(pos); m_layout->addWidget(m_widget); m_layout->setSizeConstraint(QLayout::SetFixedSize); - adjustSize(); + if (!HostOsInfo::isMacHost()) // work around QTBUG-131479 + adjustSize(); } void WidgetTip::pinToolTipWidget(QWidget *parent) diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp index bdea5b9f1e6..479b5d11d44 100644 --- a/src/plugins/debugger/debuggertooltipmanager.cpp +++ b/src/plugins/debugger/debuggertooltipmanager.cpp @@ -463,6 +463,7 @@ DebuggerToolTipWidget::DebuggerToolTipWidget(DebuggerEngine *engine, auto mainLayout = new QVBoxLayout(this); mainLayout->setSizeConstraint(QLayout::SetFixedSize); mainLayout->setContentsMargins(0, 0, 0, 0); + mainLayout->setSpacing(0); mainLayout->addWidget(toolBar); mainLayout->addWidget(treeView);