Qt/QML编程之路:QtMultimedia/Radio(41)

Qt有一个神奇的组件,那就是Qtmultimedia,它有强大的功能:

看看很多多媒体功能,都能在这里找到,不仅audio、video,还有camera、sound和radio。

比如:

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

相关推荐

  1. Qt/QML编程:qml通过C++传递变量给另一个qml(42)

    2024-01-25 11:56:03       58 阅读
  2. Qt/QML编程:线程及Slot的指针传递(47)

    2024-01-25 11:56:03       36 阅读
  3. IOS面试题编程机制 41-45

    2024-01-25 11:56:03       39 阅读
  4. Day41 HTTP编程

    2024-01-25 11:56:03       32 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-25 11:56:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-25 11:56:03       101 阅读
  3. 在Django里面运行非项目文件

    2024-01-25 11:56:03       82 阅读
  4. Python语言-面向对象

    2024-01-25 11:56:03       91 阅读

热门阅读

  1. Spark累加器LongAccumulator

    2024-01-25 11:56:03       49 阅读
  2. 【笔记】Helm-4 最佳实践-依赖

    2024-01-25 11:56:03       57 阅读
  3. harmonyOS app 开发环境配置流程

    2024-01-25 11:56:03       51 阅读
  4. 安卓MediaRecorder(4)视频采集编码写入详细源码分析

    2024-01-25 11:56:03       67 阅读
  5. Jenkins相关

    2024-01-25 11:56:03       56 阅读
  6. android:excludeFromRecents

    2024-01-25 11:56:03       40 阅读