From 63d9129dccc1e6ed7248f9d0d365967a04f0d5e9 Mon Sep 17 00:00:00 2001 From: luisangelsm Date: Mon, 9 Feb 2026 18:59:17 +0100 Subject: [PATCH] Fix YACReaderLibraryListWidget::mousePressEvent --- custom_widgets/yacreader_library_list_widget.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/custom_widgets/yacreader_library_list_widget.cpp b/custom_widgets/yacreader_library_list_widget.cpp index 5084024d..679024bf 100644 --- a/custom_widgets/yacreader_library_list_widget.cpp +++ b/custom_widgets/yacreader_library_list_widget.cpp @@ -75,9 +75,12 @@ void YACReaderLibraryListWidget::removeItem(int index) void YACReaderLibraryListWidget::mousePressEvent(QMouseEvent *event) { if (librariesList.count() > 0) { - int h = librariesList.at(0)->height(); - int item = event->pos().y() / h; - if (item != currentLibraryIndex) { + QWidget *child = childAt(event->pos()); + while (child && child->parentWidget() != this) { + child = child->parentWidget(); + } + int item = librariesList.indexOf(qobject_cast(child)); + if (item != -1 && item != currentLibraryIndex) { setCurrentIndex(item); } }