Note that there are some explanatory texts on larger screens.

plurals
  1. POTransparency of QDeclarativeView containing QML on top of a QWidget playing a video (using either phonon or libvlc)
    primarykey
    data
    text
    <p>I am currently developing a video player.</p> <p>The GUI as the topmost layer is written in QML. It should be transparent to lower layers. It contains control elements, some Lists etc., It's displayed using a <code>QDeclarativeView</code>. </p> <h2>Description</h2> <pre><code> QDeclarativeView *upperLayer = new QDeclarativeView(this); upperLayer-&gt;setSource(QUrl("/home/projects/QtVideo/qml/videoControl.qml")); upperLayer-&gt;setStyleSheet(QString("background: transparent"); upperLayer-&gt;setResizeMode(QDeclarativeView::SizeRootObjectToView); uperLayer-&gt;showFullScreen(); </code></pre> <p>The layer underneath is a QWidget: I use the libvlc to display the video content in this widget.</p> <p>Reason: I am receiving MPEG-TS, which can not be decoded by phonon, afaik. Therefore I need the libvlc to decode the incoming <code>*.ts</code> stream and put the output onto the display.</p> <pre><code>QWidget *lowerLayer = new QWidget(this); lowerLayer.setGeometry(QString("background: red")); QUrl* url = new QUrl("file:///home/projects/QtVideo/video.ts"); libvlc_instance_t*vlcObject; libvlc_media_t*vlcMedia; libvlc_media_player_t*vlcPlayer; vlcPlayer = NULL; if(vlcObject = libvlc_new(argc, argv)) == NULL) { printf("Not able to initialize"; exit(1); } if(vlcPlayer &amp;&amp; libvlc_media_player_is_playing(vlcPlayer)) { libvlc_media_player_stop(vlcPlayer); } vlcPlayer = libvlc_media_player_new(vlcObject); vlcMedia = libvlc_media_new_location(vlcObject, url.toString().toUtf8().constData()); libvlc_media_player_set_media(vlcPlayer, vlcMedia); #if defined(Q_OS_MAC) libvlc_media_player_set_nsobject(vlcPlayer, lowerLayer-&gt;winId()); #elif defined(Q_OS_UNIX) libvlc_media_player_set_x_window(vlcPlayer, lowerLayer-&gt;winId()); #elif defined(Q_OS_WIN) libvlc_media_player_set_hwnd(vlcPlayer, lowerLayer-&gt;winId()); #endif libvlc_media_player_play(vlc_player); </code></pre> <p>Both Elements, the <code>QDeclarativeView</code> and the <code>QWidget</code> are embedded in a <code>QMainWindow</code>, lowerLayer created before the <code>upperLayer</code>, <code>upperLayer</code> Transparent to the <code>lowerLayer</code>.</p> <h2>The Problem:</h2> <p>As long as the lowerLayer is displaying static elements such as a picture, or some colored shapes, everything works fine, full transparency and functionality.</p> <p>As soon as I start displaying a video, such as the described <code>*.ts</code> using the libvlc OR some random video using the <code>Phonon::VideoPlayer</code>, the parts of the <code>upperLayer</code> which are above the video parts of the <code>lowerLayer</code> are displayed in the color of the <code>lowerLayer(default: gray)</code>, the parts of the <code>upperLayer</code> which are positioned above parts of the <code>lowerLayer</code> or others which do not contain video elements are displayed in correct behaviour.</p> <h2>Question:</h2> <p>Is there any posibility and if, how, to get the upperLayer transparent, even if there is a video playing?</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.
 

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