沧州三亚菏泽经济预测自然
投稿投诉
自然科学
知识物理
化学生物
地理解释
预测理解
本质社会
人类现象
行为研究
经济政治
心理结构
关系指导
人文遗产
菏泽德阳
山西湖州
宝鸡上海
茂名内江
三亚信阳
长春北海
西安安徽
黄石烟台
沧州湛江
肇庆鹤壁
六安韶关
成都钦州

Qt通过重写QGraphicItem实现绘制拖动旋转缩放椭圆

6月10日 顾昀汐投稿
  本例程通过重写了一个类,继承自QGraphicItem,来实现了在qgraphicsScene上绘制、拖动、旋转、缩放椭圆
  效果如下:
  核心代码如下:
  mygraphicrectitem。h
  【领QT开发教程学习资料,点击下方链接莬费领取,先码住不迷路】
  点击领取链接1ifndefMYGRAPHICRECTITEMH2defineMYGRAPHICRECTITEMH3includeQObject4includeQWidget5includeQMouseEvent6includeQGraphicsScene7includeQGraphicsRectItem8includeQGraphicsSceneMouseEvent9includeQRect10includeQPainter11includeQPolygon12includeQList13includeQTransform14enumSTATEFLAG{15DEFAULTFLAG0,16MOVLEFTLINE,标记当前为用户按下矩形的左边界区域17MOVTOPLINE,标记当前为用户按下矩形的上边界区域18MOVRIGHTLINE,标记当前为用户按下矩形的右边界区域19MOVBOTTOMLINE,标记当前为用户按下矩形的下边界区域20MOVRIGHTBOTTOMRECT,标记当前为用户按下矩形的右下角21MOVRECT,标记当前为鼠标拖动图片移动状态22ROTATE标记当前为旋转状态23};24enumSHAPETYPE{25RECTANGLE0,26CIRCLE27};2829classmyGraphicRectItem:publicQObject,publicQGraphicsItem30{31QOBJECT32public:33SHAPETYPEmShapeT34myGraphicRectItem(QGraphicsItemparentnullptr);35myGraphicRectItem(QRectFmOriginRectQRectF(0,0,100,100));36QRectFboundingRect()37QPainterPathshape()38QPainterPathgetCollideShape();39myGraphicRectItem();40voidsetRectSize(QRectFmrect,boolbResetRotateCentertrue);41voidpaint(QPainterpainter,constQStyleOptionGraphicsItemoption,QWidgetwidget);42voidmousePressEvent(QGraphicsSceneMouseEventevent);43voidmouseMoveEvent(QGraphicsSceneMouseEventevent);44voidmouseReleaseEvent(QGraphicsSceneMouseEventevent);45voidSetRotate(qrealRotateAngle);46QPointFgetRotatePoint(QPointFptCenter,QPointFptIn,qrealangle);获取旋转后的点47QListQPointFgetRotatePoints(QPointFptCenter,QListQPointFptIns,qrealangle);获取多个旋转后的点48QPolygonFgetRotatePolygonFromRect(QPointFptCenter,QRectFrectIn,qrealangle);将矩形旋转之后返回多边形49QRectFgetCrtPosRectToSceen();50QPolygonFgetCrtPolygonToScreen();5152QPointFgetSmallRotateRectCenter(QPointFptA,QPointFptB);获取旋转时候矩形正上方的旋转标记矩形53QRectFgetSmallRotateRect(QPointFptA,QPointFptB);54boolmbR55qrealmRotateA56QPointFmRotateC5758private:59QRectFmoldR60QPolygonFmoldRectP61QRectFmRotateAreaR62boolmbR63QPolygonFminsicedP64QRectFminsicedR65QPolygonFmleftP66QRectFmleftR67QPolygonFmtopP68QRectFmtopR69QPolygonFmrightP70QRectFmrightR71QPolygonFmbottomP72QRectFmbottomR73QRectFmSmallRotateR矩形顶部用来表示旋转的标记的矩形74QPolygonFmSmallRotateP矩形顶部用来表示旋转的标记的矩形旋转后形成的多边形75QPolygonFmrbP76QRectFmrbR77QPointFmstartP78STATEFLAGmStateF79QPointFpPointFofSmallRotateR80protected:8182};8384endifMYGRAPHICRECTITEMH
  mygraphicrectitem。cpp1includemygraphicrectitem。h2includeQtMath3includeQDebug45myGraphicRectItem::myGraphicRectItem(QGraphicsItemparent):6mShapeType(RECTANGLE),7mbResize(false),8moldRect(0,0,100,100),9mbRotate(false),10mRotateAngle(0),11mStateFlag(DEFAULTFLAG)12{13setParent(parent);14setRectSize(moldRect);15setToolTip(Clickanddragme!);提示16setCursor(Qt::ArrowCursor);改变光标形状,手的形状17setFlag(QGraphicsItem::ItemIsMovable);18pPointFofSmallRotateRectnewQPointF〔4〕;19SetRotate(0);20setFlag(QGraphicsItem::ItemIsSelectable);21setFlags(QGraphicsItem::ItemIsSelectableQGraphicsItem::ItemIsMovable);22}2324QRectFmyGraphicRectItem::boundingRect()const用来控制本item绘制区域25{26QPainterP27path。addPolygon(moldRectPolygon);28path。addPolygon(mSmallRotatePolygon);29returnpath。boundingRect();30}3132QPainterPathmyGraphicRectItem::shape()const用来控制检测碰撞collide和鼠标点击hit响应区域33{34QPainterP35path。addPolygon(moldRectPolygon);36path。addPolygon(mSmallRotatePolygon);3738}3940QPainterPathmyGraphicRectItem::getCollideShape()41{42QPainterP43if(mShapeTypeRECTANGLE)44{45path。addPolygon(moldRectPolygon);46}47elseif(mShapeTypeCIRCLE)48{49QPainterPathpathT50pathTemp。addEllipse(moldRect);51QT52trans。translate(mRotateCenter。x(),mRotateCenter。y());53trans。rotate(mRotateAngle);QTransform是绕(0,0)点旋转的,所以转之前要先平移到圆心,然后旋转,然后再平移回来54trans。translate(mRotateCenter。x(),mRotateCenter。y());55pathtrans。map(pathTemp);56}5758}5960myGraphicRectItem::myGraphicRectItem()61{62delete〔〕pPointFofSmallRotateR63pPointFofSmallRotateR64}6566voidmyGraphicRectItem::setRectSize(QRectFmrect,boolbResetRotateCenter)67{68moldR69if(bResetRotateCenter)70{71mRotateCenter。setX(moldRect。x()moldRect。width()2);72mRotateCenter。setY(moldRect。y()moldRect。height()2);73}74moldRectPolygongetRotatePolygonFromRect(mRotateCenter,moldRect,mRotateAngle);7576minsicedRectfQRectF(moldRect。x()8,moldRect。y()8,moldRect。width()16,moldRect。height()16);77minsicedPolygongetRotatePolygonFromRect(mRotateCenter,minsicedRectf,mRotateAngle);7879mleftRectfQRectF(moldRect。x(),moldRect。y(),8,moldRect。height()8);80mleftPolygongetRotatePolygonFromRect(mRotateCenter,mleftRectf,mRotateAngle);8182mtopRectfQRectF(moldRect。x()8,moldRect。y(),moldRect。width()8,8);83mtopPolygongetRotatePolygonFromRect(mRotateCenter,mtopRectf,mRotateAngle);8485mrightRectfQRectF(moldRect。right()8,moldRect。y()8,8,moldRect。height()16);86mrightPolygongetRotatePolygonFromRect(mRotateCenter,mrightRectf,mRotateAngle);8788mbottomRectfQRectF(moldRect。x(),moldRect。bottom()8,moldRect。width()8,8);89mbottomPolygongetRotatePolygonFromRect(mRotateCenter,mbottomRectf,mRotateAngle);9091mSmallRotateRectgetSmallRotateRect(mrect。topLeft(),mrect。topRight());矩形正上方的旋转标记矩形92mSmallRotatePolygongetRotatePolygonFromRect(mRotateCenter,mSmallRotateRect,mRotateAngle);9394}9596voidmyGraphicRectItem::paint(QPainterpainter,constQStyleOptionGraphicsItemoption,QWidgetwidget)97{98QPenmP99if(thisisSelected())100{101mPenQPen(Qt::lightGray);102}103else104{105mPenQPen(Qt::yellow);106}107paintersetPen(mPen);108if(mShapeTypeRECTANGLE)109{110绘制旋转后的矩形111painterdrawPolygon(moldRectPolygon);112绘制旋转圆形113mPen。setWidth(2);114mPen。setColor(Qt::green);115paintersetPen(mPen);116QPointFpfgetSmallRotateRectCenter(moldRectPolygon〔0〕,moldRectPolygon〔1〕);117QRectFrectQRectF(pf。x()10,pf。y()10,20,20);118painterdrawEllipse(rect);绘制圆形119painterdrawPoint(pf);绘制点120有重叠的情况121if(!thisscene()collidingItems(this)。isEmpty())122{123QPainterPathpath,pathO124QListQGraphicsItemlstcolliItemsthisscene()collidingItems(this);125intnColliNumlstcolliItems。count();126for(inti0;inColliNi)127{128myGraphicRectItempTempItem(myGraphicRectItem)thisscene()collidingItems(this)〔i〕;129if(pTempItemzValue()0)130{131QPainterPathtempPathpTempItemgetCollideShape();132tempPath。translate(pTempItempos());转换到view中的坐标133pathOtherstempP记录与本item重叠的item的路径134}135}136path。addPolygon(moldRectPolygon);137path。translate(thispos());转换到view中的坐标138pathpathO计算重叠部分的路径path139path。translate(thispos()。x(),thispos()。y());转换回本Item中的坐标140QBrushbrush(Qt::cyan);141mPen。setColor(Qt::blue);142paintersetPen(mPen);143paintersetBrush(brush);144painterdrawPath(path);绘制重叠区域145}146}147elseif(mShapeTypeCIRCLE)148{149绘制旋转后的矩形150painterdrawRect(moldRect);151painterdrawPolygon(moldRectPolygon);152绘制旋转后的圆形153QTransformtrans0;154QPainterPathpath0;155trans0。translate(mRotateCenter。x(),mRotateCenter。y());156trans0。rotate(mRotateAngle,Qt::ZAxis);157trans0。translate(mRotateCenter。x(),mRotateCenter。y());158path0。addEllipse(moldRect);159path0trans0。map(path0);将pathTemp旋转mRotateAngle角度160painterdrawPath(path0);drawPolygon(moldRectPolygon);161绘制旋转圆形标记162mPen。setWidth(2);163mPen。setColor(Qt::green);164paintersetPen(mPen);165QPointFpfgetSmallRotateRectCenter(moldRectPolygon〔0〕,moldRectPolygon〔1〕);166QRectFrectQRectF(pf。x()10,pf。y()10,20,20);167painterdrawEllipse(rect);绘制圆形168painterdrawPoint(pf);绘制点169有重叠的情况170if(!thisscene()collidingItems(this)。isEmpty())171{172QPainterPathpath,pathO173QListQGraphicsItemlstcolliItemsthisscene()collidingItems(this);174intnColliNumlstcolliItems。count();175for(inti0;inColliNi)176{177myGraphicRectItempTempItem(myGraphicRectItem)thisscene()collidingItems(this)〔i〕;178if(pTempItemzValue()0)179{180QPainterPathtempPathpTempItemgetCollideShape();181tempPath。translate(pTempItempos());转换到view中的坐标182pathOtherstempP记录与本item重叠的item的路径183}184}185QT186旋转的时候,QTransform是绕坐标轴的(0,0)点旋转的,所以先要平移到坐标轴0,0点,然后的旋转,然后移回到原来的位置187trans。translate(mRotateCenter。x(),mRotateCenter。y());188trans。rotate(mRotateAngle);189trans。translate(mRotateCenter。x(),mRotateCenter。y());190path。addEllipse(moldRect);191pathtrans。map(path);将pathTemp旋转mRotateAngle角度192path。translate(thispos());转换到view中的坐标193pathpathO计算重叠部分的路径path194path。translate(thispos()。x(),thispos()。y());转换回本Item中的坐标195QBrushbrush(Qt::cyan);196mPen。setColor(Qt::blue);197paintersetPen(mPen);198paintersetBrush(brush);199painterdrawPath(path);绘制重叠区域200}201}202scene()update();203}204205voidmyGraphicRectItem::mousePressEvent(QGraphicsSceneMouseEventevent)206{207if(eventbutton()Qt::LeftButton)208{209setSelected(true);210mstartPoseventpos();鼠标左击时,获取当前鼠标在图片中的坐标,211if(mSmallRotatePolygon。containsPoint(mstartPos,Qt::WindingFill))旋转矩形212{213setCursor(Qt::PointingHandCursor);214mStateFlagROTATE;215}216elseif(minsicedPolygon。containsPoint(mstartPos,Qt::WindingFill))在矩形内框区域时按下鼠标,则可拖动图片217{218setCursor(Qt::ClosedHandCursor);改变光标形状,手的形状219mStateFlagMOVRECT;标记当前为鼠标拖动图片移动状态220}221elseif(mleftPolygon。containsPoint(mstartPos,Qt::WindingFill))222{223setCursor(Qt::SizeHorCursor);224mStateFlagMOVLEFTLINE;标记当前为用户按下矩形的左边界区域225}226elseif(mrightPolygon。containsPoint(mstartPos,Qt::WindingFill))227{228setCursor(Qt::SizeHorCursor);229mStateFlagMOVRIGHTLINE;标记当前为用户按下矩形的右边界区域230}231elseif(mtopPolygon。containsPoint(mstartPos,Qt::WindingFill))232{233setCursor(Qt::SizeVerCursor);234mStateFlagMOVTOPLINE;标记当前为用户按下矩形的上边界区域235}236elseif(mbottomPolygon。containsPoint(mstartPos,Qt::WindingFill))237{238setCursor(Qt::SizeVerCursor);239mStateFlagMOVBOTTOMLINE;标记当前为用户按下矩形的下边界区域240}241elseif(mrbPolygon。containsPoint(mstartPos,Qt::WindingFill))242{243setCursor(Qt::SizeFDiagCursor);244mStateFlagMOVRIGHTBOTTOMRECT;标记当前为用户按下矩形的右下角245}246else247{248mStateFlagDEFAULTFLAG;249}250}251else252{253QGraphicsItem::mousePressEvent(event);254}255}256257voidmyGraphicRectItem::mouseMoveEvent(QGraphicsSceneMouseEventevent)258{259if(mStateFlagROTATE)260{261intnRotateAngleatan2((eventpos()。x()mRotateCenter。x()),(eventpos()。y()mRotateCenter。y()))180MPI;262SetRotate(180nRotateAngle);263qDebug()nRotateA264}265elseif(mStateFlagMOVRECT)266{267QPointFpoint(eventpos()mstartPos);268moveBy(point。x(),point。y());269setRectSize(moldRect);270scene()update();271}272elseif(mStateFlagMOVLEFTLINE)273{274QPointFpfQPointF((moldRectPolygon。at(1)。x()moldRectPolygon。at(2)。x())2,((moldRectPolygon。at(1)。y()moldRectPolygon。at(2)。y())2));275计算到右侧边中点的距离276qrealdissqrt((eventpos()。x()pf。x())(eventpos()。x()pf。x())(eventpos()。y()pf。y())(eventpos()。y()pf。y()));277qrealdis2LTsqrt((eventpos()。x()moldRectPolygon。at(0)。x())(eventpos()。x()moldRectPolygon。at(0)。x())(eventpos()。y()moldRectPolygon。at(0)。y())(eventpos()。y()moldRectPolygon。at(0)。y()));278qrealdis2RTsqrt((eventpos()。x()moldRectPolygon。at(1)。x())(eventpos()。x()moldRectPolygon。at(1)。x())(eventpos()。y()moldRectPolygon。at(1)。y())(eventpos()。y()moldRectPolygon。at(1)。y()));279if(dis16dis2LTdis2RT)280{281282}283else284{285QRectFnewRect(moldRect);286newRect。setLeft(moldRect。right()dis);287newRect。setRight(moldRect。right());288setRectSize(newRect,false);289mRotateCenterQPointF((moldRectPolygon。at(0)。x()moldRectPolygon。at(2)。x())2,(moldRectPolygon。at(0)。y()moldRectPolygon。at(2)。y())2);290moldRect。moveCenter(mRotateCenter);291setRectSize(moldRect);292scene()update();必须要用scene()update(),不能用update();否则会出现重影293}294}295elseif(mStateFlagMOVTOPLINE)296{297底边中点298QPointFpfQPointF((moldRectPolygon。at(2)。x()moldRectPolygon。at(3)。x())2,((moldRectPolygon。at(2)。y()moldRectPolygon。at(3)。y())2));299计算到底边中点的距离300qrealdissqrt((eventpos()。x()pf。x())(eventpos()。x()pf。x())(eventpos()。y()pf。y())(eventpos()。y()pf。y()));301qrealdis2LTsqrt((eventpos()。x()moldRectPolygon。at(0)。x())(eventpos()。x()moldRectPolygon。at(0)。x())(eventpos()。y()moldRectPolygon。at(0)。y())(eventpos()。y()moldRectPolygon。at(0)。y()));302qrealdis2LBsqrt((eventpos()。x()moldRectPolygon。at(3)。x())(eventpos()。x()moldRectPolygon。at(3)。x())(eventpos()。y()moldRectPolygon。at(3)。y())(eventpos()。y()moldRectPolygon。at(3)。y()));303if(dis16dis2LTdis2LB)304{305306}307else308{309QRectFnewRect(moldRect);310newRect。setTop(moldRect。bottom()dis);311newRect。setBottom(moldRect。bottom());312setRectSize(newRect,false);313mRotateCenterQPointF((moldRectPolygon。at(0)。x()moldRectPolygon。at(2)。x())2,(moldRectPolygon。at(0)。y()moldRectPolygon。at(2)。y())2);314moldRect。moveCenter(mRotateCenter);315setRectSize(moldRect);316scene()update();必须要用scene()update(),不能用update();否则会出现重影317}318}319elseif(mStateFlagMOVRIGHTLINE)320{321QPointFpfQPointF((moldRectPolygon。at(0)。x()moldRectPolygon。at(3)。x())2,((moldRectPolygon。at(0)。y()moldRectPolygon。at(3)。y())2));322计算到左侧边中点的距离323qrealdissqrt((eventpos()。x()pf。x())(eventpos()。x()pf。x())(eventpos()。y()pf。y())(eventpos()。y()pf。y()));324qrealdis2LTsqrt((eventpos()。x()moldRectPolygon。at(0)。x())(eventpos()。x()moldRectPolygon。at(0)。x())(eventpos()。y()moldRectPolygon。at(0)。y())(eventpos()。y()moldRectPolygon。at(0)。y()));325qrealdis2RTsqrt((eventpos()。x()moldRectPolygon。at(1)。x())(eventpos()。x()moldRectPolygon。at(1)。x())(eventpos()。y()moldRectPolygon。at(1)。y())(eventpos()。y()moldRectPolygon。at(1)。y()));326if(dis16dis2LTdis2RT)327{328329}330else331{332QRectFnewRect(moldRect);333newRect。setLeft(moldRect。left());334newRect。setRight(moldRect。left()dis);335setRectSize(newRect,false);336mRotateCenterQPointF((moldRectPolygon。at(0)。x()moldRectPolygon。at(2)。x())2,(moldRectPolygon。at(0)。y()moldRectPolygon。at(2)。y())2);337moldRect。moveCenter(mRotateCenter);338setRectSize(moldRect);339scene()update();必须要用scene()update(),不能用update();否则会出现重影340}341}342elseif(mStateFlagMOVBOTTOMLINE)343{344顶边中点345QPointFpfQPointF((moldRectPolygon。at(0)。x()moldRectPolygon。at(1)。x())2,((moldRectPolygon。at(0)。y()moldRectPolygon。at(1)。y())2));346计算到底边中点的距离347qrealdissqrt((eventpos()。x()pf。x())(eventpos()。x()pf。x())(eventpos()。y()pf。y())(eventpos()。y()pf。y()));348qrealdis2LTsqrt((eventpos()。x()moldRectPolygon。at(0)。x())(eventpos()。x()moldRectPolygon。at(0)。x())(eventpos()。y()moldRectPolygon。at(0)。y())(eventpos()。y()moldRectPolygon。at(0)。y()));349qrealdis2LBsqrt((eventpos()。x()moldRectPolygon。at(3)。x())(eventpos()。x()moldRectPolygon。at(3)。x())(eventpos()。y()moldRectPolygon。at(3)。y())(eventpos()。y()moldRectPolygon。at(3)。y()));350if(dis16dis2LTdis2LB)351{352353}354else355{356QRectFnewRect(moldRect);357newRect。setTop(moldRect。top());358newRect。setBottom(moldRect。top()dis);359setRectSize(newRect,false);360mRotateCenterQPointF((moldRectPolygon。at(0)。x()moldRectPolygon。at(2)。x())2,(moldRectPolygon。at(0)。y()moldRectPolygon。at(2)。y())2);361moldRect。moveCenter(mRotateCenter);362setRectSize(moldRect);363scene()update();必须要用scene()update(),不能用update();否则会出现重影364}365}366}367368voidmyGraphicRectItem::mouseReleaseEvent(QGraphicsSceneMouseEventevent)369{370setCursor(Qt::ArrowCursor);371if(mStateFlagMOVRECT)372{373mStateFlagDEFAULTFLAG;374}375else{376QGraphicsItem::mouseReleaseEvent(event);377}378}379380voidmyGraphicRectItem::SetRotate(qrealRotateAngle)381{382mbR383mRotateAngleRotateA384setRectSize(moldRect);385if(thisscene()!nullptr)386thisscene()update();387}388389QPointFmyGraphicRectItem::getRotatePoint(QPointFptCenter,QPointFptIn,qrealangle)390{391doubledxptCenter。x();392doubledyptCenter。y();393doublexptIn。x();394doubleyptIn。y();395doublexx,396xx(xdx)cos(angleMPI180)(ydy)sin(angleMPI180)397yy(xdx)sin(angleMPI180)(ydy)cos(angleMPI180)398399returnQPointF(xx,yy);400}401402QListQPointFmyGraphicRectItem::getRotatePoints(QPointFptCenter,QListQPointFptIns,qrealangle)403{404QListQPointFlstPt;405for(inti0;iptIns。count();i)406{407lstPt。append(getRotatePoint(ptCenter,ptIns。at(i),angle));408}409returnlstPt;410}411412QPolygonFmyGraphicRectItem::getRotatePolygonFromRect(QPointFptCenter,QRectFrectIn,qrealangle)413{414QVectorQPointF415QPointFpfgetRotatePoint(ptCenter,rectIn。topLeft(),angle);416vpt。append(pf);417pfgetRotatePoint(ptCenter,rectIn。topRight(),angle);418vpt。append(pf);419pfgetRotatePoint(ptCenter,rectIn。bottomRight(),angle);420vpt。append(pf);421pfgetRotatePoint(ptCenter,rectIn。bottomLeft(),angle);422vpt。append(pf);423pfgetRotatePoint(ptCenter,rectIn。topLeft(),angle);424vpt。append(pf);425returnQPolygonF(vpt);426}427428QRectFmyGraphicRectItem::getCrtPosRectToSceen()429{430QRectFretRectQRectF(moldRect。x()pos()。x(),moldRect。y()pos()。y(),moldRect。width(),moldRect。height());431returnretR432}433434QPolygonFmyGraphicRectItem::getCrtPolygonToScreen()435{436QVectorQPointF437for(inti0;imoldRectPolygon。length();i)438{439vpt。append(QPointF(moldRectPolygon〔i〕。x()pos()。x(),moldRectPolygon〔i〕。y()pos()。y()));440}441returnQPolygonF(vpt);442}443QRectFmyGraphicRectItem::getSmallRotateRect(QPointFptA,QPointFptB)444{445QPointFptgetSmallRotateRectCenter(ptA,ptB);446returnQRectF(pt。x()10,pt。y()10,20,20);447}448QPointFmyGraphicRectItem::getSmallRotateRectCenter(QPointFptA,QPointFptB)449{450QPointFptCenterQPointF((ptA。x()ptB。x())2,(ptA。y()ptB。y())2);A,B点的中点C451中垂线方程式为452qrealx,y;旋转图标矩形的中心453if(abs(ptB。y()ptA。y())0。1)454{455if(ptA。x()ptB。x())矩形左上角在上方456{457xptCenter。x();458yptCenter。y()20;459}460else矩形左上角在下方461{462xptCenter。x();463yptCenter。y()20;464}465}466elseif(ptB。y()ptA。y())顺时针旋转0180467{468qrealk(ptA。x()ptB。x())(ptB。y()ptA。y());中垂线斜率469qrealb(ptA。y()ptB。y())2k(ptA。x()ptB。x())2;470求AB线中垂线上离AB中点20个像素的点C的坐标471x20cos(atan(k))ptCenter。x();472473}474elseif(ptB。y()ptA。y())顺时针旋转180360475{476qrealk(ptA。x()ptB。x())(ptB。y()ptA。y());中垂线斜率477qrealb(ptA。y()ptB。y())2k(ptA。x()ptB。x())2;478求AB线中垂线上离AB中点20个像素的点C的坐标479x20cos(atan(k))ptCenter。x();480481}482returnQPointF(x,y);483}
