From 55a4b8601a40e206027df6093d8e5a4397140242 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Wed, 26 Mar 2014 18:28:00 +0100 Subject: [PATCH] fixed issue with copying a text --- src/board/UBBoardController.cpp | 4 ++-- src/document/UBDocumentController.cpp | 11 ++++++++--- src/domain/UBGraphicsScene.cpp | 7 +++++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index df22942b..1ea8c1e0 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -2369,10 +2369,10 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint if(qsTmp.startsWith("http")) downloadURL(QUrl(qsTmp), QString(), pPos); else{ - if(mActiveScene->selectedItems().at(0)->type() == UBGraphicsItemType::TextItemType) + if(mActiveScene->selectedItems().count() && mActiveScene->selectedItems().at(0)->type() == UBGraphicsItemType::TextItemType) dynamic_cast(mActiveScene->selectedItems().at(0))->setHtml(pMimeData->text()); else - mActiveScene->addTextHtml(pMimeData->text(), pPos); + mActiveScene->addTextHtml("", pPos)->setHtml(pMimeData->text()); } } else{ diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index ac8ee046..94ec0188 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -190,15 +190,21 @@ void UBDocumentController::selectDocument(UBDocumentProxy* proxy, bool setAsCurr } +bool bullshitcode = true; + void UBDocumentController::createNewDocumentGroup() { + if(bullshitcode){ + mDocumentUI->documentTreeWidget->selectedItems().at(0)->setSelected(false); + mDocumentUI->documentTreeWidget->topLevelItem(0)->setSelected(true); + } + UBDocumentGroupTreeItem* docGroupItem = new UBDocumentGroupTreeItem(0); // deleted by the tree widget int i = 1; QString newFolderName = tr("New Folder"); while (allGroupNames().contains(newFolderName)) - { newFolderName = tr("New Folder") + " " + QVariant(i++).toString(); - } + docGroupItem->setGroupName(newFolderName); int trashIndex = mDocumentUI->documentTreeWidget->indexOfTopLevelItem(mTrashTi); @@ -210,7 +216,6 @@ void UBDocumentController::createNewDocumentGroup() mDocumentUI->documentTreeWidget->insertTopLevelItem(trashIndex, docGroupItem); else selected->addChild(docGroupItem); - parentGroupName = docGroupItem->buildEntirePath(); mMapOfPaths.insert(parentGroupName,docGroupItem); diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 0c4f3a65..f7205a6e 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -665,6 +665,13 @@ void UBGraphicsScene::DisposeMagnifierQWidgets() magniferControlViewWidget = NULL; } + if(magniferDisplayViewWidget) + { + magniferDisplayViewWidget->hide(); + magniferDisplayViewWidget->setParent(0); + delete magniferDisplayViewWidget; + magniferDisplayViewWidget = NULL; + } // some time have crash here on access to app (when call from destructor when close OpenBoard app) // so i just add try/catch section here try