Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In my option I would not touch Phonon implementation at all. Rather then trying to re-implement the Phonon::VideoWidget I would create an overlay using QStackedLayout. here is your example modified </p> <pre><code>//Qt #include &lt;QApplication&gt; #include &lt;QWidget&gt; #include &lt;QUrl&gt; #include &lt;QObject&gt; #include &lt;QStackedLayout&gt; #include &lt;QVBoxLayout&gt; #include &lt;QHBoxLayout&gt; #include &lt;QLabel&gt; //Phonon #include &lt;Phonon/AudioOutput&gt; #include &lt;Phonon/MediaObject&gt; #include &lt;Phonon/MediaSource&gt; #include &lt;Phonon/VideoWidget&gt; #include &lt;Phonon/VolumeSlider&gt; #include &lt;Phonon/SeekSlider&gt; int main(int argc, char *argv[]) { QApplication app(argc, argv); QWidget *widget = new QWidget; widget-&gt;setWindowTitle("Media Player"); widget-&gt;resize(400,400); Phonon::MediaObject *media = new Phonon::MediaObject; media-&gt;setCurrentSource(Phonon::MediaSource("test.avi")); Phonon::VideoWidget *vwidget = new Phonon::VideoWidget(widget); Phonon::createPath(media, vwidget); vwidget-&gt;setAspectRatio(Phonon::VideoWidget::AspectRatioAuto); Phonon::AudioOutput *aOutput = new Phonon::AudioOutput(Phonon::VideoCategory); Phonon::createPath(media, aOutput); QLabel *label = new QLabel("Volume: "); Phonon::VolumeSlider *volumeSlider = new Phonon::VolumeSlider; volumeSlider-&gt;setAudioOutput(aOutput); volumeSlider-&gt;setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); Phonon::SeekSlider *seekSlider = new Phonon::SeekSlider; seekSlider-&gt;setMediaObject(media); QHBoxLayout *hLayout = new QHBoxLayout; hLayout-&gt;addWidget(label); hLayout-&gt;addWidget(volumeSlider); hLayout-&gt;addStretch(); QStackedLayout *videoStack = new QStackedLayout; QWidget *myOverlay = new QWidget; myOverlay-&gt;setFixedSize(100, 100); QVBoxLayout *l_overlayLayout = new QVBoxLayout; l_overlayLayout-&gt;addWidget(label); myOverlay-&gt;setLayout(l_overlayLayout); videoStack-&gt;addWidget(vwidget); videoStack-&gt;addWidget(myOverlay); videoStack-&gt;setStackingMode(QStackedLayout::StackAll); QVBoxLayout *vLayout = new QVBoxLayout; vLayout-&gt;addLayout(videoStack); vLayout-&gt;addWidget(seekSlider); vLayout-&gt;addLayout(hLayout); widget-&gt;setLayout(vLayout); widget-&gt;show(); media-&gt;play(); return app.exec(); </code></pre> <p>}</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.
    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