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

preferencesAboutTextFull
Aleksei Kanash 12 years ago
parent b574c5b1c0
commit 4c36ef935d
  1. 2
      src/board/UBBoardController.cpp
  2. 31
      src/board/UBBoardView.cpp
  3. 7
      src/board/UBBoardView.h
  4. 2
      src/desktop/UBDesktopAnnotationController.cpp

@ -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 @@
#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
, 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
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()
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)
} }
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)
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)
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)
} }
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
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
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
, 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);

Loading…
Cancel
Save