QPixmal在旋转後会被截掉一部分(用QgraphicsView显示)

stereoMatching 2012-11-26 04:35:02

QImage img("lena.jpg");

rotate_image_implace(img, angle); //rotate the img with angle degrees(90, 180, 270 and so on)

graph_scene_ = new QGraphicsScene(this);
graph_scene_->addItem(graph_pixmap_ = new QGraphicsPixmapItem);
graph_view_ = new QGraphicsView(graph_scene_, this);

graph_pixmap_->setPixmap(QPixmap::fromImage(img));
graph_scene_->setSceneRect(img.rect());


graph_pixmap_ 的type是 QGraphicsPixmapItem
graph_scene_ 的type是 QGraphicsScene
graph_view_ 的type是 QGraphicsView

我把image的像素以90度的倍数旋转,旋转後有时候会造成图片的一部分被截掉
请问我该怎麽解决这个问题?我本想使用QGraphicsItem的rotation来解决,
但是我需要储存的是实际被旋转过後的图片,所以最後还是自己动手把图片转过来

...全文
147 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
stereoMatching 2012-11-26
  • 打赏
  • 举报
回复
不是Qt的问题,原因出在我自己产生的图片大小错误

16,818

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