Commit 4c36ef93 authored by Aleksei Kanash's avatar Aleksei Kanash

Transparent drawing view is separated as DesktopView and doesn't manages...

Transparent drawing view is separated as DesktopView and doesn't manages strokes selections and movements.
parent b574c5b1
...@@ -169,7 +169,7 @@ void UBBoardController::setupViews() ...@@ -169,7 +169,7 @@ void UBBoardController::setupViews()
mControlLayout = new QHBoxLayout(mControlContainer); mControlLayout = new QHBoxLayout(mControlContainer);
mControlLayout->setContentsMargins(0, 0, 0, 0); mControlLayout->setContentsMargins(0, 0, 0, 0);
mControlView = new UBBoardView(this, mControlContainer, true); mControlView = new UBBoardView(this, mControlContainer, true, false);
mControlView->setInteractive(true); mControlView->setInteractive(true);
mControlView->setMouseTracking(true); mControlView->setMouseTracking(true);
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
#include "core/memcheck.h" #include "core/memcheck.h"
UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent, bool pIsControl) UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent, bool isControl, bool isDesktop)
: QGraphicsView (pParent) : QGraphicsView (pParent)
, mController (pController) , mController (pController)
, mIsCreatingTextZone (false) , mIsCreatingTextZone (false)
...@@ -75,7 +75,8 @@ UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent, bool ...@@ -75,7 +75,8 @@ UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent, bool
, mLongPressInterval(1000) , mLongPressInterval(1000)
, mIsDragInProgress(false) , mIsDragInProgress(false)
, mMultipleSelectionIsEnabled(false) , mMultipleSelectionIsEnabled(false)
, isControl(pIsControl) , bIsControl(isControl)
, bIsDesktop(isDesktop)
, mRubberBandInPlayMode(false) //enables rubberband with play tool , mRubberBandInPlayMode(false) //enables rubberband with play tool
{ {
init (); init ();
...@@ -86,14 +87,15 @@ UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent, bool ...@@ -86,14 +87,15 @@ UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent, bool
mLongPressTimer.setSingleShot(true); mLongPressTimer.setSingleShot(true);
} }
UBBoardView::UBBoardView (UBBoardController* pController, int pStartLayer, int pEndLayer, QWidget* pParent, bool pIscontrol) UBBoardView::UBBoardView (UBBoardController* pController, int pStartLayer, int pEndLayer, QWidget* pParent, bool isControl, bool isDesktop)
: QGraphicsView (pParent) : QGraphicsView (pParent)
, mController (pController) , mController (pController)
, suspendedMousePressEvent(NULL) , suspendedMousePressEvent(NULL)
, mLongPressInterval(1000) , mLongPressInterval(1000)
, mIsDragInProgress(false) , mIsDragInProgress(false)
, mMultipleSelectionIsEnabled(false) , mMultipleSelectionIsEnabled(false)
, isControl(pIscontrol) , bIsControl(isControl)
, bIsDesktop(isDesktop)
{ {
init (); init ();
...@@ -850,7 +852,7 @@ void UBBoardView::longPressEvent() ...@@ -850,7 +852,7 @@ void UBBoardView::longPressEvent()
void UBBoardView::mousePressEvent (QMouseEvent *event) void UBBoardView::mousePressEvent (QMouseEvent *event)
{ {
if (!isControl) { if (!bIsControl && !bIsDesktop) {
event->ignore(); event->ignore();
return; return;
} }
...@@ -896,6 +898,10 @@ void UBBoardView::mousePressEvent (QMouseEvent *event) ...@@ -896,6 +898,10 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
} }
else if (currentTool == UBStylusTool::Selector || currentTool == UBStylusTool::Play) else if (currentTool == UBStylusTool::Selector || currentTool == UBStylusTool::Play)
{ {
if (bIsDesktop) {
event->ignore();
return;
}
connect(&mLongPressTimer, SIGNAL(timeout()), this, SLOT(longPressEvent())); connect(&mLongPressTimer, SIGNAL(timeout()), this, SLOT(longPressEvent()));
if (!movingItem && !mController->cacheIsVisible()) if (!movingItem && !mController->cacheIsVisible())
mLongPressTimer.start(); mLongPressTimer.start();
...@@ -1017,6 +1023,11 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event) ...@@ -1017,6 +1023,11 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
return; return;
} }
if (bIsDesktop) {
event->ignore();
return;
}
if (currentTool != UBStylusTool::Play || mRubberBandInPlayMode) { if (currentTool != UBStylusTool::Play || mRubberBandInPlayMode) {
if (!movingItem && (mMouseButtonIsPressed || mTabletStylusIsPressed) && mUBRubberBand && mUBRubberBand->isVisible()) { if (!movingItem && (mMouseButtonIsPressed || mTabletStylusIsPressed) && mUBRubberBand && mUBRubberBand->isVisible()) {
...@@ -1099,6 +1110,11 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event) ...@@ -1099,6 +1110,11 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
if (currentTool == UBStylusTool::Selector) if (currentTool == UBStylusTool::Selector)
{ {
if (bIsDesktop) {
event->ignore();
return;
}
bool bReleaseIsNeed = true; bool bReleaseIsNeed = true;
if (movingItem != determineItemToPress(scene()->itemAt(this->mapToScene(event->posF().toPoint())))) if (movingItem != determineItemToPress(scene()->itemAt(this->mapToScene(event->posF().toPoint()))))
{ {
...@@ -1161,6 +1177,11 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event) ...@@ -1161,6 +1177,11 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
} }
else if (currentTool == UBStylusTool::Play) else if (currentTool == UBStylusTool::Play)
{ {
if (bIsDesktop) {
event->ignore();
return;
}
if (mWidgetMoved) if (mWidgetMoved)
{ {
movingItem = NULL; movingItem = NULL;
......
...@@ -31,8 +31,8 @@ class UBBoardView : public QGraphicsView ...@@ -31,8 +31,8 @@ class UBBoardView : public QGraphicsView
public: public:
UBBoardView(UBBoardController* pController, QWidget* pParent = 0, bool pIsControl = false); UBBoardView(UBBoardController* pController, QWidget* pParent = 0, bool isControl = false, bool isDesktop = false);
UBBoardView(UBBoardController* pController, int pStartLayer, int pEndLayer, QWidget* pParent = 0, bool pIscontrol = false); UBBoardView(UBBoardController* pController, int pStartLayer, int pEndLayer, QWidget* pParent = 0, bool isControl = false, bool isDesktop = false);
virtual ~UBBoardView(); virtual ~UBBoardView();
UBGraphicsScene* scene(); UBGraphicsScene* scene();
...@@ -153,7 +153,8 @@ class UBBoardView : public QGraphicsView ...@@ -153,7 +153,8 @@ class UBBoardView : public QGraphicsView
bool mIsDragInProgress; bool mIsDragInProgress;
bool mMultipleSelectionIsEnabled; bool mMultipleSelectionIsEnabled;
bool isControl; bool bIsControl;
bool bIsDesktop;
bool mRubberBandInPlayMode; bool mRubberBandInPlayMode;
static bool hasSelectedParents(QGraphicsItem * item); static bool hasSelectedParents(QGraphicsItem * item);
......
...@@ -65,7 +65,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UB ...@@ -65,7 +65,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent, UB
, mDesktopStylusTool(UBDrawingController::drawingController()->stylusTool()) , mDesktopStylusTool(UBDrawingController::drawingController()->stylusTool())
{ {
mTransparentDrawingView = new UBBoardView(UBApplication::boardController, static_cast<QWidget*>(0), true); // deleted in UBDesktopAnnotationController::destructor mTransparentDrawingView = new UBBoardView(UBApplication::boardController, static_cast<QWidget*>(0), false, true); // deleted in UBDesktopAnnotationController::destructor
mTransparentDrawingView->setAttribute(Qt::WA_TranslucentBackground, true); mTransparentDrawingView->setAttribute(Qt::WA_TranslucentBackground, true);
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
mTransparentDrawingView->setAttribute(Qt::WA_MacNoShadow, true); mTransparentDrawingView->setAttribute(Qt::WA_MacNoShadow, true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment