昆仑山:眼中无形心中有穴之穴人合一

夫君子之行,静以修身,俭以养德;非澹泊无以明志,非宁静无以致远。夫学须静也,才须学也;非学无以广才,非志无以成学。怠慢则不能励精,险躁则不能冶性。年与时驰,意与岁去,遂成枯落,多不接世。悲守穷庐,将复何及!

 

QT艺术编程(视频播放器)

无界面视频播放器

#-------------------------------------------------
#
# Project created by QtCreator 2018-12-13T23:53:00
#
#-------------------------------------------------

QT       += core gui multimedia multimediawidgets

CONFIG += resources_big

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = CheckVideo
TEMPLATE = app

# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

CONFIG += c++11

SOURCES += \
        main.cpp \
        dialog.cpp

HEADERS += \
        dialog.h

FORMS += \
        dialog.ui

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target


#include "dialog.h"
#include <QApplication>

#include<QMediaPlayer>
#include<QVideoWidget>
#include<QDebug>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    //Dialog w;
   // w.show();

    QMediaPlayer *player=new QMediaPlayer;
    QVideoWidget *videoWidget=new QVideoWidget;

    player->setVideoOutput(videoWidget);

    player->setMedia(QUrl::fromLocalFile("C:/Users/happy/Desktop/the story of spring.mp4"));
    videoWidget->setGeometry(100,100,300,400);
    videoWidget->show();

    player->play();

    qDebug()<<player->state();


    return a.exec();
}


posted on 2018-12-14 01:04  Indian_Mysore  阅读(148)  评论(3编辑  收藏  举报

导航