Fix tooltip closing while mouse moves over item

The itemHovered signal is emitted whenever the mouses moves causing the
tooltip to close.
This commit is contained in:
George Florea Bănuș 2022-04-01 10:12:05 +00:00 committed by Felix Ernst
parent 1041b52c7a
commit 29383426d6

View file

@ -871,7 +871,8 @@ bool KItemListController::hoverMoveEvent(QGraphicsSceneHoverEvent* event, const
newHoveredWidget->setExpansionAreaHovered(true);
} else {
// make sure we unhover the old one first if old!=new
if (auto oldHoveredWidget = hoveredWidget(); oldHoveredWidget && oldHoveredWidget != newHoveredWidget) {
auto oldHoveredWidget = hoveredWidget();
if (oldHoveredWidget && oldHoveredWidget != newHoveredWidget) {
oldHoveredWidget->setHovered(false);
Q_EMIT itemUnhovered(oldHoveredWidget->index());
}
@ -888,9 +889,11 @@ bool KItemListController::hoverMoveEvent(QGraphicsSceneHoverEvent* event, const
// (no-op in this branch for masked hover)
} else {
newHoveredWidget->setHovered(true);
newHoveredWidget->setHoverPosition(mappedPos);
Q_EMIT itemHovered(newHoveredWidget->index());
if (oldHoveredWidget != newHoveredWidget) {
newHoveredWidget->setHovered(true);
Q_EMIT itemHovered(newHoveredWidget->index());
}
}
}
} else {