From bc3921ebdde124734a7dda9214385a9f9a737abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fauconnier?= Date: Tue, 29 Mar 2022 17:29:46 +0200 Subject: [PATCH] fixed some issues introduced with last commit on selection --- src/document/UBDocumentController.cpp | 10 ++++++++-- src/document/UBDocumentController.h | 2 ++ src/gui/UBThumbnailWidget.cpp | 5 +++++ src/gui/UBThumbnailWidget.h | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index 8578e04f..90900113 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -1401,7 +1401,6 @@ void UBDocumentTreeView::hSliderRangeChanged(int min, int max) void UBDocumentTreeView::mousePressEvent(QMouseEvent *event) { QTreeView::mousePressEvent(event); - UBApplication::documentController->updateActions(); } void UBDocumentTreeView::dragEnterEvent(QDragEnterEvent *event) @@ -1942,9 +1941,11 @@ void UBDocumentController::TreeViewSelectionChanged(const QModelIndex ¤t, //We have just to pass a null proxy to disable the display of thumbnail UBDocumentProxy *currentDocumentProxy = 0; - if(current_index.isValid() && mDocumentUI->documentTreeView->selectionModel()->selectedRows(0).size() == 1){ + if(current_index.isValid() && mDocumentUI->documentTreeView->selectionModel()->selectedRows(0).size() == 1) + { currentDocumentProxy = docModel->proxyData(current_index); setDocument(currentDocumentProxy, false); + clearThumbnailsSelection(); } //N/C - NNE - 20140414 : END @@ -3907,3 +3908,8 @@ void UBDocumentController::expandAll() mDocumentUI->documentTreeView->setAnimated(true); } + +void UBDocumentController::clearThumbnailsSelection() +{ + mDocumentUI->thumbnailWidget->clearSelection(); +} diff --git a/src/document/UBDocumentController.h b/src/document/UBDocumentController.h index 3b634175..87e7e83a 100644 --- a/src/document/UBDocumentController.h +++ b/src/document/UBDocumentController.h @@ -458,6 +458,8 @@ class UBDocumentController : public UBDocumentContainer QModelIndex findNextSiblingNotSelected(const QModelIndex &index, QItemSelectionModel *selectionModel); bool parentIsSelected(const QModelIndex& child, QItemSelectionModel *selectionModel); + void clearThumbnailsSelection(); + signals: void exportDone(); void reorderDocumentsRequested(); diff --git a/src/gui/UBThumbnailWidget.cpp b/src/gui/UBThumbnailWidget.cpp index abb217e2..7d2304d0 100644 --- a/src/gui/UBThumbnailWidget.cpp +++ b/src/gui/UBThumbnailWidget.cpp @@ -232,6 +232,11 @@ QList UBThumbnailWidget::selectedItems() return sortedSelectedItems; } +void UBThumbnailWidget::clearSelection() +{ + mThumbnailsScene.clearSelection(); +} + void UBThumbnailWidget::mousePressEvent(QMouseEvent *event) { diff --git a/src/gui/UBThumbnailWidget.h b/src/gui/UBThumbnailWidget.h index 527b9cc2..9b1a3cbb 100644 --- a/src/gui/UBThumbnailWidget.h +++ b/src/gui/UBThumbnailWidget.h @@ -66,6 +66,7 @@ class UBThumbnailWidget : public QGraphicsView QList selectedItems(); void selectItemAt(int pIndex, bool extend = false); void unselectItemAt(int pIndex); + void clearSelection(); qreal thumbnailWidth() {