找回密码
 立即注册
收起左侧

关于qgraphicsitem旋转后setpos无效

0
回复
6284
查看
[复制链接]
累计签到:5 天
连续签到:1 天
来源: 2017-8-29 16:11:21 显示全部楼层 |阅读模式
1Qter豆
在scene中,点击左旋右旋后,记录旋转角度在m_rotateAngle,      
        QPixmap bgPixmap(posWidth,posHeight);
        bgPixmap.fill(Qt::white);
        QGraphicsPixmapItem* curBg = new QGraphicsPixmapItem(bgPixmap);
        this->addItem(curBg);

        QPointF center = curBg->boundingRect().center();
        curBg->setTransformOriginPoint(center);
        curBg->setRotation(m_rotateAngle);
        curBg->setPos(0,0);//posX,posY
首先旋转,然后平移setpos,因为旋转后图形超出scenerect,导致一部分图形没有显示出来,且旋转多次后代码跑飞,求助如何实现左旋右旋,


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

公告
可以关注我们的微信公众号yafeilinux_friends获取最新动态,或者加入QQ会员群进行交流:190741849、186601429(已满) 我知道了