diff --git a/YACReaderLibrary/import_widget.cpp b/YACReaderLibrary/import_widget.cpp index ea86bce0..d9928ac2 100644 --- a/YACReaderLibrary/import_widget.cpp +++ b/YACReaderLibrary/import_widget.cpp @@ -218,14 +218,22 @@ void ImportWidget::newComic(const QString & path, const QString & coverPath) if(previousWidth >= coversView->width()+200 && !updatingCovers) { updatingCovers = true; - QGraphicsItem * last = coversScene->items().last(); - int width = p.width(); - if(previousWidth > 3000) + + foreach(QGraphicsItem * itemToRemove, coversScene->items()) { - coversScene->removeItem(last); - delete last; + QGraphicsPixmapItem * last = dynamic_cast(itemToRemove); + + if((last->pos().x()+last->pixmap().width())<=0) + { + coversScene->removeItem(last); + delete last; + } + else + break; } + int width = p.width(); + foreach(QGraphicsItem * itemToMove, coversScene->items()) { QTimeLine *timer = new QTimeLine(400);