fixed a bug where thumbnail views where not correctly updated/highlighted after a drag and drop

preferencesAboutTextFull
Clément Fauconnier 7 years ago
parent a252b90828
commit 859b52b7a4
  1. 5
      src/board/UBBoardController.cpp
  2. 3
      src/document/UBDocumentContainer.cpp
  3. 1
      src/document/UBDocumentContainer.h
  4. 6
      src/gui/UBBoardThumbnailsView.cpp
  5. 1
      src/gui/UBBoardThumbnailsView.h

@ -1586,7 +1586,6 @@ void UBBoardController::moveSceneToIndex(int source, int target)
{ {
if (selectedDocument()) if (selectedDocument())
{ {
persistCurrentScene(false,true); persistCurrentScene(false,true);
UBDocumentContainer::movePageToIndex(source, target); UBDocumentContainer::movePageToIndex(source, target);
@ -1598,10 +1597,8 @@ void UBBoardController::moveSceneToIndex(int source, int target)
setActiveDocumentScene(target); setActiveDocumentScene(target);
mMovingSceneIndex = -1; mMovingSceneIndex = -1;
//on board thumbnails view
emit moveThumbnailRequired(source, target);
emit activeSceneChanged(); emit activeSceneChanged();
emit updateThumbnailsRequired();
} }
} }

@ -75,7 +75,8 @@ bool UBDocumentContainer::movePageToIndex(int source, int target)
deleteThumbPage(source); deleteThumbPage(source);
insertThumbPage(target); insertThumbPage(target);
emit documentThumbnailsUpdated(this); emit documentThumbnailsUpdated(this);
//on board thumbnails view
emit moveThumbnailRequired(source, target);
return true; return true;
} }

@ -80,6 +80,7 @@ class UBDocumentContainer : public QObject
void addThumbnailRequired(UBDocumentContainer* source, int index); void addThumbnailRequired(UBDocumentContainer* source, int index);
void removeThumbnailRequired(int index); void removeThumbnailRequired(int index);
void moveThumbnailRequired(int from, int to); void moveThumbnailRequired(int from, int to);
void updateThumbnailsRequired();
void documentThumbnailsUpdated(UBDocumentContainer* source); void documentThumbnailsUpdated(UBDocumentContainer* source);
}; };

@ -78,6 +78,7 @@ UBBoardThumbnailsView::UBBoardThumbnailsView(QWidget *parent, const char *name)
connect(UBApplication::boardController, SIGNAL(addThumbnailRequired(UBDocumentContainer*, int)), this, SLOT(addThumbnail(UBDocumentContainer*, int)), Qt::UniqueConnection); connect(UBApplication::boardController, SIGNAL(addThumbnailRequired(UBDocumentContainer*, int)), this, SLOT(addThumbnail(UBDocumentContainer*, int)), Qt::UniqueConnection);
connect(UBApplication::boardController, SIGNAL(moveThumbnailRequired(int, int)), this, SLOT(moveThumbnail(int, int)), Qt::UniqueConnection); connect(UBApplication::boardController, SIGNAL(moveThumbnailRequired(int, int)), this, SLOT(moveThumbnail(int, int)), Qt::UniqueConnection);
connect(this, SIGNAL(moveThumbnailRequired(int, int)), this, SLOT(moveThumbnail(int, int)), Qt::UniqueConnection); connect(this, SIGNAL(moveThumbnailRequired(int, int)), this, SLOT(moveThumbnail(int, int)), Qt::UniqueConnection);
connect(UBApplication::boardController, SIGNAL(updateThumbnailsRequired()), this, SLOT(updateThumbnails()), Qt::UniqueConnection);
connect(UBApplication::boardController, SIGNAL(removeThumbnailRequired(int)), this, SLOT(removeThumbnail(int)), Qt::UniqueConnection); connect(UBApplication::boardController, SIGNAL(removeThumbnailRequired(int)), this, SLOT(removeThumbnail(int)), Qt::UniqueConnection);
connect(&mLongPressTimer, SIGNAL(timeout()), this, SLOT(longPressTimeout()), Qt::UniqueConnection); connect(&mLongPressTimer, SIGNAL(timeout()), this, SLOT(longPressTimeout()), Qt::UniqueConnection);
@ -94,6 +95,11 @@ void UBBoardThumbnailsView::moveThumbnail(int from, int to)
updateThumbnailsPos(); updateThumbnailsPos();
} }
void UBBoardThumbnailsView::updateThumbnails()
{
updateThumbnailsPos();
}
void UBBoardThumbnailsView::removeThumbnail(int i) void UBBoardThumbnailsView::removeThumbnail(int i)
{ {
UBDraggableThumbnailView* item = mThumbnails.at(i); UBDraggableThumbnailView* item = mThumbnails.at(i);

@ -52,6 +52,7 @@ public slots:
void addThumbnail(UBDocumentContainer* source, int i); void addThumbnail(UBDocumentContainer* source, int i);
void moveThumbnail(int from, int to); void moveThumbnail(int from, int to);
void removeThumbnail(int i); void removeThumbnail(int i);
void updateThumbnails();
void longPressTimeout(); void longPressTimeout();
void mousePressAndHoldEvent(QPoint pos); void mousePressAndHoldEvent(QPoint pos);

Loading…
Cancel
Save