|
|
@ -446,11 +446,11 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event) |
|
|
|
if(!mMirrorX && !mMirrorY){ |
|
|
|
if(!mMirrorX && !mMirrorY){ |
|
|
|
ref = delegated()->boundingRect().topLeft(); |
|
|
|
ref = delegated()->boundingRect().topLeft(); |
|
|
|
}else if(mMirrorX && !mMirrorY){ |
|
|
|
}else if(mMirrorX && !mMirrorY){ |
|
|
|
ref = delegated()->boundingRect().topRight(); |
|
|
|
ref = delegated()->boundingRect().topLeft(); |
|
|
|
}else if(!mMirrorX && mMirrorY){ |
|
|
|
}else if(!mMirrorX && mMirrorY){ |
|
|
|
ref = delegated()->boundingRect().bottomLeft(); |
|
|
|
ref = delegated()->boundingRect().topLeft(); |
|
|
|
}else if(mMirrorX && mMirrorY){ |
|
|
|
}else if(mMirrorX && mMirrorY){ |
|
|
|
ref = delegated()->boundingRect().bottomRight(); |
|
|
|
ref = delegated()->boundingRect().topRight(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Map the item topleft point to the current mouse move transform
|
|
|
|
// Map the item topleft point to the current mouse move transform
|
|
|
@ -578,8 +578,6 @@ void UBGraphicsDelegateFrame::setVisible(bool visible) |
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsDelegateFrame::positionHandles() |
|
|
|
void UBGraphicsDelegateFrame::positionHandles() |
|
|
|
{ |
|
|
|
{ |
|
|
|
// TODO: Check why the height is modified if the user rotates the item more than 90°
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QRectF itemRect = delegated()->boundingRect(); |
|
|
|
QRectF itemRect = delegated()->boundingRect(); |
|
|
|
QTransform itemTransform = delegated()->sceneTransform(); |
|
|
|
QTransform itemTransform = delegated()->sceneTransform(); |
|
|
|
QPointF topLeft = itemTransform.map(itemRect.topLeft()); |
|
|
|
QPointF topLeft = itemTransform.map(itemRect.topLeft()); |
|
|
@ -619,7 +617,6 @@ void UBGraphicsDelegateFrame::positionHandles() |
|
|
|
|
|
|
|
|
|
|
|
if (mVisible) |
|
|
|
if (mVisible) |
|
|
|
{ |
|
|
|
{ |
|
|
|
qDebug() << center.y(); |
|
|
|
|
|
|
|
setRect(center.x() - mFrameWidth - width / 2, center.y() - mFrameWidth - h / 2, width + 2 * mFrameWidth, h + 2 * mFrameWidth); |
|
|
|
setRect(center.x() - mFrameWidth - width / 2, center.y() - mFrameWidth - h / 2, width + 2 * mFrameWidth, h + 2 * mFrameWidth); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -711,38 +708,30 @@ UBGraphicsDelegateFrame::FrameTool UBGraphicsDelegateFrame::toolFromPos(QPointF |
|
|
|
return ResizeBottomRight; |
|
|
|
return ResizeBottomRight; |
|
|
|
else if (bottomResizeGripRect().contains(pos)){ |
|
|
|
else if (bottomResizeGripRect().contains(pos)){ |
|
|
|
if(mMirrorY){ |
|
|
|
if(mMirrorY){ |
|
|
|
qDebug() << "Top"; |
|
|
|
|
|
|
|
return ResizeTop; |
|
|
|
return ResizeTop; |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
qDebug() << "Bottom"; |
|
|
|
|
|
|
|
return ResizeBottom; |
|
|
|
return ResizeBottom; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if (leftResizeGripRect().contains(pos)){ |
|
|
|
else if (leftResizeGripRect().contains(pos)){ |
|
|
|
if(mMirrorX){ |
|
|
|
if(mMirrorX){ |
|
|
|
qDebug() << "Right"; |
|
|
|
|
|
|
|
return ResizeRight; |
|
|
|
return ResizeRight; |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
qDebug() << "Left"; |
|
|
|
|
|
|
|
return ResizeLeft; |
|
|
|
return ResizeLeft; |
|
|
|
} |
|
|
|
} |
|
|
|
return ResizeLeft; |
|
|
|
return ResizeLeft; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (rightResizeGripRect().contains(pos)){ |
|
|
|
else if (rightResizeGripRect().contains(pos)){ |
|
|
|
if(mMirrorX){ |
|
|
|
if(mMirrorX){ |
|
|
|
qDebug() << "Left"; |
|
|
|
|
|
|
|
return ResizeLeft; |
|
|
|
return ResizeLeft; |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
qDebug() << "Right"; |
|
|
|
|
|
|
|
return ResizeRight; |
|
|
|
return ResizeRight; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if (topResizeGripRect().contains(pos)){ |
|
|
|
else if (topResizeGripRect().contains(pos)){ |
|
|
|
if(mMirrorY){ |
|
|
|
if(mMirrorY){ |
|
|
|
qDebug() << "Bottom"; |
|
|
|
|
|
|
|
return ResizeBottom; |
|
|
|
return ResizeBottom; |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
qDebug() << "Top"; |
|
|
|
|
|
|
|
return ResizeTop; |
|
|
|
return ResizeTop; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -796,11 +785,8 @@ void UBGraphicsDelegateFrame::refreshGeometry() |
|
|
|
QPointF topLeft = itemTransform.map(itemRect.topLeft()); |
|
|
|
QPointF topLeft = itemTransform.map(itemRect.topLeft()); |
|
|
|
QPointF topRight = itemTransform.map(itemRect.topRight()); |
|
|
|
QPointF topRight = itemTransform.map(itemRect.topRight()); |
|
|
|
QPointF bottomLeft = itemTransform.map(itemRect.bottomLeft()); |
|
|
|
QPointF bottomLeft = itemTransform.map(itemRect.bottomLeft()); |
|
|
|
QPointF center = itemTransform.map(itemRect.center()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QLineF topLine(topLeft, topRight); |
|
|
|
QLineF topLine(topLeft, topRight); |
|
|
|
qreal angle = topLine.angle(); |
|
|
|
|
|
|
|
qreal width = topLine.length(); |
|
|
|
qreal width = topLine.length(); |
|
|
|
QLineF leftLine(topLeft, bottomLeft); |
|
|
|
QLineF leftLine(topLeft, bottomLeft); |
|
|
|
qreal height = leftLine.length(); |
|
|
|
qreal height = leftLine.length(); |
|
|
|