From a41462f34716ae3e14864f13bc8007f44f5227a8 Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Tue, 28 Aug 2012 14:27:00 +0300 Subject: [PATCH] Fixed behavior for Tools and W3C_tools. Fixed creation of transparent drawing view. --- src/board/UBBoardView.cpp | 16 ++++++++++++++-- src/desktop/UBDesktopAnnotationController.cpp | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp index 483e955b..b90869eb 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.cpp @@ -533,7 +533,12 @@ Here we determines cases when items should to get mouse press event at pressing return false; break; + case UBToolWidget::Type: + return true; + case QGraphicsWebView::Type: + return true; + case UBGraphicsWidgetItem::Type: if (currentTool == UBStylusTool::Selector && item->parentItem() && item->parentItem()->isSelected()) return true; @@ -541,10 +546,14 @@ Here we determines cases when items should to get mouse press event at pressing return true; if (currentTool == UBStylusTool::Play) return true; + return false; break; } - return false; + if ((UBGraphicsItemType::UserTypesCount > item->type()) && (item->type() > QGraphicsItem::UserType)) + return true; + else + return false; } bool UBBoardView::itemShouldReceiveSuspendedMousePressEvent(QGraphicsItem *item) @@ -556,9 +565,11 @@ bool UBBoardView::itemShouldReceiveSuspendedMousePressEvent(QGraphicsItem *item) return false; UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController()->stylusTool(); - + switch(item->type()) { + case QGraphicsWebView::Type: + return false; case UBGraphicsPixmapItem::Type: case UBGraphicsTextItem::Type: case UBGraphicsWidgetItem::Type: @@ -1094,6 +1105,7 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event) if (QGraphicsSvgItem::Type != movingItem->type() && UBGraphicsDelegateFrame::Type != movingItem->type() && UBToolWidget::Type != movingItem->type() && + UBGraphicsCache::Type != movingItem->type() && QGraphicsWebView::Type != movingItem->type() && // for W3C widgets as Tools. !(!isMultipleSelectionEnabled() && movingItem->parentItem() && UBGraphicsWidgetItem::Type == movingItem->type() && UBGraphicsGroupContainerItem::Type == movingItem->parentItem()->type())) { diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index 6aaa2812..16b1cf69 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -66,7 +66,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) , mDesktopStylusTool(UBDrawingController::drawingController()->stylusTool()) { - mTransparentDrawingView = new UBBoardView(UBApplication::boardController, NULL, true); // deleted in UBDesktopAnnotationController::destructor + mTransparentDrawingView = new UBBoardView(UBApplication::boardController, static_cast(NULL), true); // deleted in UBDesktopAnnotationController::destructor mTransparentDrawingView->setAttribute(Qt::WA_TranslucentBackground, true); #ifdef Q_WS_MAC