资源简介

QT开发的flash播放器,播放器与flash媒体文件可以实现交互,通用性较强,适合初学者!

资源截图

代码片段和文件信息

#include “flashplyer.h“
#include “ui_flashplyer.h“

#include 
#include 
#include 

FlashPlyer::FlashPlyer(QWidget *parent) :
    QWidget(parent)
    ui(new Ui::FlashPlyer)
{
    ui->setupUi(this);
    this->setFocus();                                   //设置当前控件焦点为主窗口
    //1.界面属性设置,去除边框、全屏
//    this->setWindowFlags(Qt::framelessWindowHint);    //隐藏边框
//    this->showFullScreen();                           //设置全屏播放

    //2.加载flash界面模块设置
      QString DataName = qApp->applicationDirPath();
      QString urlOne = DataName+“/res/1.swf“;             //播放flash画面
      ui->FlashWidget->dynamicCall(“LoadMovie(longstring)“0urlOne);
      isOver = true;

    //3.延时操作
      timer = new QTimer;
      connect(timerSIGNAL(timeout())thisSLOT(loadFlash()));
}

FlashPlyer::~FlashPlyer()
{
    delete ui;
}

void FlashPlyer::keyPressEvent(QKeyEvent *event)
{

    if(event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
    {
        qDebug() << “Enter键被按下“;
        ui->fullScreen_btn->setVisible(false);
        this->setWindowFlags(Qt::framelessWindowHint);                          //隐藏边框
        this->showFullScreen();                                                 //设置全屏播放
        ui->FlashWidget->setFocus();                                            //设置当前控件焦点为flash播放控件
        LoadKeyboardLayout((LPCWSTR)QString(“0x0409“).utf16() KLF_ACTIVATE);   //设置输入法,“0x0409“为英文输入美式键盘

        }
     else if(event->key() == Qt::Key_D)
    {
        qDebug() << “D被按下“;
        //input code to do something
    }
    else if(event->key() == Qt::Key_Q)
   {
       qDebug() << “Q被按下“;
       ui->FlashWidget->setFocus();                     //设置当前控件焦点为flash播放控件
       LoadKeyboardLayout((LPCWSTR)QString(“0x0409“).utf16() KLF_ACTIVATE);
       keybd_event(81000);                           //模拟Q键输入,可与flash进行交互,flash响应对应操作
       //input code to do something
    }
}

void FlashPlyer::loadFlash()
{
    if(isOver == true)
    {
        QString DataName = qApp->applicationDirPath();
        QString urlTwo = DataName+“/res/2.swf“;             //播放flash画面
        ui->FlashWidget->dynamicCall(“LoadMovie(longstring)“0urlTwo);
        isOver = false;
    }
    else
    {
        QString DataName = qApp->applicationDirPath();
        QString urlOne = DataName+“/res/1.swf“;             //播放flash画面
        ui->FlashWidget->dynamicCall(“LoadMovie(longstring)“0urlOne);
        isOver = true;
    }
    timer->stop();
}


void FlashPlyer::on_FlashWidget_FSCommand(const QString &command const QString &args)
{
    qDebug() << command;
    if (0 == strcmp(“f“command.toLatin1()))//结束体验
    {
        qDebug() << “结束游戏“;
        timer->start(60000);
        //loadFlash();
        //input code to do something
    }
    else if (0 == strcmp(“k“command.toLatin1()))//题目答对
    {
        qDebug() << “回答正确“;
        //input code to do something
    }

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-01-28 12:42  FlashPlyerV1\
     文件        1070  2019-01-26 17:02  FlashPlyerV1\FlashPlyerV1.pro
     文件      104132  2019-01-28 12:41  FlashPlyerV1\FlashPlyerV1.pro.user
     文件        4036  2019-01-28 12:41  FlashPlyerV1\flashplyer.cpp
     文件        1055  2019-01-28 09:08  FlashPlyerV1\flashplyer.h
     文件        2919  2019-01-27 11:53  FlashPlyerV1\flashplyer.ui
     文件         183  2019-01-26 16:54  FlashPlyerV1\main.cpp
     目录           0  2019-01-28 12:44  Release\
     文件         943  2019-01-28 12:31  Release\.qmake.stash
     文件       28455  2019-01-28 12:31  Release\Makefile
     文件       46355  2019-01-28 12:31  Release\Makefile.Debug
     文件       46428  2019-01-28 12:31  Release\Makefile.Release
     目录           0  2019-01-28 12:44  Release\debug\
     目录           0  2019-01-28 12:44  Release\release\
     文件      277504  2019-01-28 12:41  Release\release\FlashPlyerV1.exe
     文件       22116  2019-01-28 12:41  Release\release\flashplyer.o
     文件        1476  2019-01-28 12:31  Release\release\main.o
     文件        4121  2019-01-28 12:31  Release\release\moc_flashplyer.cpp
     文件        8987  2019-01-28 12:31  Release\release\moc_flashplyer.o
     文件        9894  2019-01-28 12:31  Release\release\moc_predefs.h
     目录           0  2019-01-28 12:44  Release\release\res\
     文件     9899647  2019-01-22 16:20  Release\release\res\1.swf
     文件     9899647  2019-01-22 16:20  Release\release\res\2.swf
     文件        3848  2019-01-28 12:31  Release\ui_flashplyer.h

评论

共有 条评论