Qt有一个神奇的组件,那就是Qtmultimedia,它有强大的功能:
看看很多多媒体功能,都能在这里找到,不仅audio、video,还有camera、sound和radio。文章来源:https://www.toymoban.com/news/detail-823247.html
比如:文章来源地址https://www.toymoban.com/news/detail-823247.html
import QtQuick 2.0
import QtMultimedia 5.0
Text {
text: "Press Me!"
font.pointSize: 24
Audio {
id: playMusic
source: "/usr/share/sounds/pop.wav" // Point this to a suitable sound file
}
MouseArea {
anchors.fill: parent
onPressed: playMusic.play()
}
}
import QtQuick 2.0
import QtMultimedia 5.0
Text {
text: "Press Me!"
font.pointSize: 24
SoundEffect {
id: playMusic
source: "/usr/share/sounds/pop.wav" // Point this to a suitable sound file
}
MouseArea {
anchors.fill: parent
onPressed: playMusic.play()
}
}
impor
到了这里,关于Qt/QML编程之路:QtMultimedia/Radio(41)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!