Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat Qt GUI Containers to use? Also Related Video Display issue - Windows 7
    primarykey
    data
    text
    <p>I am trying to design an application to play multiple video (media) files and allow user modification capability on each one (eg, scaling, rotating, inverting etc of videos). I started by studying <code>Phonon</code>, but after going into it for a while read that it is no longer supported (or its support is doubtful) in >= <code>Qt5</code>. So then i went back and now i'm looking at qtmultimedia - <code>QMediaPlayer</code>. Though I have come from c#-WPF background i have done some earlier work on Qt-C++. But this time I'm stuck and confused on what widgets i must use. <code>QMediaPlayer</code> can show its output (video) on <code>QVideoWidget</code>, <code>QGraphicsVideoItem</code> and <code>QAbstractVideoSurface</code>. Since I need the capabilities of rotation etc, i believe i must incorporate QGraphicsScene/View.</p> <p>&lt;1> So what should the approach be? I did this: used <code>QVideoWidget</code> -> added this to <code>QGraphicsProxyWidget</code> via its <code>setWidget</code>() (though <code>setWidget</code>() takes <code>QWidget</code>* and <code>QVideoWidget</code> is not derived from <code>QWidget</code> as i see in Qt Assistant -- why is this allowed btw?) -> Added this <code>QGraphicProxyWidget</code> to <code>QGraphicsScene</code> via <code>addItem</code>() -> added this <code>QGraphicsScene</code> to <code>QGraphicsView</code> while constructing it -> added <code>QGraphicsView</code> to <code>QMainWindow</code> via <code>setCentralWidget</code>(). Is this fine? When to use <code>QGraphicsVideoItem</code> and <code>QAbstractVideoSurface</code>?</p> <p>&lt;2> When adding multiple <code>QVideoWidget</code> in the following manner i don't see any video or the <code>QVideoWidget</code> itself (i've painted to distinguish it). What am i doing wrong? (there is audio output though):</p> <pre><code> QVideoWidget *pVideoWidget1 = new QVideoWidget(0); pVideoWidget1-&gt;setPalette(QPalette(QColor(255,0,0),QColor(0,255,0))); QVideoWidget *pVideoWidget2 = new QVideoWidget(0); pVideoWidget2-&gt;setPalette(QPalette(QColor(255,0,0),QColor(0,0,255))); m_pMediaPlayer1 = new QMediaPlayer(this); m_pMediaPlayer2 = new QMediaPlayer(this); m_pMediaPlayer1-&gt;setVideoOutput(pVideoWidget1); m_pMediaPlayer2-&gt;setVideoOutput(pVideoWidget2); m_pCustomGraphicsProxy1 = new CustomGraphicsProxy(0); //this is just a class derived from QGraphicsProxyWidget to implement drag and drop of videos m_pCustomGraphicsProxy2 = new CustomGraphicsProxy(0); m_pCustomGraphicsProxy1-&gt;setWidget(pVideoWidget1); m_pCustomGraphicsProxy2-&gt;setWidget(pVideoWidget2); QGraphicsScene *pGraphicsScene = new QGraphicsScene(this); QGraphicsLinearLayout *pGraphicsLinearLayout = new QGraphicsLinearLayout; CustomGraphicsProxy* button = new CustomGraphicsProxy(0); button-&gt;setWidget(new QPushButton); //this i can see CustomGraphicsProxy* button1 = new CustomGraphicsProxy(0); button1-&gt;setWidget(new QPushButton); //this i can see too pGraphicsLinearLayout-&gt;addItem(button); pGraphicsLinearLayout-&gt;addItem(m_pCustomGraphicsProxy1); //can't see pGraphicsLinearLayout-&gt;addItem(m_pCustomGraphicsProxy2); //can't see pGraphicsLinearLayout-&gt;addItem(button1); CustomGraphicsProxy *temp = new CustomGraphicsProxy(0); temp-&gt;setLayout(pGraphicsLinearLayout); pGraphicsScene-&gt;addItem(temp); temp-&gt;show(); m_pGraphicsView = new QGraphicsView(pGraphicsScene, this); setCentralWidget(m_pGraphicsView); QObject::connect(m_pCustomGraphicsProxy1, SIGNAL(sigNewFileDragDropped()), this, SLOT(sloPlayOnWindow1())); QObject::connect(m_pCustomGraphicsProxy2, SIGNAL(sigNewFileDragDropped()), this, SLOT(sloPlayOnWindow2())); //just for testing - this gives only audio no video can be seen m_pMediaPlayer1-&gt;setMedia(QUrl::fromLocalFile("d:/z.avi")); m_pMediaPlayer1-&gt;play(); </code></pre> <p>&lt;3> Before i study this further, am i choosing the right tools in Qt to manipulate videos as i mentioned before or something else needs to be done?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload