日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Qt视频播放器界面Demo

發布時間:2023/12/10 编程问答 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Qt视频播放器界面Demo 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

QMPlayer

Qt實現的視頻播放器界面Demo。

文章目錄

    • QMPlayer
      • 1、實現功能
      • 2、演示
      • 3、動畫效果代碼
      • 4、源代碼

更多精彩內容
👉個人內容分類匯總 👈

1、實現功能

  • 基于QMWidget的自定義窗口;
  • 增加側邊欄模塊;
  • 增加播放控制欄模塊,包含播放停止、上一集、下一集、視頻時間、音量控制、設置功能按鍵樣式
  • 增加進度條模塊,可跳轉到鼠標點擊位置
  • 通過QPropertyAnimation實現側邊欄、進度條、控制欄打開關閉動畫效果;
  • 實現雙擊全屏顯示、還原效果。

2、演示

3、動畫效果代碼

#include "controlbar.h" #include "ui_controlbar.h"#include <qdebug.h> #include <qpropertyanimation.h> #include <QStyle>ControlBar::ControlBar(QWidget *parent) :QWidget(parent),ui(new Ui::ControlBar) {ui->setupUi(this);m_paShow = new QPropertyAnimation(this, "pos");m_paShow->setDuration(500);connect(m_paShow, &QPropertyAnimation::finished, this, &ControlBar::on_finished);}ControlBar::~ControlBar() {delete ui; }/*** @brief 打開顯示動畫(注意必須放在窗口改變后面,如全屏顯示、還原)*/ void ControlBar::show() {QWidget::show();int y = this->parentWidget()->height() - this->height() - 20;m_paShow->setStartValue(QPoint(this->x(), this->parentWidget()->height()));m_paShow->setEndValue(QPoint(this->x(), y));m_paShow->setEasingCurve(QEasingCurve::OutQuad);m_paShow->start(); }/*** @brief 關閉顯示動畫(注意必須放在窗口改變后面,如全屏顯示、還原)*/ void ControlBar::hide() {int y = this->parentWidget()->height() - this->height() - 20;m_paShow->setStartValue(QPoint(this->x(), y));m_paShow->setEndValue(QPoint(this->x(), this->parentWidget()->height()));m_paShow->setEasingCurve(QEasingCurve::Linear);m_paShow->start(); }void ControlBar::on_finished() {if(m_paShow->endValue().toPoint().y() == this->parentWidget()->height()){QWidget::hide();} }void ControlBar::on_but_play_clicked() {if(m_play){}else{}m_play = !m_play;ui->but_play->setProperty("play", m_play);ui->but_play->style()->polish(ui->but_play); }void ControlBar::on_but_volume_clicked() {m_volume = !m_volume;ui->but_volume->setProperty("setup", m_volume);ui->but_volume->style()->polish(ui->but_volume); }

4、源代碼

gitee
github

總結

以上是生活随笔為你收集整理的Qt视频播放器界面Demo的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。