| 882 | |
| 883 | |
| 884 | void UBGraphicsDelegateFrame::positionHandles() |
| 885 | { |
| 886 | QRectF itemRect = delegated()->boundingRect(); |
| 887 | |
| 888 | if (mDelegate->getToolBarItem() && mDelegate->getToolBarItem()->isVisibleOnBoard() |
| 889 | && mDelegate->getToolBarItem()->isShifting()) |
| 890 | { |
| 891 | QPointF graphicsItemPosition = itemRect.topLeft(); |
| 892 | itemRect.setTopLeft(graphicsItemPosition-QPointF(0,mDelegate->getToolBarItem()->boundingRect().height()* mDelegate->antiScaleRatio())); |
| 893 | } |
| 894 | |
| 895 | QTransform itemTransform = delegated()->sceneTransform(); |
| 896 | QPointF topLeft = itemTransform.map(itemRect.topLeft()); |
| 897 | QPointF topRight = itemTransform.map(itemRect.topRight()); |
| 898 | QPointF bottomLeft = itemTransform.map(itemRect.bottomLeft()); |
| 899 | QPointF bottomRight = itemTransform.map(itemRect.bottomRight()); |
| 900 | QPointF center = itemTransform.map(itemRect.center()); |
| 901 | int rotateHeight = QLineF(topLeft, bottomLeft).length(); |
| 902 | |
| 903 | // Handle the mirroring |
| 904 | if(topLeft.x() > topRight.x()){ |
| 905 | QPointF topTmp = topRight; |
| 906 | QPointF bottomTmp = bottomRight; |
| 907 | topRight = topLeft; |
| 908 | topLeft = topTmp; |
| 909 | bottomRight = bottomLeft; |
| 910 | bottomLeft = bottomTmp; |
| 911 | } |
| 912 | |
| 913 | if(bottomLeft.y() > topLeft.y()){ |
| 914 | QPointF leftTmp = bottomLeft; |
| 915 | QPointF rightTmp = bottomRight; |
| 916 | bottomLeft = topLeft; |
| 917 | topLeft = leftTmp; |
| 918 | bottomRight = topRight; |
| 919 | topRight = rightTmp; |
| 920 | } |
| 921 | |
| 922 | QLineF topLine(topLeft, topRight); |
| 923 | qreal angle = topLine.angle(); |
| 924 | qreal width = topLine.length(); |
| 925 | |
| 926 | QLineF leftLine(topLeft, bottomLeft); |
| 927 | qreal height = leftLine.length(); |
| 928 | |
| 929 | int h = rotating()?rotateHeight:height; |
| 930 | |
| 931 | if (mVisible) |
| 932 | { |
| 933 | setRect(center.x() - mFrameWidth - width / 2, center.y() - mFrameWidth - mTitleBarHeight - h / 2, width + 2 * mFrameWidth, h + (2 * mFrameWidth) + mTitleBarHeight); |
| 934 | } |
| 935 | else |
| 936 | { |
| 937 | setRect(center.x() - width / 2, center.y() - h / 2, width, h); |
| 938 | } |
| 939 | |
| 940 | resetTransform(); |
| 941 | setTransform(QTransform::fromTranslate(center.x(), center.y()), true); |
nothing calls this directly
no test coverage detected