Commit 2a84574d authored by Maik Qualmann's avatar Maik Qualmann

healing clone tool++

parent be67d392
......@@ -51,10 +51,6 @@ public:
explicit Private()
: srcSet(true),
isLassoPointsVectorEmpty(true),
default_w(0.0),
default_h(0.0),
float_w(0.0),
float_h(0.0),
amIFocused(false),
proceedInMoveEvent(false),
cloneVectorChanged(true),
......@@ -67,7 +63,6 @@ public:
sourceCursorCenter(nullptr)
{
src = QPoint(0, 0);
brushColor = QColor(Qt::red);
}
bool srcSet;
......@@ -75,22 +70,16 @@ public:
QPointF lastCursorPosition;
QPoint src;
QPoint dst;
double default_w;
double default_h;
double float_w;
double float_h;
bool amIFocused;
bool proceedInMoveEvent;
bool cloneVectorChanged;
int brushRadius;
int brushValue;
QColor brushColor;
HealingCloneState currentState;
HealingCloneState previousState;
QGraphicsEllipseItem* drawCursor;
QGraphicsEllipseItem* sourceCursor;
QGraphicsEllipseItem* sourceCursorCenter;
QCursor prevCursor;
};
HealingCloneToolWidget::HealingCloneToolWidget(QWidget* const parent)
......@@ -173,7 +162,6 @@ void HealingCloneToolWidget::mouseMoveEvent(QMouseEvent* e)
{
bool cursorOutsideScene = checkPointOutsideScene(e->pos());
d->lastCursorPosition = mapToScene(e->pos());
setDrawCursorPosition(d->lastCursorPosition);
if (cursorOutsideScene &&
d->currentState != HealingCloneState::DO_NOTHING)
......@@ -186,6 +174,8 @@ void HealingCloneToolWidget::mouseMoveEvent(QMouseEvent* e)
activateState(d->previousState);
}
setDrawCursorPosition(d->lastCursorPosition);
if (d->currentState == HealingCloneState::DO_NOTHING)
{
ImageRegionWidget::mouseMoveEvent(e);
......@@ -269,7 +259,7 @@ void HealingCloneToolWidget::mouseDoubleClickEvent(QMouseEvent* event)
}
}
void HealingCloneToolWidget :: keyPressEvent(QKeyEvent *e)
void HealingCloneToolWidget::keyPressEvent(QKeyEvent *e)
{
if (e->key() == Qt::Key_M)
{
......@@ -347,11 +337,6 @@ void HealingCloneToolWidget::keyReleaseEvent(QKeyEvent* e)
}
}
void HealingCloneToolWidget:: wheelEvent(QWheelEvent* e)
{
ImageRegionWidget::wheelEvent(e);
}
void HealingCloneToolWidget::focusOutEvent(QFocusEvent*)
{
d->amIFocused = false;
......@@ -652,14 +637,18 @@ bool HealingCloneToolWidget::checkPointOutsideScene(const QPoint& globalPoint) c
}
else
{
QPoint bottomRight = QPoint(viewport()->width() - 1, viewport()->height() - 1);
QPoint bottomRight = QPoint(viewport()->width(),
viewport()->height());
int right = mapToScene(bottomRight).x();
int left = right - viewport()->width();
int bottom = mapToScene(bottomRight).y();
int top = bottom - viewport()->height();
pointOutsideScene = (temp.x() <= 0) ||
(temp.x() >= right) ||
(temp.y() <= 0) ||
(temp.y() >= bottom);
pointOutsideScene = (temp.x() < left) ||
(temp.x() + 1 > right) ||
(temp.y() < top) ||
(temp.y() + 1 > bottom);
}
return pointOutsideScene;
......
......@@ -114,7 +114,6 @@ protected:
void mouseDoubleClickEvent(QMouseEvent*) override;
void keyPressEvent(QKeyEvent*) override;
void keyReleaseEvent(QKeyEvent*) override;
void wheelEvent(QWheelEvent*) override;
void focusOutEvent(QFocusEvent*) override;
void focusInEvent(QFocusEvent*) override;
bool event(QEvent*) override;
......
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