From 1d68e7163feb770a5d9325c92a65d184cdcb60bb Mon Sep 17 00:00:00 2001 From: Anatoly Mihalchenko Date: Thu, 6 Oct 2011 17:25:57 +0300 Subject: [PATCH 1/3] SANKORE-249 fix laser pointer and eraser cursor ZValue --- src/domain/UBGraphicsScene.cpp | 45 ++++++++++++++++++++++++++++------ src/domain/UBGraphicsScene.h | 4 +-- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 73daa271..63efc636 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -110,7 +110,7 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent) mEraser->setRect(QRect(0, 0, 0, 0)); mEraser->setVisible(false); - mEraser->setZValue(toolLayerStart + toolOffsetEraser); + mEraser->setZValue(/*toolLayerStart + toolOffsetEraser*/2); mEraser->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); mTools << mEraser; @@ -123,7 +123,7 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent) mPointer->setPen(Qt::NoPen); mPointer->setBrush(QBrush(QColor(255, 0, 0, 186))); - mPointer->setZValue(toolLayerStart + toolOffsetPointer); + mPointer->setZValue( /*toolLayerStart + toolOffsetPointer*/ 2); mPointer->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); mTools << mPointer; @@ -230,11 +230,13 @@ bool UBGraphicsScene::inputDevicePress(const QPointF& scenePos, const qreal& pre eraserWidth /= UBApplication::boardController->currentZoom(); eraseLineTo(scenePos, eraserWidth); + drawEraser(scenePos, true); + accepted = true; } else if (currentTool == UBStylusTool::Pointer) { - drawPointer(scenePos); + drawPointer(scenePos, true); accepted = true; } } @@ -369,7 +371,7 @@ bool UBGraphicsScene::inputDeviceRelease() // MARK: - -void UBGraphicsScene::drawEraser(const QPointF &pPoint) +void UBGraphicsScene::drawEraser(const QPointF &pPoint, bool isFirstDraw) { qreal eraserWidth = UBSettings::settings()->currentEraserWidth(); eraserWidth /= UBApplication::boardController->systemScaleFactor(); @@ -381,12 +383,27 @@ void UBGraphicsScene::drawEraser(const QPointF &pPoint) if (mEraser) { mEraser->setRect(QRectF(pPoint.x() - eraserRadius, pPoint.y() - eraserRadius, eraserWidth, eraserWidth)); - mEraser->show(); + + if(isFirstDraw) + { + QList allItemsList = items(); + for( int i = 0; i < allItemsList.size(); i++ ) + { + QGraphicsItem *nextItem = allItemsList.at(i); + qreal zValue = nextItem->zValue(); + nextItem->setZValue(qreal(1)); + qDebug() << QString(" %1 ").arg(i) << QString(" %1 ").arg(zValue); + } + + mEraser->setZValue(2); + mEraser->show(); + } + } } -void UBGraphicsScene::drawPointer(const QPointF &pPoint) +void UBGraphicsScene::drawPointer(const QPointF &pPoint, bool isFirstDraw) { qreal pointerDiameter = UBSettings::pointerDiameter / UBApplication::boardController->currentZoom(); qreal pointerRadius = pointerDiameter / 2; @@ -399,7 +416,21 @@ void UBGraphicsScene::drawPointer(const QPointF &pPoint) pointerDiameter, pointerDiameter)); - mPointer->show(); + if(isFirstDraw) + { + QList allItemsList = items(); + for( int i = 0; i < allItemsList.size(); i++ ) + { + QGraphicsItem *nextItem = allItemsList.at(i); + qreal zValue = nextItem->zValue(); + nextItem->setZValue(qreal(1)); + qDebug() << QString(" %1 ").arg(i) << QString(" %1 ").arg(zValue); + } + + mPointer->setZValue(2); + mPointer->show(); + } + } } diff --git a/src/domain/UBGraphicsScene.h b/src/domain/UBGraphicsScene.h index 9e622e39..0a9b0e96 100644 --- a/src/domain/UBGraphicsScene.h +++ b/src/domain/UBGraphicsScene.h @@ -297,8 +297,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem void initPolygonItem(UBGraphicsPolygonItem*); - void drawEraser(const QPointF& pEndPoint); - void drawPointer(const QPointF& pEndPoint); + void drawEraser(const QPointF& pEndPoint, bool isFirstDraw = false); + void drawPointer(const QPointF& pEndPoint, bool isFirstDraw = false); void DisposeMagnifierQWidgets(); From 0d12a17535ae50a6b2e2aef132077d4c8ff75567 Mon Sep 17 00:00:00 2001 From: Anatoly Mihalchenko Date: Thu, 6 Oct 2011 17:54:29 +0300 Subject: [PATCH 2/3] SANKORE-267 implement forced min width == 50 and min height == 50 for any widget application --- src/domain/UBGraphicsDelegateFrame.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/domain/UBGraphicsDelegateFrame.cpp b/src/domain/UBGraphicsDelegateFrame.cpp index 071105ae..a63cabe5 100644 --- a/src/domain/UBGraphicsDelegateFrame.cpp +++ b/src/domain/UBGraphicsDelegateFrame.cpp @@ -299,7 +299,7 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event) QSizeF newSize = resizableItem->size() + incVector; - if (newSize.width() < 0 || newSize.height() < 0) + if (newSize.width() < 50 /*0*/ || newSize.height() < /*0*/ 50) return; resizableItem->resize(newSize); From 2d2af6f51bc31751659b611ebf9269291c010831 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 7 Oct 2011 08:47:39 +0200 Subject: [PATCH 3/3] changed version --- Sankore_3.1.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sankore_3.1.pro b/Sankore_3.1.pro index 90a5d85b..5233fd82 100644 --- a/Sankore_3.1.pro +++ b/Sankore_3.1.pro @@ -7,7 +7,7 @@ CONFIG += debug_and_release \ no_include_pwd VERSION_MAJ = 1 -VERSION_MIN = 26 +VERSION_MIN = 28 VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error VERSION_PATCH = 00