【问题标题】:Flipping a QGraphicsItem on the X-axis "inplace" (left / right)在 X 轴“就地”(左/右)上翻转 QGraphicsItem
【发布时间】:2012-05-27 22:21:05
【问题描述】:

我有一个QGraphicsSvgItem,并希望它的两个实例彼此面对。我已经认识到使用QGraphicsItem::setScale() 方法提到在负值的情况下翻转和旋转,但这并不是我想要的。

我可能只是缺少对基本转换的一些巧妙使用,但不知何故我还没有成功。使用 OpenGL,我可以为单轴设置缩放,这很成功。

【问题讨论】:

  • 请贴一些代码...

标签: c++ qt qt4 qgraphicsitem


【解决方案1】:

你可以使用QTransform:

item->setTransform(QTransform::fromScale(-1, 1));

【讨论】:

  • 你把我推向了正确的方向。与文档相反,setScale() 确实有两个参数。
  • 你的意思是scale(qreal,qreal),但这已经过时了。你应该改用QTransform
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2010-12-19
  • 1970-01-01
  • 1970-01-01
  • 2021-06-05
  • 1970-01-01
  • 1970-01-01
  • 2014-12-31
相关资源
最近更新 更多