fixed an issue where mSelectedThumbnail could become inconsistent + fixed an issue where a blank page would be added while importing the same document again and again

preferencesAboutTextFull
Clément Fauconnier 3 years ago
parent e45255efc3
commit 6504c42e75
  1. 5
      src/core/UBPersistenceManager.cpp
  2. 1
      src/document/UBDocumentContainer.cpp
  3. 13
      src/document/UBDocumentController.cpp
  4. 4
      src/gui/UBDocumentNavigator.cpp

@ -238,7 +238,10 @@ QDialog::DialogCode UBPersistenceManager::processInteractiveReplacementDialog(UB
if (mDocumentTreeStructureModel->currentIndex() == replaceIndex) if (mDocumentTreeStructureModel->currentIndex() == replaceIndex)
{ {
UBApplication::documentController->selectDocument(pProxy, true, true); if (pProxy->pageCount() > 0)
{
UBApplication::documentController->selectDocument(pProxy, true, true);
}
} }
if (replaceProxy) { if (replaceProxy) {

@ -49,7 +49,6 @@ void UBDocumentContainer::setDocument(UBDocumentProxy* document, bool forceReloa
{ {
mCurrentDocument = document; mCurrentDocument = document;
//qDebug() << documentThumbs();
clearThumbPage(); clearThumbPage();
reloadThumbnails(); reloadThumbnails();
emit documentSet(mCurrentDocument); emit documentSet(mCurrentDocument);

@ -1854,12 +1854,15 @@ void UBDocumentController::selectDocument(UBDocumentProxy* proxy, bool setAsCurr
if (setAsCurrentDocument) { if (setAsCurrentDocument) {
UBPersistenceManager::persistenceManager()->mDocumentTreeStructureModel->setCurrentDocument(proxy); UBPersistenceManager::persistenceManager()->mDocumentTreeStructureModel->setCurrentDocument(proxy);
QModelIndex indexCurrentDoc = UBPersistenceManager::persistenceManager()->mDocumentTreeStructureModel->indexForProxy(proxy); QModelIndex indexCurrentDoc = UBPersistenceManager::persistenceManager()->mDocumentTreeStructureModel->indexForProxy(proxy);
mDocumentUI->documentTreeView->setSelectedAndExpanded(indexCurrentDoc, true, editMode); if (indexCurrentDoc.isValid())
if (proxy != mBoardController->selectedDocument()) // only if wanted Document is different from document actually on Board, // ALTI/AOU - 20140217
{ {
//issue 1629 - NNE - 20131105 : When set a current document, change in the board controller mDocumentUI->documentTreeView->setSelectedAndExpanded(indexCurrentDoc, true, editMode);
mBoardController->setActiveDocumentScene(proxy, 0, true, onImport);
if (proxy != mBoardController->selectedDocument()) // only if wanted Document is different from document actually on Board, // ALTI/AOU - 20140217
{
//issue 1629 - NNE - 20131105 : When set a current document, change in the board controller
mBoardController->setActiveDocumentScene(proxy, 0, true, onImport);
}
} }
} }

@ -224,6 +224,8 @@ void UBDocumentNavigator::updateSpecificThumbnail(int iPage)
mThumbsWithLabels[iPage].setThumbnail(newItem); mThumbsWithLabels[iPage].setThumbnail(newItem);
if (mLastClickedThumbnail == oldItem) if (mLastClickedThumbnail == oldItem)
mLastClickedThumbnail = newItem; mLastClickedThumbnail = newItem;
if (mSelectedThumbnail == oldItem)
mSelectedThumbnail = newItem;
delete oldItem; delete oldItem;
oldItem = NULL; oldItem = NULL;
} }
@ -317,7 +319,7 @@ void UBDocumentNavigator::resizeEvent(QResizeEvent *event)
mThumbnailWidth = (width() > mThumbnailMinWidth) ? width() - 2*border() : mThumbnailMinWidth; mThumbnailWidth = (width() > mThumbnailMinWidth) ? width() - 2*border() : mThumbnailMinWidth;
if(mSelectedThumbnail) if(mSelectedThumbnail)
ensureVisible(mSelectedThumbnail); ensureVisible(mSelectedThumbnail);
// Refresh the scene // Refresh the scene
refreshScene(); refreshScene();

Loading…
Cancel
Save