我们可以在QVideoWidget中包括并显示其他一些小部件吗?

时间:2018-09-29 02:12:35

标签: qt qt5 qvideowidget

我想在QVideoWidget中显示其他一些小部件,这样我就可以控制全屏播放视频,如以下代码所示:

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>VideoScreen</class>
 <widget class="QMainWindow" name="VideoScreen">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>800</width>
    <height>600</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <widget class="QVideoWidget" name="videoScreen">
   <widget class="QPushButton" name="play">
    <property name="geometry">
     <rect>
      <x>80</x>
      <y>240</y>
      <width>101</width>
      <height>31</height>
     </rect>
    </property>
    <property name="text">
     <string>Play</string>
    </property>
   </widget>
   <widget class="QPushButton" name="stop">
    <property name="geometry">
     <rect>
      <x>280</x>
      <y>170</y>
      <width>101</width>
      <height>31</height>
     </rect>
    </property>
    <property name="text">
     <string>Stop</string>
    </property>
   </widget>
  </widget>
 </widget>
 <customwidgets>
  <customwidget>
   <class>QVideoWidget</class>
   <extends>QWidget</extends>
   <header>QVideoWidget</header>
   <container>1</container>
  </customwidget>
 </customwidgets>
 <resources/>
 <connections/>
</ui>

enter image description here

(我使用设计器创建了一个.ui文件,以显示QMainWindow。为此,我将中央窗口小部件升级为QVideoWidget作为图像。)
当我播放视频时,仅显示视频,没有其他小部件,例如我在设计器中添加的按钮。

我只想问一下我们是否可以将小部件添加到QVideoWidget,然后在显示视频时让它们显示?

0 个答案:

没有答案
相关问题