82{
83 QWidget *widget = parentWidget();
85
86 const QPoint gpos = widget->mapToGlobal(
pos);
88
89
90
91 resize(size);
92
93
94
95
97
98#ifdef HAVE_QT_PRIVATE_TOOLTIP_POSITION_API
99
100 if (auto waylandWindow = dynamic_cast<QNativeInterface::Private::QWaylandWindow *>(windowHandle()->handle())) {
101
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);
106 } else
107#endif
108
109 {
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());
114
115 int y = gpos.y() + 20;
116 if (y + height > availableRect.bottom()) {
117 y = itemRect.bottom();
118
119 if (y + height > availableRect.bottom()) {
120 y = gpos.y() - 20 - height;
121
122 if (y < availableRect.top()) {
123 y = itemRect.top() - height;
124
125 if (y < availableRect.top()) {
126 y = availableRect.top();
127 }
128 }
129 }
130 }
131
132 int x = gpos.x() + 20;
133 if (x + width > availableRect.right()) {
134 x = itemRect.right();
135
136 if (x + width > availableRect.right()) {
137 x = gpos.x() - 20 - width;
138
139 if (x < availableRect.left()) {
140 x = itemRect.left() - width;
141
142 if (x < availableRect.left()) {
143 x = availableRect.left();
144 }
145 }
146 }
147 }
148
149 move(QPoint(x, y));
150 }
151}
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
int size(const Forest< T > &forest)
QPainterPath create(const char32_t codepoint, double height)
Creates a tofu missing glyph indicator representing the provided Unicode codepoint.