音视频播放
这里简单的制作了一个音乐播放器,播放器的界面设计如下所示:
Step1:这里是界面对应的HTML文件:
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>MainWindow</class> <widget class="QMainWindow" name="MainWindow"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>400</width> <height>300</height> </rect> </property> <property name="windowTitle"> <string>MainWindow</string> </property> <widget class="QWidget" name="centralWidget"> <widget class="QPushButton" name="Play_Puase"> <property name="geometry"> <rect> <x>120</x> <y>160</y> <width>31</width> <height>31</height> </rect> </property> <property name="text"> <string>Play</string> </property> </widget> <widget class="QPushButton" name="NextSong"> <property name="geometry"> <rect> <x>10</x> <y>150</y> <width>81</width> <height>27</height> </rect> </property> <property name="text"> <string>Next Song</string> </property> </widget> <widget class="QLabel" name="label"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>321</width> <height>51</height> </rect> </property> <property name="font"> <font> <pointsize>28</pointsize> <italic>true</italic> <underline>false</underline> <strikeout>false</strikeout> </font> </property> <property name="cursor"> <cursorShape>BlankCursor</cursorShape> </property> <property name="text"> <string>Qt interface Demo!</string> </property> <property name="alignment"> <set>Qt::AlignCenter</set> </property> </widget> <widget class="QDial" name="Volume"> <property name="geometry"> <rect> <x>180</x> <y>150</y> <width>50</width> <height>64</height> </rect> </property> <property name="value"> <number>50</number> </property> </widget> <widget class="QSlider" name="SongChoose"> <property name="geometry"> <rect> <x>10</x> <y>210</y> <width>231</width> <height>29</height> </rect> </property> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> </widget> <widget class="QPushButton" name="PrevSong"> <property name="geometry"> <rect> <x>10</x> <y>180</y> <width>81</width> <height>27</height> </rect> </property> <property name="text"> <string>Prev Song</string> </property> </widget> <widget class="QLabel" name="label_2"> <property name="geometry"> <rect> <x>0</x> <y>50</y> <width>171</width> <height>51</height> </rect> </property> <property name="font"> <font> <pointsize>22</pointsize> <italic>true</italic> <underline>false</underline> <strikeout>false</strikeout> </font> </property> <property name="cursor"> <cursorShape>BlankCursor</cursorShape> </property> <property name="text"> <string>Music Player</string> </property> <property name="alignment"> <set>Qt::AlignCenter</set> </property> </widget> <widget class="QLabel" name="label_3"> <property name="geometry"> <rect> <x>20</x> <y>110</y> <width>171</width> <height>21</height> </rect> </property> <property name="font"> <font> <pointsize>10</pointsize> <italic>true</italic> <underline>false</underline> <strikeout>false</strikeout> </font> </property> <property name="cursor"> <cursorShape>BlankCursor</cursorShape> </property> <property name="text"> <string>Designed by : mm1994uestc</string> </property> <property name="alignment"> <set>Qt::AlignCenter</set> </property> </widget> <widget class="QLabel" name="singer"> <property name="geometry"> <rect> <x>220</x> <y>220</y> <width>161</width> <height>21</height> </rect> </property> <property name="font"> <font> <pointsize>10</pointsize> <italic>true</italic> <underline>false</underline> <strikeout>false</strikeout> </font> </property> <property name="cursor"> <cursorShape>BlankCursor</cursorShape> </property> <property name="text"> <string>Singer:</string> </property> <property name="alignment"> <set>Qt::AlignCenter</set> </property> </widget> <widget class="QLabel" name="title"> <property name="geometry"> <rect> <x>260</x> <y>170</y> <width>61</width> <height>21</height> </rect> </property> <property name="font"> <font> <pointsize>10</pointsize> <italic>true</italic> <underline>false</underline> <strikeout>false</strikeout> </font> </property> <property name="cursor"> <cursorShape>BlankCursor</cursorShape> </property> <property name="text"> <string>Title:</string> </property> <property name="alignment"> <set>Qt::AlignCenter</set> </property> </widget> <widget class="QLabel" name="ArtCover"> <property name="geometry"> <rect> <x>260</x> <y>60</y> <width>90</width> <height>90</height> </rect> </property> <property name="text"> <string> Art_Cover</string> </property> </widget> </widget> <widget class="QMenuBar" name="menuBar"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>400</width> <height>25</height> </rect> </property> <widget class="QMenu" name="menuFile"> <property name="title"> <string>File</string> </property> <addaction name="actionOpenLocalMedia"/> </widget> <addaction name="menuFile"/> </widget> <widget class="QToolBar" name="mainToolBar"> <attribute name="toolBarArea"> <enum>TopToolBarArea</enum> </attribute> <attribute name="toolBarBreak"> <bool>false</bool> </attribute> </widget> <widget class="QStatusBar" name="statusBar"/> <action name="actionOpenLocalMedia"> <property name="text"> <string>OpenLocalMedia</string> </property> </action> </widget> <layoutdefault spacing="6" margin="11"/> <resources/> <connections/> </ui>