X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/70bd78c829299f2f0b7b6fec02495985443b917c..b5432d60372e2dad6d31cd4e6d28e4da5d47a7e4:/src/tooltipmanager.cpp diff --git a/src/tooltipmanager.cpp b/src/tooltipmanager.cpp index c8b915195..ad1dbe5d3 100644 --- a/src/tooltipmanager.cpp +++ b/src/tooltipmanager.cpp @@ -221,20 +221,18 @@ void ToolTipManager::showToolTip(KToolTipItem* tip) return; } - int x = 0; - if (hasRoomToLeft || hasRoomToRight) { - x = hasRoomToRight ? m_itemRect.right() : m_itemRect.left() - size.width(); - } else { - // Put the tooltip at the far right of the screen. The item will be overlapped - // horizontally, but the y-coordinate will be adjusted afterwards so that no overlapping - // occurs vertically. - x = desktop.right() - size.width(); - } - + int x = 0; int y = 0; if (hasRoomBelow || hasRoomAbove) { + x = QCursor::pos().x() + 16; // TODO: use mouse pointer width instead of the magic value of 16 + if (x + size.width() >= desktop.right()) { + x = desktop.right() - size.width(); + } y = hasRoomBelow ? m_itemRect.bottom() : m_itemRect.top() - size.height(); } else { + Q_ASSERT(hasRoomToLeft || hasRoomToRight); + x = hasRoomToRight ? m_itemRect.right() : m_itemRect.left() - size.width(); + // Put the tooltip at the bottom of the screen. The x-coordinate has already // been adjusted, so that no overlapping with m_itemRect occurs. y = desktop.bottom() - size.height();