投诉 评论

积极向上的阳光短句,精致走心,宠辱不惊1、生活就是要逼自己,变得宠辱不惊,顽强不息。2、这世上,从来没有什么奇迹,只有你努力过后留下的痕迹。3、如果没有好运气,就拿出你的勇气去行动,总会遇到特定的惊喜。……Qt通过重写QGraphicItem实现绘制拖动旋转缩放椭圆本例程通过重写了一个类,继承自QGraphicItem,来实现了在qgraphicsScene上绘制、拖动、旋转、缩放椭圆效果如下:核心代码如下:mygrap……60岁后身体出现这5种变化,是衰老的正常现象,做好调养有助健衰老是人类必然出现的现象,很多人害怕衰老,但衰老不会因为你害怕就不来临。我们要做的就是发现衰老、迎接衰老,接受衰老,接受不等于无动于衷,我们要注意观察身体发生的变化,要找方法、……31!伊藤克星挺进4强,完胜36岁老将,冲击国乒三巨头,约战WTT新加坡大满贯的比赛继续进行,今天的比赛是女单和男单的14决赛,中国队的选手也是率先出战,王艺迪对阵袁嘉楠,上一场比赛,36岁的袁嘉楠31逆转击败了夺冠热门之一的伊藤美诚,……女足世界杯将首次为盲人有视力障碍的观众提供音频解说国际足联30日消息,2023年女足世界杯将首次为盲人和有视力障碍的观众提供音频解说服务。据国际足联介绍,该项解说服务的相关培训目前在澳大利亚的悉尼、墨尔本、布里斯班和新西……整点绝活!才是后二次元时代的下一个出路做二次元游戏,究竟还是不是一门好生意?前几年还是大中小厂商追捧的二次元游戏品类,在这两年的所处环境越来越尴尬了。在各家数据机构的观察中,中国二次元游戏市场仍还在增长……街拍舞会上的美女一场舞会百家争鸣,多少美女画上最满意的妆容,穿上最好看的裙子,把自己打扮的漂漂亮亮的,争着做舞会上最耀眼的明星!首先出场的是这位长发飘飘的美女。一身优雅的连衣裙映入……世界杯流量变现难,抖音狂砸10亿恐难回本编辑于斌出品潮起网于见专栏2022世界杯开赛后,毫无悬念地成为各大媒体的热门内容,相关热搜不断。随着网友的花样玩梗,拿到本届世界杯赛事转播权的抖音,也赚翻了网友的眼……超长花期!重庆潼南第十六届陈抟故里菜花节2月18日迎客来源:【重庆日报网】潼南区陈抟故里菜花盛景。潼南区委宣传部供图2月15日,重庆日报记者从重庆潼南第十六届陈抟故里菜花节新闻发布会上了解到,菜花节将于2月18日开幕,……分享5款windows必装的黑科技软件,款款都很实用,错过就哈喽大家好呀,我是分享科技小达人。我们的电脑上有非常多的好用软件,只是很少被人们发现,今天给大家分享5款电脑必装的windows软件,黑科技十足,一起来看看吧。第一……30岁以后,我不再做的10件事我是小言,一个专注个人成长和生活感悟的90后,关注我,和我一起提升自己,精进成长。年龄的增长,让我越发清楚自己想要的是什么。以下所有图片,侵删随着极简生活带给……争夺第一城,苏州瞄准万亿目标每经记者:淡忠奎每经编辑:刘艳美图片来源:摄图网501553625力争用五到八年的时间,加快打造万亿级汽车产业强市。在不久前举行的苏州市汽车及零部件企业座谈会上,苏……
不是深爱到什么都包容要想好三个条件再结你关注我、我陪你爱文丨萱小蕾、又名漠泱我们做事做决定的时候,未必都是深思熟虑,也未必会考虑周全,方方面面的问题也未必都知道。因为常识问题或是经验问题,又或者性……女生短发烫发哪些比较好看又萌又可爱快来种草啦女生短发烫发可以选择哪些发型呢?俏皮可爱当然首选泡面头啦,微微卷一卷,蓬松度高,显得脸超小,又萌又可爱。女生短发烫发哪些比较好看发质粗硬微卷烫:自然柔软的微卷……我和我的父辈徐峥这只鸭不仅巨会玩梗,还用喜剧包装出了双减时代眼下,电影国庆档每天都在创造新纪录。但要论会玩,谁也玩不过徐峥。竹外桃花三两枝,春江水暖鸭先知,他把苏轼写春色的诗句拍成了电影,在《我和我的父辈》中展现了改革开放初期我国第一支……这就是幸福夏日傍晚,我和妈妈去楼下水果店买水果。我一路跟在妈妈后面,一言不发。就这样走着,我四面张望,在路对面瞧见了幸福的一家三口。爸爸和妈妈都还年轻,大概三十岁出头的样子,……刘贺当了多久的皇帝最短命皇帝竟如此荒淫无度刘贺是我国历史上汉武帝刘彻的孙子,是西汉时期的第九位皇帝,也是西汉历史上在位时间最短的皇帝。那么,刘贺当了多久的皇帝呢?大家都只知道在位时间短暂但是却不知道具体多久,接下来为你……体验了6款车载智能语音助手后的总结目前智能汽车可以分为自动驾驶和智能座舱两大块,而智能座舱里的一个比较核心的能力就是只能语音助手,通过智能语音助手帮助用户去操控整个智能座舱,为用户提供服务。本文作者对智能座舱里……新生儿发热怎么降温宝宝发烧感冒是很正常的事情,但是在这样突发的情况下,宝宝爸妈们常常会手足无措,这样是无法照顾好生病的宝宝,那么,新生儿发热怎么降温呢?就让本站的小编和你一起去了解一下吧!……河里钓鲫鱼用什么饵料好鲫鱼是典型的杂食性淡水鱼类,荤素兼食,饵谱广泛,素饵主要有植物碎屑、根茎、枝叶、果实等,荤饵主要有浮游动物、虾类、螺类、水生昆虫及幼虫等,下面来看一看河里钓鲫鱼用什么饵料好吧!……人口新政下的计划生育工作转型摘要:近年来,我国经济社会发展迅速,但人口增长缓慢和人口结果失衡,国家即将进入老龄化阶段,促进人口增长,改变生育政策已经是当前的一项紧迫任务。为此,我国政府在2015年实施了全……一句话简短的心情句子有时候与其多心不如少根筋一、我相信,总会有不期而遇的温暖,和生生不息的希望,在不经意间出现在我的生命里。二、既然往事分为两种:与你相遇,期待与你相遇。那我的未来也注定只有两种形态:与你重逢,等待……你是否还热爱中国足球?2022年是一个传统意义上的足球大年,但对于中国球迷来说,在这个坎坷震荡中完成的赛季里,保持对足球的热爱并是一件不容易的事情。姗姗来迟的联赛,消失的国足。。。。。。一系列……京娱Meta的0撸套路深,网友质疑是资金盘骗局经常关注李旭反传防骗团队的小伙伴想必对资金盘已经非常了解了,它一般是指运用直销倍增原理,以滚动或静态的资金流通形式,拆东墙补西墙,用后加入会员的钱支付给前面会员的网络传销形式,……
友情链接:中准网聚热点快百科快传网快生活快软网快好知文好找