43 : QFrame(parent, Qt::FramelessWindowHint | Qt::ToolTip | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint)
48 d->timer.setSingleShot(
true);
49 d->timer.setInterval(10000);
50 connect(&
d->timer, &QTimer::timeout,
this, &KoItemToolTip::hide);
52 d->document.reset(
new QTextDocument(
this));
54 parent->installEventFilter(
this);
83 QWidget *widget = parentWidget();
86 const QPoint gpos = widget->mapToGlobal(
pos);
98#ifdef HAVE_QT_PRIVATE_TOOLTIP_POSITION_API
100 if (
auto waylandWindow =
dynamic_cast<QNativeInterface::Private::QWaylandWindow *
>(windowHandle()->handle())) {
102 const QPoint parentPos = widget->window()->mapFromGlobal(gpos);
103 const QRect gravityRect(parentPos.x() - 20, parentPos.y() - 20, 40, 40);
104 waylandWindow->setParentControlGeometry(gravityRect);
105 waylandWindow->setExtendedWindowType(QNativeInterface::Private::QWaylandWindow::ToolTip);
110 QScreen *screen = widget->screen();
111 const QRect availableRect = screen->availableGeometry();
112 const int width = size.width(), height = size.height();
113 const QRect itemRect(widget->mapToGlobal(option.rect.topLeft()), option.rect.size());
115 int y = gpos.y() + 20;
116 if (y + height > availableRect.bottom()) {
117 y = itemRect.bottom();
119 if (y + height > availableRect.bottom()) {
120 y = gpos.y() - 20 - height;
122 if (y < availableRect.top()) {
123 y = itemRect.top() - height;
125 if (y < availableRect.top()) {
126 y = availableRect.top();
132 int x = gpos.x() + 20;
133 if (x + width > availableRect.right()) {
134 x = itemRect.right();
136 if (x + width > availableRect.right()) {
137 x = gpos.x() - 20 - width;
139 if (x < availableRect.left()) {
140 x = itemRect.left() - width;
142 if (x < availableRect.left()) {
143 x = availableRect.left();