1

我可以QPixmap用这样的代码旋转

  QPixmap pix("img.jpg");
  QMatrix rm;
  rm.rotate(90);
  pix = pix.transformed(rm)

我该怎么做QMovie呢?还是以某种方式将其包装到某个“容器”中并旋转该“容器”?

4

1 回答 1

0

您可以尝试逐帧旋转。例如:

m_movie = new QMovie(":/gif/tenor.gif");
connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(OnFrameChanged(int)));
ui->lblMovie->setMovie(m_movie);
m_movie->start();

并在帧更改时旋转每一帧

void MainWindow::OnFrameChanged(int /*frame*/)
{
    QPixmap pixmap = m_movie->currentPixmap();
    QMatrix rm;
    rm.rotate(90);
    pixmap = pixmap.transformed(rm);
    ui->lblMovRotated->setPixmap(pixmap);
}
于 2019-10-06T08:56:03.940 回答