Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGraphicsVideoItem mirror ?
Qt 6.11 is out! See what's new in the release blog

QGraphicsVideoItem mirror ?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • sonichyS Offline
    sonichyS Offline
    sonichy
    wrote on last edited by
    #1
    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
    

    https://github.com/sonichy

    B 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • sonichyS sonichy
        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
        
        B Offline
        B Offline
        Bonnie
        wrote on last edited by Bonnie
        #3

        @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);
        
        sonichyS 1 Reply Last reply
        1
        • B Bonnie

          @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);
          
          sonichyS Offline
          sonichyS Offline
          sonichy
          wrote on last edited by
          #4

          @Bonnie It seems must use this format:

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

          https://github.com/sonichy

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved