首页| 论坛| 消息

标题:QGraphicsView 仿visio部分功能(三)
作者:跑跑跑不动
日期:2020-04-13 15:46
内容:

本来想用ribbon的想想还是算了,然后随便找了个仿ribbon的库凑合用用。
目前对图形颜色、字体进行了优化。
整个程序可能就连接线移动算法稍微复杂一点吧。



然后分享一下画箭头一个通用算法吧,给定任意一条直线都能在线的endpos 或者startpos画出箭头

double arrowSize = 16.0;
double arrowAngle = 0.5;
QPointF startPos = this->line().p1();
QPointF endPos =this->line().p2();
double angle = atan2((endPos.y() - startPos.y()), (endPos.x() - startPos.x()));
m_arrowLine1->setLine(QLineF(endPos.x(),
endPos.y(),
endPos.x() - arrowSize*cos(angle + arrowAngle),
endPos.y() - arrowSize*sin(angle + arrowAngle)));
m_arrowLine2->setLine(QLineF(endPos.x(),
endPos.y(),
endPos.x() - arrowSize*cos(angle - arrowAngle),
endPos.y() - arrowSize*sin(angle - arrowAngle)));
最后还是给个体验版玩玩吧

链接:https://pan.baidu.com/s/1D5b4tty1Pgyz7icF2Iac-w
提取码:0rrd


#1 [gospite 04-13 17:13]

#2 [big_mouse 04-13 18:20]

#3 [lijun_ay 04-14 08:36]
厉害!
#4 [toby520 04-15 09:09]
最近也在研究graphicsview
#5 [li6622880 04-16 01:45]
能发给我看看嘛

<< 1 2 3 >> (1/3)

回复 发表
主题 版块