【问题标题】:QLabel image rotate on another imageQLabel 图像在另一个图像上旋转
【发布时间】:2019-01-24 08:29:10
【问题描述】:

我尝试在 QLabel 上制作时钟并控制指针旋转

然后我把 needle.png 放在 clock.png 上。

我想控制角度,让 QLabel 像针在时钟上旋转一样工作。

我不知道如何旋转needle.png。

如何在clock.png上实现旋转needle.png。

【问题讨论】:

  • 您可以使用 QTransformation 并旋转图像

标签: c++ qt5 qlabel


【解决方案1】:

使用转换

QPixmap orig (":/n/apple-touch-icon.png");
QTransform t;
t.rotate(45+i);
ui->label->setPixmap(orig.transformed(t).scaledToWidth(32));
i+=10;

【讨论】:

  • 稍后谢谢我试试
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-10-19
  • 1970-01-01
  • 1970-01-01
  • 2011-12-13
  • 1970-01-01
相关资源
最近更新 更多