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. Problem resizing QGraphicsVideoItem / QGraphicsScene
Forum Updated to NodeBB v4.3 + New Features

Problem resizing QGraphicsVideoItem / QGraphicsScene

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.6k 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.
  • A Offline
    A Offline
    AlterX
    wrote on last edited by
    #1

    Hi there...
    I'm creating my own app to play different videos in parallel. I've started using Qt example "videographicsitem" and so my code looks like this:
    @
    videoItem = new QGraphicsVideoItem;

    QGraphicsScene *scene = new QGraphicsScene(this);
    QGraphicsView *graphicsView = new QGraphicsView(scene);
    scene->addItem(videoItem);
    
    QBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(graphicsView);
    setLayout(layout);
    mediaPlayer.setVideoOutput(videoItem);
    

    @

    Ok, so I have to resize my graphicsview using mouse preserving aspectrazio and this works very well using this code:
    @
    QGraphicsView *view = NULL;

    view = this->findChild<QGraphicsView*>("graphView");
    view->fitInView(videoItem, Qt::KeepAspectRatio);
    

    @
    in the resizeEvent of VideoPlayer's parent.
    My problem is that code above doesn't do nothing if I just put VideoPlayer widget (using setGeometry); video inside is not fit and I have to resize with mouse to get video fitted.

    Someone knows how I can properly fit video just setting dimension with setGeometry()?

    thanks in advance
    Gianni

    Qt Ambassador
    Real-time cooperative teams: http://www.softairrealfight.net
    Free Real-time network platform sdk: https://github.com/AlterX76/Solomon

    https://codereview.qt-project.org/...

    1 Reply Last reply
    0

    • Login

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