Commit 29405d53 authored by shibakaneki's avatar shibakaneki

backup

parents a9769e42 10bd10a3
...@@ -71,9 +71,11 @@ UBGraphicsDelegateFrame::UBGraphicsDelegateFrame(UBGraphicsItemDelegate* pDelega ...@@ -71,9 +71,11 @@ UBGraphicsDelegateFrame::UBGraphicsDelegateFrame(UBGraphicsItemDelegate* pDelega
mBottomResizeGrip = new QGraphicsRectItem(this); mBottomResizeGrip = new QGraphicsRectItem(this);
mBottomResizeGrip->setPen(Qt::NoPen); mBottomResizeGrip->setPen(Qt::NoPen);
mLeftResizeGrip = new QGraphicsRectItem(this); mLeftResizeGrip = new QGraphicsRectItem(this);
mLeftResizeGrip->setToolTip("left");
mLeftResizeGrip->setPen(Qt::NoPen); mLeftResizeGrip->setPen(Qt::NoPen);
mRightResizeGrip = new QGraphicsRectItem(this); mRightResizeGrip = new QGraphicsRectItem(this);
mRightResizeGrip->setPen(Qt::NoPen); mRightResizeGrip->setPen(Qt::NoPen);
mRightResizeGrip->setToolTip("Right");
mTopResizeGrip = new QGraphicsRectItem(this); mTopResizeGrip = new QGraphicsRectItem(this);
mTopResizeGrip->setPen(Qt::NoPen); mTopResizeGrip->setPen(Qt::NoPen);
...@@ -159,6 +161,7 @@ void UBGraphicsDelegateFrame::initializeTransform() ...@@ -159,6 +161,7 @@ void UBGraphicsDelegateFrame::initializeTransform()
QPointF bottomLeft = itemTransform.map(itemRect.bottomLeft()); QPointF bottomLeft = itemTransform.map(itemRect.bottomLeft());
qreal horizontalFlip = (topLeft.x() > topRight.x()) ? -1 : 1; qreal horizontalFlip = (topLeft.x() > topRight.x()) ? -1 : 1;
mMirrorX = horizontalFlip < 0 ;
if(horizontalFlip < 0){ if(horizontalFlip < 0){
// why this is because of the way of calculating the translations that checks which side is the most is the // why this is because of the way of calculating the translations that checks which side is the most is the
// nearest instead of checking which one is the left side. // nearest instead of checking which one is the left side.
...@@ -172,7 +175,8 @@ void UBGraphicsDelegateFrame::initializeTransform() ...@@ -172,7 +175,8 @@ void UBGraphicsDelegateFrame::initializeTransform()
qreal verticalFlip = (bottomLeft.y() < topLeft.y()) ? -1 : 1; qreal verticalFlip = (bottomLeft.y() < topLeft.y()) ? -1 : 1;
// not sure that is usefull // not sure that is usefull
if(verticalFlip < 0){ mMirrorY = verticalFlip < 0;
if(verticalFlip < 0 && !mMirrorX){
topLeft = itemTransform.map(itemRect.bottomLeft()); topLeft = itemTransform.map(itemRect.bottomLeft());
topRight = itemTransform.map(itemRect.bottomRight()); topRight = itemTransform.map(itemRect.bottomRight());
bottomLeft = itemTransform.map(itemRect.topLeft()); bottomLeft = itemTransform.map(itemRect.topLeft());
...@@ -278,9 +282,7 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event) ...@@ -278,9 +282,7 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
if(mDelegate->isFlippable() && qAbs(scaleX) != 0){ if(mDelegate->isFlippable() && qAbs(scaleX) != 0){
if((qAbs(width * scaleX)) < 2*mFrameWidth){ if((qAbs(width * scaleX)) < 2*mFrameWidth){
bool negative = (scaleX < 0)?true:false; bool negative = (scaleX < 0)?true:false;
//mMirrorX = (negative?mMirrorX:!mMirrorX);
mMirrorX = (negative?mMirrorX:!mMirrorX);
if(negative){ if(negative){
scaleX = -2*mFrameWidth/width; scaleX = -2*mFrameWidth/width;
}else{ }else{
...@@ -307,7 +309,7 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event) ...@@ -307,7 +309,7 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
if(mDelegate->isFlippable() && qAbs(scaleY) != 0){ if(mDelegate->isFlippable() && qAbs(scaleY) != 0){
if((qAbs(height * scaleY)) < 2*mFrameWidth){ if((qAbs(height * scaleY)) < 2*mFrameWidth){
bool negative = (scaleY < 0)?true:false; bool negative = (scaleY < 0)?true:false;
mMirrorY = (negative?mMirrorY:!mMirrorY); //mMirrorY = (negative?mMirrorY:!mMirrorY);
if(negative){ if(negative){
scaleY = -2*mFrameWidth/width; scaleY = -2*mFrameWidth/width;
}else{ }else{
...@@ -623,7 +625,6 @@ UBGraphicsDelegateFrame::FrameTool UBGraphicsDelegateFrame::toolFromPos(QPointF ...@@ -623,7 +625,6 @@ UBGraphicsDelegateFrame::FrameTool UBGraphicsDelegateFrame::toolFromPos(QPointF
} }
} }
else if (leftResizeGripRect().contains(pos)){ else if (leftResizeGripRect().contains(pos)){
qDebug() << "LEFT GRIP (" << mMirrorX << ")";
if(mMirrorX){ if(mMirrorX){
return ResizeRight; return ResizeRight;
}else{ }else{
...@@ -632,7 +633,6 @@ UBGraphicsDelegateFrame::FrameTool UBGraphicsDelegateFrame::toolFromPos(QPointF ...@@ -632,7 +633,6 @@ UBGraphicsDelegateFrame::FrameTool UBGraphicsDelegateFrame::toolFromPos(QPointF
return ResizeLeft; return ResizeLeft;
} }
else if (rightResizeGripRect().contains(pos)){ else if (rightResizeGripRect().contains(pos)){
qDebug() << "RIGHT GRIP (" << mMirrorX << ")";
if(mMirrorX){ if(mMirrorX){
return ResizeLeft; return ResizeLeft;
}else{ }else{
...@@ -698,7 +698,6 @@ void UBGraphicsDelegateFrame::refreshGeometry() ...@@ -698,7 +698,6 @@ void UBGraphicsDelegateFrame::refreshGeometry()
QPointF bottomLeft = itemTransform.map(itemRect.bottomLeft()); QPointF bottomLeft = itemTransform.map(itemRect.bottomLeft());
QPointF center = itemTransform.map(itemRect.center()); QPointF center = itemTransform.map(itemRect.center());
qDebug() << topLeft << ", " << topRight << ", " << bottomLeft;
QLineF topLine(topLeft, topRight); QLineF topLine(topLeft, topRight);
qreal angle = topLine.angle(); qreal angle = topLine.angle();
......
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