forked from qt-creator/qt-creator
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 <christian.stenger@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
#include "tooltip.h"
|
#include "tooltip.h"
|
||||||
|
|
||||||
#include "../qtcassert.h"
|
#include "../qtcassert.h"
|
||||||
|
#include "../hostosinfo.h"
|
||||||
|
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
@@ -249,6 +250,7 @@ void WidgetTip::configure(const QPoint &pos)
|
|||||||
move(pos);
|
move(pos);
|
||||||
m_layout->addWidget(m_widget);
|
m_layout->addWidget(m_widget);
|
||||||
m_layout->setSizeConstraint(QLayout::SetFixedSize);
|
m_layout->setSizeConstraint(QLayout::SetFixedSize);
|
||||||
|
if (!HostOsInfo::isMacHost()) // work around QTBUG-131479
|
||||||
adjustSize();
|
adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -463,6 +463,7 @@ DebuggerToolTipWidget::DebuggerToolTipWidget(DebuggerEngine *engine,
|
|||||||
auto mainLayout = new QVBoxLayout(this);
|
auto mainLayout = new QVBoxLayout(this);
|
||||||
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
|
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
|
||||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
mainLayout->setSpacing(0);
|
||||||
mainLayout->addWidget(toolBar);
|
mainLayout->addWidget(toolBar);
|
||||||
mainLayout->addWidget(treeView);
|
mainLayout->addWidget(treeView);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user