Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QGraphicsVideoItem mirror ?



  • QGraphicsScene *scene = new QGraphicsScene;
    QGraphicsVideoItem *GVI = new QGraphicsVideoItem;
    GVI->setSize(QSizeF(800,600));
    scene->addItem(GVI);
    ui->graphicsView->setScene(scene);
    QMediaPlayer *player = new QMediaPlayer;
    player->setVideoOutput(GVI);
    //GVI.scale(-1,1);    // QT_DEPRECATED_SINCE(5, 0) ?
    GVI->setTransform(QTransform::fromScale(-1, 1));    // QMediaPlayer stopped and can not play anymore
    

  • Lifetime Qt Champion

    Hi,

    What version of Qt ?
    What OS ?
    What video file format ?
    What is exactly the question ?



  • @sonichy Does the sound stop too? When I tried, the mediaplayer does not stop, but the video moved to somewhere invisible.
    Try

    //the center of video
    qreal x = GVI->boundingRect().width() / 2.0;
    qreal y = GVI->boundingRect().height() / 2.0;
    GVI->setTransform(QTransform().translate(x, y).scale(-1, 1).translate(-x, -y), true);
    


  • @Bonnie It seems must use this format:

    setTransform(QTransform().translate(x, y).scale(-1, 1).translate(-x, -y), 
    

Log in to reply