From 1f9a4858e1532df092564a1594422dbf7b509e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fauconnier?= Date: Mon, 20 Nov 2017 15:21:23 +0100 Subject: [PATCH] replaced previous workaround on thumbnail views by a fix --- src/board/UBBoardController.cpp | 5 +---- src/core/UBPersistenceManager.cpp | 3 ++- src/gui/UBBoardThumbnailsView.cpp | 6 ++++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index 53f94efb..78afff8b 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -1592,10 +1592,6 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, if (sceneChange) { - //should not be necessary, but no more time to investigate on it for the moment : - //for some reason, certain thumbnail views are not updating except if we load the document twice.... - //the only workaroud I found for the moment.. - emit initThumbnailsRequired(this); emit activeSceneChanged(); } } @@ -1810,6 +1806,7 @@ void UBBoardController::selectionChanged() { updateActionStates(); emit pageSelectionChanged(activeSceneIndex()); + emit updateThumbnailsRequired(); } diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index e2dc31ea..543853b0 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -179,10 +179,11 @@ void UBPersistenceManager::errorString(QString error) void UBPersistenceManager::onSceneLoaded(QByteArray scene, UBDocumentProxy* proxy, int sceneIndex) { + Q_UNUSED(scene); qDebug() << "scene loaded " << sceneIndex; QTime time; time.start(); - mSceneCache.insert(proxy,sceneIndex,UBSvgSubsetAdaptor::loadScene(proxy,scene)); + mSceneCache.insert(proxy, sceneIndex, loadDocumentScene(proxy, sceneIndex)); qDebug() << "millisecond for sceneCache " << time.elapsed(); } diff --git a/src/gui/UBBoardThumbnailsView.cpp b/src/gui/UBBoardThumbnailsView.cpp index aca126c4..f2e0f23f 100644 --- a/src/gui/UBBoardThumbnailsView.cpp +++ b/src/gui/UBBoardThumbnailsView.cpp @@ -175,6 +175,7 @@ void UBBoardThumbnailsView::updateThumbnailsPos() } scene()->setSceneRect(scene()->itemsBoundingRect()); + update(); } void UBBoardThumbnailsView::resizeEvent(QResizeEvent *event) @@ -312,11 +313,12 @@ void UBBoardThumbnailsView::dropEvent(QDropEvent *event) { Q_UNUSED(event); - UBApplication::boardController->moveSceneToIndex(mDropSource->sceneIndex(), mDropTarget->sceneIndex()); + if (mDropSource->sceneIndex() != mDropTarget->sceneIndex()) + UBApplication::boardController->moveSceneToIndex(mDropSource->sceneIndex(), mDropTarget->sceneIndex()); mDropSource = NULL; mDropTarget = NULL; mDropBar->hide(); - update(); + updateThumbnailsPos(); }