QT QGraphicsView 画线

QT

 QGraphicsScene scene;
 scene.addText("Hello, world!");

 QGraphicsView view(&scene);
 view.show();

GraphicsScene *scene () const//通过函数返回scene

Returns a pointer to the scene that is currently visualized in the view. If no scene is currently visualized, 0 is returned.

See also setScene().


std::vector<QGraphicsLineItem*> _xItem;

第一步//把线条添加到Vector 数组

for (int i = 0; i <i; ++i)

{

_yRect.push_back(scene->addLine(0,0,0,0,Normal_First_Circle_Pen);//把线条添加到Vector 数组
}

第二步//设置项的画线
for (int i = 0; i <i; ++i)

{

_xItem;[i]->setRect(x, (gap)*i, posA, yh);

}

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值