From b401d4917605af80d421caaa8c6863ee4b498d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fauconnier?= Date: Thu, 31 Mar 2022 14:42:20 +0200 Subject: [PATCH] fixed two issues where actions would not be updated correctly --- src/document/UBDocumentController.cpp | 4 +--- src/document/UBDocumentController.h | 5 +++-- src/gui/UBDocumentThumbnailWidget.cpp | 1 - src/gui/UBThumbnailWidget.cpp | 4 ++-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index 104c1dfd..55d82ce3 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -1592,7 +1592,7 @@ void UBDocumentTreeView::dropEvent(QDropEvent *event) QTreeView::dropEvent(event); - UBApplication::documentController->updateActions(); + UBApplication::documentController->pageSelectionChanged(); } void UBDocumentTreeView::paintEvent(QPaintEvent *event) @@ -2445,8 +2445,6 @@ void UBDocumentController::deleteSelectedItem() } pageSelectionChanged(); - - updateActions(); } void UBDocumentController::deleteMultipleItems(QModelIndexList indexes, UBDocumentTreeModel* docModel) diff --git a/src/document/UBDocumentController.h b/src/document/UBDocumentController.h index 87e7e83a..03c76e92 100644 --- a/src/document/UBDocumentController.h +++ b/src/document/UBDocumentController.h @@ -492,7 +492,6 @@ class UBDocumentController : public UBDocumentContainer void copy(); void paste(); void focusChanged(QWidget *old, QWidget *current); - void updateActions(); void updateExportSubActions(const QModelIndex &selectedIndex); void currentIndexMoved(const QModelIndex &newIndex, const QModelIndex &PreviousIndex); @@ -551,6 +550,8 @@ protected: void TreeViewSelectionChanged(const QModelIndex ¤t, const QModelIndex &previous); void TreeViewSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected); + void pageSelectionChanged(); + private slots: void documentZoomSliderValueChanged (int value); void itemSelectionChanged(LastSelectedElementType newSelection); @@ -558,7 +559,7 @@ protected: void exportDocumentSet(); void thumbnailViewResized(); - void pageSelectionChanged(); + void updateActions(); void documentSceneChanged(UBDocumentProxy* proxy, int pSceneIndex); diff --git a/src/gui/UBDocumentThumbnailWidget.cpp b/src/gui/UBDocumentThumbnailWidget.cpp index a948a9b1..aeb2f473 100644 --- a/src/gui/UBDocumentThumbnailWidget.cpp +++ b/src/gui/UBDocumentThumbnailWidget.cpp @@ -58,7 +58,6 @@ UBDocumentThumbnailWidget::~UBDocumentThumbnailWidget() // NOOP } - void UBDocumentThumbnailWidget::mouseMoveEvent(QMouseEvent *event) { if (!dragEnabled()) diff --git a/src/gui/UBThumbnailWidget.cpp b/src/gui/UBThumbnailWidget.cpp index 7d2304d0..779974bc 100644 --- a/src/gui/UBThumbnailWidget.cpp +++ b/src/gui/UBThumbnailWidget.cpp @@ -315,7 +315,6 @@ void UBThumbnailWidget::mousePressEvent(QMouseEvent *event) } mSelectionSpan = index2 - index1; selectItems(qMin(index1, index2), mSelectionSpan < 0 ? - mSelectionSpan + 1 : mSelectionSpan + 1); - return; } } } @@ -334,8 +333,9 @@ void UBThumbnailWidget::mousePressEvent(QMouseEvent *event) if (!mLastSelectedThumbnail && mGraphicItems.count() > 0) mLastSelectedThumbnail = dynamic_cast(mGraphicItems.at(0)); mSelectionSpan = 0; - return; } + + UBApplication::documentController->pageSelectionChanged(); }