From 8f89afbd549049cefbe8bd32515218145a612b80 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Tue, 14 Oct 2014 18:41:08 +0200 Subject: [PATCH] fixed issue of images imported on document mode with the import button --- src/adaptors/UBImportImage.cpp | 2 +- src/domain/UBGraphicsScene.cpp | 8 ++++++-- src/domain/UBGraphicsScene.h | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/adaptors/UBImportImage.cpp b/src/adaptors/UBImportImage.cpp index 26e9d0bb..b10a1592 100644 --- a/src/adaptors/UBImportImage.cpp +++ b/src/adaptors/UBImportImage.cpp @@ -108,7 +108,7 @@ void UBImportImage::placeImportedItemToScene(UBGraphicsScene* scene, UBGraphicsI { UBGraphicsPixmapItem* pixmapItem = (UBGraphicsPixmapItem*)item; - UBGraphicsPixmapItem* sceneItem = scene->addPixmap(pixmapItem->pixmap(), NULL, QPointF(0, 0)); + UBGraphicsPixmapItem* sceneItem = scene->addPixmap(pixmapItem->pixmap(), NULL, QPointF(0, 0),1.0,false,true); scene->setAsBackgroundObject(sceneItem, true); // Only stored pixmap, should be deleted now diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index e6118a93..66e37abf 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -1245,7 +1245,7 @@ void UBGraphicsScene::clearContent(clearCase pCase) setDocumentUpdated(); } -UBGraphicsPixmapItem* UBGraphicsScene::addPixmap(const QPixmap& pPixmap, QGraphicsItem* replaceFor, const QPointF& pPos, qreal pScaleFactor, bool pUseAnimation) +UBGraphicsPixmapItem* UBGraphicsScene::addPixmap(const QPixmap& pPixmap, QGraphicsItem* replaceFor, const QPointF& pPos, qreal pScaleFactor, bool pUseAnimation, bool useProxyForDocumentPath) { UBGraphicsPixmapItem* pixmapItem = new UBGraphicsPixmapItem(); @@ -1281,7 +1281,11 @@ UBGraphicsPixmapItem* UBGraphicsScene::addPixmap(const QPixmap& pPixmap, QGraphi pixmapItem->show(); setDocumentUpdated(); - QString documentPath = UBApplication::boardController->selectedDocument()->persistencePath(); + QString documentPath; + if(useProxyForDocumentPath) + documentPath = this->document()->persistencePath(); + else + documentPath = UBApplication::boardController->selectedDocument()->persistencePath(); QString fileName = UBPersistenceManager::imageDirectory + "/" + pixmapItem->uuid().toString() + ".png"; diff --git a/src/domain/UBGraphicsScene.h b/src/domain/UBGraphicsScene.h index 3a4590e1..a114d06c 100644 --- a/src/domain/UBGraphicsScene.h +++ b/src/domain/UBGraphicsScene.h @@ -334,7 +334,8 @@ public slots: QGraphicsItem* replaceFor, const QPointF& pPos = QPointF(0,0), qreal scaleFactor = 1.0, - bool pUseAnimation = false); + bool pUseAnimation = false, + bool useProxyForDocumentPath = false); void textUndoCommandAdded(UBGraphicsTextItem *textItem);