Fixed sync of magnifier tool on control and display screens.

preferencesAboutTextFull
Aleksei Kanash 13 years ago
parent d2eff8ebb9
commit 9dc74ccafa
  1. 1
      src/board/UBBoardController.cpp
  2. 17
      src/domain/UBGraphicsScene.cpp
  3. 3
      src/domain/UBGraphicsScene.h

@ -1486,6 +1486,7 @@ void UBBoardController::boardViewResized(QResizeEvent* event)
mPaletteManager->containerResized();
UBApplication::boardController->controlView()->scene()->moveMagnifier();
}

@ -1979,7 +1979,16 @@ void UBGraphicsScene::addMagnifier(UBMagnifierParams params)
setModified(true);
}
void UBGraphicsScene::moveMagnifier(QPoint newPos)
void UBGraphicsScene::moveMagnifier()
{
if (magniferControlViewWidget)
{
QPoint magnifierPos = QPoint(magniferControlViewWidget->pos().x() + magniferControlViewWidget->size().width() / 2, magniferControlViewWidget->pos().y() + magniferControlViewWidget->size().height() / 2 );
moveMagnifier(magnifierPos, true);
}
}
void UBGraphicsScene::moveMagnifier(QPoint newPos, bool forceGrab)
{
QWidget *cContainer = (QWidget*)(UBApplication::boardController->controlContainer());
QGraphicsView *cView = (QGraphicsView*)UBApplication::boardController->controlView();
@ -1987,6 +1996,8 @@ void UBGraphicsScene::moveMagnifier(QPoint newPos)
QPoint dvZeroPoint = dView->mapToGlobal(QPoint(0,0));
QRect qcr = cView->geometry();
QRect qdr = dView->geometry();
int cvW = cView->width();
int dvW = dView->width();
qreal wCoeff = (qreal)dvW / (qreal)cvW;
@ -1999,8 +2010,8 @@ void UBGraphicsScene::moveMagnifier(QPoint newPos)
QPoint cvPoint = cView->mapFromGlobal(globalPoint);
QPoint dvPoint( cvPoint.x() * wCoeff + dvZeroPoint.x(), cvPoint.y() * hCoeff + dvZeroPoint.y());
magniferControlViewWidget->grabNMove(globalPoint, globalPoint, false, false);
magniferDisplayViewWidget->grabNMove(globalPoint, dvPoint, false, true);
magniferControlViewWidget->grabNMove(globalPoint, globalPoint, forceGrab, false);
magniferDisplayViewWidget->grabNMove(globalPoint, dvPoint, forceGrab, true);
setModified(true);
}

@ -326,7 +326,8 @@ public slots:
void selectionChangedProcessing();
void updateGroupButtonState();
void moveMagnifier(QPoint newPos);
void moveMagnifier();
void moveMagnifier(QPoint newPos, bool forceGrab = false);
void closeMagnifier();
void zoomInMagnifier();
void zoomOutMagnifier();

Loading…
Cancel
Save