更新代码

master
feiyangqingyun 2022-11-01 14:28:21 +08:00
parent 76e0c53924
commit f91db84098
20 changed files with 362 additions and 348 deletions

View File

@ -49,7 +49,7 @@
| tool | 工具相关 | livedemo | 程序启动示例 | | tool | 工具相关 | livedemo | 程序启动示例 |
| video | 视频播放 | videobox | **视频监控布局** | | video | 视频播放 | videobox | **视频监控布局** |
| video | 视频播放 | videopanel | **视频监控面板** | | video | 视频播放 | videopanel | **视频监控面板** |
| video | 视频播放 | videowidget | 视频监控控件 | | video | 视频播放 | videowindow | 视频监控控件 |
| video | 视频播放 | playffmpeg | 视频播放ffmpeg | | video | 视频播放 | playffmpeg | 视频播放ffmpeg |
| video | 视频播放 | playvlc | 视频播放vlc | | video | 视频播放 | playvlc | 视频播放vlc |
| video | 视频播放 | plaympv | 视频播放mpv | | video | 视频播放 | plaympv | 视频播放mpv |
@ -144,8 +144,8 @@
![](video/0snap/videobox.jpg) ![](video/0snap/videobox.jpg)
- 视频监控面板-videopanel - 视频监控面板-videopanel
![](video/0snap/videopanel.jpg) ![](video/0snap/videopanel.jpg)
- 视频监控控件-videowidget - 视频监控控件-videowindow
![](video/0snap/videowidget.jpg) ![](video/0snap/videowindow.jpg)
- 视频播放ffmpeg-playffmpeg - 视频播放ffmpeg-playffmpeg
![](video/0snap/playffmpeg.jpg) ![](video/0snap/playffmpeg.jpg)
- 视频播放vlc-playvlc - 视频播放vlc-playvlc

View File

@ -2,6 +2,8 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport
greaterThan(QT_MAJOR_VERSION, 4): CONFIG += c++11 greaterThan(QT_MAJOR_VERSION, 4): CONFIG += c++11
#lessThan(QT_MAJOR_VERSION, 5): QMAKE_CXXFLAGS += -std=c++11 #lessThan(QT_MAJOR_VERSION, 5): QMAKE_CXXFLAGS += -std=c++11
DEFINES += qcustomplot
#引入平滑曲线类 #引入平滑曲线类
HEADERS += $$PWD/smoothcurve.h HEADERS += $$PWD/smoothcurve.h
SOURCES += $$PWD/smoothcurve.cpp SOURCES += $$PWD/smoothcurve.cpp

View File

@ -32,10 +32,10 @@ QImage Base64Helper::base64ToImagex(const QByteArray &data)
QString Base64Helper::textToBase64(const QString &text) QString Base64Helper::textToBase64(const QString &text)
{ {
return QString(text.toLocal8Bit().toBase64()); return QString(text.toUtf8().toBase64());
} }
QString Base64Helper::base64ToText(const QString &text) QString Base64Helper::base64ToText(const QString &text)
{ {
return QString(QByteArray::fromBase64(text.toLocal8Bit())); return QString(QByteArray::fromBase64(text.toUtf8()));
} }

View File

@ -4,7 +4,6 @@
#include "ui_frmbase64helper.h" #include "ui_frmbase64helper.h"
#include "base64helper.h" #include "base64helper.h"
#include "qfiledialog.h" #include "qfiledialog.h"
#include "qelapsedtimer.h"
#include "qdebug.h" #include "qdebug.h"
frmBase64Helper::frmBase64Helper(QWidget *parent) : QWidget(parent), ui(new Ui::frmBase64Helper) frmBase64Helper::frmBase64Helper(QWidget *parent) : QWidget(parent), ui(new Ui::frmBase64Helper)
@ -17,6 +16,18 @@ frmBase64Helper::~frmBase64Helper()
delete ui; delete ui;
} }
void frmBase64Helper::showTime(qint64 size1, qint64 size2)
{
//统计用时
#if (QT_VERSION >= QT_VERSION_CHECK(4,8,0))
double elapsed = (double)timer.nsecsElapsed() / 1000000;
#else
double elapsed = (double)timer.elapsed();
#endif
QString time = QString::number(elapsed, 'f', 3);
ui->labInfo->setText(QString("用时: %1 毫秒 大小: %2 -> %3").arg(time).arg(size1).arg(size2));
}
void frmBase64Helper::on_btnOpen_clicked() void frmBase64Helper::on_btnOpen_clicked()
{ {
QString fileName = QFileDialog::getOpenFileName(this, "选择文件", "", "图片(*.png *.bmp *.jpg)"); QString fileName = QFileDialog::getOpenFileName(this, "选择文件", "", "图片(*.png *.bmp *.jpg)");
@ -38,60 +49,56 @@ void frmBase64Helper::on_btnClear_clicked()
void frmBase64Helper::on_btnImageToBase64_clicked() void frmBase64Helper::on_btnImageToBase64_clicked()
{ {
//计时
QElapsedTimer time;
time.start();
QString fileName = ui->txtFile->text().trimmed(); QString fileName = ui->txtFile->text().trimmed();
if (!fileName.isEmpty()) { if (fileName.isEmpty()) {
ui->txtBase64->setText(Base64Helper::imageToBase64(QImage(fileName))); return;
} }
//统计用时 timer.restart();
#if (QT_VERSION >= QT_VERSION_CHECK(4,8,0)) QImage image(fileName);
double elapsed = (double)time.nsecsElapsed() / 1000000; QString text = Base64Helper::imageToBase64(image);
#else showTime(QFile(fileName).size(), text.size());
double elapsed = (double)time.elapsed(); ui->txtBase64->setText(text);
#endif
QString strTime = QString::number(elapsed, 'f', 3);
ui->labInfo->setText(QString("图片转base64 用时 %1 毫秒").arg(strTime));
} }
void frmBase64Helper::on_btnBase64ToImage_clicked() void frmBase64Helper::on_btnBase64ToImage_clicked()
{ {
//计时 QString fileName = ui->txtFile->text().trimmed();
QElapsedTimer time;
time.start();
QString text = ui->txtBase64->toPlainText().trimmed(); QString text = ui->txtBase64->toPlainText().trimmed();
if (!text.isEmpty()) { if (text.isEmpty()) {
QPixmap pix = QPixmap::fromImage(Base64Helper::base64ToImage(text)); return;
pix = pix.scaled(ui->labImage->size() - QSize(4, 4), Qt::KeepAspectRatio);
ui->labImage->setPixmap(pix);
} }
//统计用时 timer.restart();
#if (QT_VERSION >= QT_VERSION_CHECK(4,8,0)) QImage image = Base64Helper::base64ToImage(text);
double elapsed = (double)time.nsecsElapsed() / 1000000; showTime(text.size(), QFile(fileName).size());
#else QPixmap pix = QPixmap::fromImage(image);
double elapsed = (double)time.elapsed(); pix = pix.scaled(ui->labImage->size() - QSize(4, 4), Qt::KeepAspectRatio);
#endif ui->labImage->setPixmap(pix);
QString strTime = QString::number(elapsed, 'f', 3);
ui->labInfo->setText(QString("base64转图片 用时 %1 毫秒").arg(strTime));
} }
void frmBase64Helper::on_btnTextToBase64_clicked() void frmBase64Helper::on_btnTextToBase64_clicked()
{ {
QString text = ui->txtText->text().trimmed(); QString text = ui->txtText->text().trimmed();
if (!text.isEmpty()) { if (text.isEmpty()) {
ui->txtBase64->setText(Base64Helper::textToBase64(text)); return;
} }
timer.restart();
QString result = Base64Helper::textToBase64(text);
showTime(text.size(), result.size());
ui->txtBase64->setText(result);
} }
void frmBase64Helper::on_btnBase64ToText_clicked() void frmBase64Helper::on_btnBase64ToText_clicked()
{ {
QString text = ui->txtBase64->toPlainText().trimmed(); QString text = ui->txtBase64->toPlainText().trimmed();
if (!text.isEmpty()) { if (text.isEmpty()) {
ui->txtText->setText(Base64Helper::base64ToText(text)); return;
} }
timer.restart();
QString result = Base64Helper::base64ToText(text);
showTime(text.size(), result.size());
ui->txtText->setText(result);
} }

View File

@ -2,6 +2,7 @@
#define FRMBASE64HELPER_H #define FRMBASE64HELPER_H
#include <QWidget> #include <QWidget>
#include <QElapsedTimer>
namespace Ui { namespace Ui {
class frmBase64Helper; class frmBase64Helper;
@ -17,12 +18,16 @@ public:
private: private:
Ui::frmBase64Helper *ui; Ui::frmBase64Helper *ui;
QElapsedTimer timer;
private slots: private slots:
void showTime(qint64 size1, qint64 size2);
void on_btnOpen_clicked(); void on_btnOpen_clicked();
void on_btnClear_clicked(); void on_btnClear_clicked();
void on_btnImageToBase64_clicked(); void on_btnImageToBase64_clicked();
void on_btnBase64ToImage_clicked(); void on_btnBase64ToImage_clicked();
void on_btnTextToBase64_clicked(); void on_btnTextToBase64_clicked();
void on_btnBase64ToText_clicked(); void on_btnBase64ToText_clicked();
}; };

View File

@ -14,6 +14,52 @@
<string>Widget</string> <string>Widget</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLineEdit" name="txtFile">
<property name="text">
<string>E:/myFile/美女图片/2.jpg</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="btnOpen">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>打开文件</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="btnImageToBase64">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>图片转base64</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="btnBase64ToImage">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>base64转图片</string>
</property>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLineEdit" name="txtText"> <widget class="QLineEdit" name="txtText">
<property name="text"> <property name="text">
@ -34,6 +80,45 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2">
<widget class="QPushButton" name="btnTextToBase64">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>文字转base64</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="btnBase64ToText">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>base64转文字</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labInfo">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0" colspan="4"> <item row="3" column="0" colspan="4">
<widget class="QLabel" name="labImage"> <widget class="QLabel" name="labImage">
<property name="sizePolicy"> <property name="sizePolicy">
@ -56,94 +141,9 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2">
<widget class="QPushButton" name="btnImageToBase64">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>图片转base64</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="btnBase64ToText">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>base64转文字</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="btnOpen">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>打开文件</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLineEdit" name="txtFile">
<property name="text">
<string>E:/myFile/美女图片/2.jpg</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="4"> <item row="4" column="0" colspan="4">
<widget class="QTextEdit" name="txtBase64"/> <widget class="QTextEdit" name="txtBase64"/>
</item> </item>
<item row="1" column="2">
<widget class="QPushButton" name="btnBase64ToImage">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>base64转图片</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="btnTextToBase64">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>文字转base64</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labInfo">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>

View File

@ -32,10 +32,10 @@ QImage Base64Helper::base64ToImagex(const QByteArray &data)
QString Base64Helper::textToBase64(const QString &text) QString Base64Helper::textToBase64(const QString &text)
{ {
return QString(text.toLocal8Bit().toBase64()); return QString(text.toUtf8().toBase64());
} }
QString Base64Helper::base64ToText(const QString &text) QString Base64Helper::base64ToText(const QString &text)
{ {
return QString(QByteArray::fromBase64(text.toLocal8Bit())); return QString(QByteArray::fromBase64(text.toUtf8()));
} }

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -1,7 +1,7 @@
TEMPLATE = subdirs TEMPLATE = subdirs
SUBDIRS += videobox SUBDIRS += videobox
SUBDIRS += videopanel SUBDIRS += videopanel
SUBDIRS += videowidget SUBDIRS += videowindow
win32 { win32 {
SUBDIRS += playffmpeg SUBDIRS += playffmpeg

View File

@ -1,35 +0,0 @@
#pragma execution_character_set("utf-8")
#include "frmvideowidget.h"
#include "ui_frmvideowidget.h"
frmVideoWidget::frmVideoWidget(QWidget *parent) : QWidget(parent), ui(new Ui::frmVideoWidget)
{
ui->setupUi(this);
this->initForm();
}
frmVideoWidget::~frmVideoWidget()
{
delete ui;
}
void frmVideoWidget::initForm()
{
ui->videoWidget1->setFlowEnable(true);
ui->videoWidget2->setFlowEnable(true);
ui->videoWidget3->setFlowEnable(true);
ui->videoWidget4->setFlowEnable(true);
connect(ui->videoWidget1, SIGNAL(btnClicked(QString)), this, SLOT(btnClicked(QString)));
connect(ui->videoWidget2, SIGNAL(btnClicked(QString)), this, SLOT(btnClicked(QString)));
connect(ui->videoWidget3, SIGNAL(btnClicked(QString)), this, SLOT(btnClicked(QString)));
connect(ui->videoWidget4, SIGNAL(btnClicked(QString)), this, SLOT(btnClicked(QString)));
}
void frmVideoWidget::btnClicked(const QString &objName)
{
VideoWidget *videoWidget = (VideoWidget *)sender();
QString str = QString("当前单击了控件 %1 的按钮 %2").arg(videoWidget->objectName()).arg(objName);
ui->label->setText(str);
}

View File

@ -1,26 +0,0 @@
#ifndef FRMVIDEOWIDGET_H
#define FRMVIDEOWIDGET_H
#include <QWidget>
namespace Ui {
class frmVideoWidget;
}
class frmVideoWidget : public QWidget
{
Q_OBJECT
public:
explicit frmVideoWidget(QWidget *parent = 0);
~frmVideoWidget();
private:
Ui::frmVideoWidget *ui;
private slots:
void initForm();
void btnClicked(const QString &objName);
};
#endif // FRMVIDEOWIDGET_H

View File

@ -0,0 +1,35 @@
#pragma execution_character_set("utf-8")
#include "frmvideowindow.h"
#include "ui_frmvideowindow.h"
frmVideoWindow::frmVideoWindow(QWidget *parent) : QWidget(parent), ui(new Ui::frmVideoWindow)
{
ui->setupUi(this);
this->initForm();
}
frmVideoWindow::~frmVideoWindow()
{
delete ui;
}
void frmVideoWindow::initForm()
{
ui->videoWindow1->setFlowEnable(true);
ui->videoWindow2->setFlowEnable(true);
ui->videoWindow3->setFlowEnable(true);
ui->videoWindow4->setFlowEnable(true);
connect(ui->videoWindow1, SIGNAL(btnClicked(QString)), this, SLOT(btnClicked(QString)));
connect(ui->videoWindow2, SIGNAL(btnClicked(QString)), this, SLOT(btnClicked(QString)));
connect(ui->videoWindow3, SIGNAL(btnClicked(QString)), this, SLOT(btnClicked(QString)));
connect(ui->videoWindow4, SIGNAL(btnClicked(QString)), this, SLOT(btnClicked(QString)));
}
void frmVideoWindow::btnClicked(const QString &objName)
{
VideoWindow *videoWindow = (VideoWindow *)sender();
QString str = QString("当前单击了控件 %1 的按钮 %2").arg(videoWindow->objectName()).arg(objName);
ui->label->setText(str);
}

View File

@ -0,0 +1,26 @@
#ifndef FRMVIDEOWINDOW_H
#define FRMVIDEOWINDOW_H
#include <QWidget>
namespace Ui {
class frmVideoWindow;
}
class frmVideoWindow : public QWidget
{
Q_OBJECT
public:
explicit frmVideoWindow(QWidget *parent = 0);
~frmVideoWindow();
private:
Ui::frmVideoWindow *ui;
private slots:
void initForm();
void btnClicked(const QString &objName);
};
#endif // FRMVIDEOWINDOW_H

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>frmVideoWidget</class> <class>frmVideoWindow</class>
<widget class="QWidget" name="frmVideoWidget"> <widget class="QWidget" name="frmVideoWindow">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -15,9 +15,9 @@
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="1"> <item row="0" column="1">
<widget class="VideoWidget" name="videoWidget2" native="true"> <widget class="VideoWindow" name="videoWindow2" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -25,9 +25,9 @@
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="VideoWidget" name="videoWidget1" native="true"> <widget class="VideoWindow" name="videoWindow1" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -35,9 +35,9 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="VideoWidget" name="videoWidget4" native="true"> <widget class="VideoWindow" name="videoWindow4" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -45,9 +45,9 @@
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="VideoWidget" name="videoWidget3" native="true"> <widget class="VideoWindow" name="videoWindow3" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -71,9 +71,9 @@
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>VideoWidget</class> <class>VideoWindow</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>videowidget.h</header> <header>videowindow.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>

View File

@ -1,6 +1,6 @@
#pragma execution_character_set("utf-8") #pragma execution_character_set("utf-8")
#include "frmvideowidget.h" #include "frmvideowindow.h"
#include <QApplication> #include <QApplication>
#include <QTextCodec> #include <QTextCodec>
@ -26,7 +26,7 @@ int main(int argc, char *argv[])
QTextCodec::setCodecForLocale(codec); QTextCodec::setCodecForLocale(codec);
#endif #endif
frmVideoWidget w; frmVideoWindow w;
w.setWindowTitle("视频监控控件 (QQ: 517216493 WX: feiyangqingyun)"); w.setWindowTitle("视频监控控件 (QQ: 517216493 WX: feiyangqingyun)");
w.resize(800, 600); w.resize(800, 600);
w.show(); w.show();

View File

@ -1,6 +1,6 @@
#pragma execution_character_set("utf-8") #pragma execution_character_set("utf-8")
#include "videowidget.h" #include "videowindow.h"
#include "qfontdatabase.h" #include "qfontdatabase.h"
#include "qpushbutton.h" #include "qpushbutton.h"
#include "qtreewidget.h" #include "qtreewidget.h"
@ -13,7 +13,7 @@
#include "qurl.h" #include "qurl.h"
#include "qdebug.h" #include "qdebug.h"
VideoWidget::VideoWidget(QWidget *parent) : QWidget(parent) VideoWindow::VideoWindow(QWidget *parent) : QWidget(parent)
{ {
//设置强焦点 //设置强焦点
setFocusPolicy(Qt::StrongFocus); setFocusPolicy(Qt::StrongFocus);
@ -67,12 +67,12 @@ VideoWidget::VideoWidget(QWidget *parent) : QWidget(parent)
this->initFlowStyle(); this->initFlowStyle();
} }
void VideoWidget::initThread() void VideoWindow::initThread()
{ {
} }
void VideoWidget::initFlowPanel() void VideoWindow::initFlowPanel()
{ {
//顶部工具栏,默认隐藏,鼠标移入显示移除隐藏 //顶部工具栏,默认隐藏,鼠标移入显示移除隐藏
flowPanel = new QWidget(this); flowPanel = new QWidget(this);
@ -151,7 +151,7 @@ void VideoWidget::initFlowPanel()
} }
} }
void VideoWidget::initFlowStyle() void VideoWindow::initFlowStyle()
{ {
//设置样式以便区分,可以自行更改样式,也可以不用样式 //设置样式以便区分,可以自行更改样式,也可以不用样式
QStringList qss; QStringList qss;
@ -162,7 +162,7 @@ void VideoWidget::initFlowStyle()
flowPanel->setStyleSheet(qss.join("")); flowPanel->setStyleSheet(qss.join(""));
} }
VideoWidget::~VideoWidget() VideoWindow::~VideoWindow()
{ {
if (timerCheck->isActive()) { if (timerCheck->isActive()) {
timerCheck->stop(); timerCheck->stop();
@ -171,7 +171,7 @@ VideoWidget::~VideoWidget()
close(); close();
} }
void VideoWidget::resizeEvent(QResizeEvent *) void VideoWindow::resizeEvent(QResizeEvent *)
{ {
//重新设置顶部工具栏的位置和宽高,可以自行设置顶部显示或者底部显示 //重新设置顶部工具栏的位置和宽高,可以自行设置顶部显示或者底部显示
int height = 20; int height = 20;
@ -180,9 +180,9 @@ void VideoWidget::resizeEvent(QResizeEvent *)
} }
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0)) #if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
void VideoWidget::enterEvent(QEnterEvent *) void VideoWindow::enterEvent(QEnterEvent *)
#else #else
void VideoWidget::enterEvent(QEvent *) void VideoWindow::enterEvent(QEvent *)
#endif #endif
{ {
//这里还可以增加一个判断,是否获取了焦点的才需要显示 //这里还可以增加一个判断,是否获取了焦点的才需要显示
@ -192,14 +192,14 @@ void VideoWidget::enterEvent(QEvent *)
} }
} }
void VideoWidget::leaveEvent(QEvent *) void VideoWindow::leaveEvent(QEvent *)
{ {
if (flowEnable) { if (flowEnable) {
flowPanel->setVisible(false); flowPanel->setVisible(false);
} }
} }
void VideoWidget::dropEvent(QDropEvent *event) void VideoWindow::dropEvent(QDropEvent *event)
{ {
//拖放完毕鼠标松开的时候执行 //拖放完毕鼠标松开的时候执行
//判断拖放进来的类型,取出文件,进行播放 //判断拖放进来的类型,取出文件,进行播放
@ -219,7 +219,7 @@ void VideoWidget::dropEvent(QDropEvent *event)
} }
} }
void VideoWidget::dragEnterEvent(QDragEnterEvent *event) void VideoWindow::dragEnterEvent(QDragEnterEvent *event)
{ {
//拖曳进来的时候先判断下类型,非法类型则不处理 //拖曳进来的时候先判断下类型,非法类型则不处理
if (event->mimeData()->hasFormat("application/x-qabstractitemmodeldatalist")) { if (event->mimeData()->hasFormat("application/x-qabstractitemmodeldatalist")) {
@ -233,7 +233,7 @@ void VideoWidget::dragEnterEvent(QDragEnterEvent *event)
} }
} }
void VideoWidget::paintEvent(QPaintEvent *) void VideoWindow::paintEvent(QPaintEvent *)
{ {
//如果不需要绘制 //如果不需要绘制
if (!drawImage) { if (!drawImage) {
@ -258,7 +258,7 @@ void VideoWidget::paintEvent(QPaintEvent *)
} }
} }
void VideoWidget::drawBorder(QPainter *painter) void VideoWindow::drawBorder(QPainter *painter)
{ {
painter->save(); painter->save();
@ -276,7 +276,7 @@ void VideoWidget::drawBorder(QPainter *painter)
painter->restore(); painter->restore();
} }
void VideoWidget::drawBg(QPainter *painter) void VideoWindow::drawBg(QPainter *painter)
{ {
painter->save(); painter->save();
@ -296,7 +296,7 @@ void VideoWidget::drawBg(QPainter *painter)
painter->restore(); painter->restore();
} }
void VideoWidget::drawImg(QPainter *painter, QImage img) void VideoWindow::drawImg(QPainter *painter, QImage img)
{ {
painter->save(); painter->save();
@ -316,14 +316,14 @@ void VideoWidget::drawImg(QPainter *painter, QImage img)
painter->restore(); painter->restore();
} }
void VideoWidget::drawOSD(QPainter *painter, void VideoWindow::drawOSD(QPainter *painter,
bool osdVisible, bool osdVisible,
int osdFontSize, int osdFontSize,
const QString &osdText, const QString &osdText,
const QColor &osdColor, const QColor &osdColor,
const QImage &osdImage, const QImage &osdImage,
const VideoWidget::OSDFormat &osdFormat, const VideoWindow::OSDFormat &osdFormat,
const VideoWidget::OSDPosition &osdPosition) const VideoWindow::OSDPosition &osdPosition)
{ {
if (!osdVisible) { if (!osdVisible) {
return; return;
@ -375,212 +375,212 @@ void VideoWidget::drawOSD(QPainter *painter,
painter->restore(); painter->restore();
} }
QImage VideoWidget::getImage() const QImage VideoWindow::getImage() const
{ {
return this->image; return this->image;
} }
QPixmap VideoWidget::getPixmap() const QPixmap VideoWindow::getPixmap() const
{ {
return QPixmap(); return QPixmap();
} }
QString VideoWidget::getUrl() const QString VideoWindow::getUrl() const
{ {
return this->property("url").toString(); return this->property("url").toString();
} }
QDateTime VideoWidget::getLastTime() const QDateTime VideoWindow::getLastTime() const
{ {
return QDateTime::currentDateTime(); return QDateTime::currentDateTime();
} }
bool VideoWidget::getCallback() const bool VideoWindow::getCallback() const
{ {
return false; return false;
} }
bool VideoWidget::getIsPlaying() const bool VideoWindow::getIsPlaying() const
{ {
return false; return false;
} }
bool VideoWidget::getIsRtsp() const bool VideoWindow::getIsRtsp() const
{ {
return false; return false;
} }
bool VideoWidget::getIsUsbCamera() const bool VideoWindow::getIsUsbCamera() const
{ {
return false; return false;
} }
bool VideoWidget::getCopyImage() const bool VideoWindow::getCopyImage() const
{ {
return this->copyImage; return this->copyImage;
} }
bool VideoWidget::getCheckLive() const bool VideoWindow::getCheckLive() const
{ {
return this->checkLive; return this->checkLive;
} }
bool VideoWidget::getDrawImage() const bool VideoWindow::getDrawImage() const
{ {
return this->drawImage; return this->drawImage;
} }
bool VideoWidget::getFillImage() const bool VideoWindow::getFillImage() const
{ {
return this->fillImage; return this->fillImage;
} }
bool VideoWidget::getFlowEnable() const bool VideoWindow::getFlowEnable() const
{ {
return this->flowEnable; return this->flowEnable;
} }
QColor VideoWidget::getFlowBgColor() const QColor VideoWindow::getFlowBgColor() const
{ {
return this->flowBgColor; return this->flowBgColor;
} }
QColor VideoWidget::getFlowPressColor() const QColor VideoWindow::getFlowPressColor() const
{ {
return this->flowPressColor; return this->flowPressColor;
} }
int VideoWidget::getTimeout() const int VideoWindow::getTimeout() const
{ {
return this->timeout; return this->timeout;
} }
int VideoWidget::getBorderWidth() const int VideoWindow::getBorderWidth() const
{ {
return this->borderWidth; return this->borderWidth;
} }
QColor VideoWidget::getBorderColor() const QColor VideoWindow::getBorderColor() const
{ {
return this->borderColor; return this->borderColor;
} }
QColor VideoWidget::getFocusColor() const QColor VideoWindow::getFocusColor() const
{ {
return this->focusColor; return this->focusColor;
} }
QColor VideoWidget::getBgColor() const QColor VideoWindow::getBgColor() const
{ {
return this->bgColor; return this->bgColor;
} }
QString VideoWidget::getBgText() const QString VideoWindow::getBgText() const
{ {
return this->bgText; return this->bgText;
} }
QImage VideoWidget::getBgImage() const QImage VideoWindow::getBgImage() const
{ {
return this->bgImage; return this->bgImage;
} }
bool VideoWidget::getOSD1Visible() const bool VideoWindow::getOSD1Visible() const
{ {
return this->osd1Visible; return this->osd1Visible;
} }
int VideoWidget::getOSD1FontSize() const int VideoWindow::getOSD1FontSize() const
{ {
return this->osd1FontSize; return this->osd1FontSize;
} }
QString VideoWidget::getOSD1Text() const QString VideoWindow::getOSD1Text() const
{ {
return this->osd1Text; return this->osd1Text;
} }
QColor VideoWidget::getOSD1Color() const QColor VideoWindow::getOSD1Color() const
{ {
return this->osd1Color; return this->osd1Color;
} }
QImage VideoWidget::getOSD1Image() const QImage VideoWindow::getOSD1Image() const
{ {
return this->osd1Image; return this->osd1Image;
} }
VideoWidget::OSDFormat VideoWidget::getOSD1Format() const VideoWindow::OSDFormat VideoWindow::getOSD1Format() const
{ {
return this->osd1Format; return this->osd1Format;
} }
VideoWidget::OSDPosition VideoWidget::getOSD1Position() const VideoWindow::OSDPosition VideoWindow::getOSD1Position() const
{ {
return this->osd1Position; return this->osd1Position;
} }
bool VideoWidget::getOSD2Visible() const bool VideoWindow::getOSD2Visible() const
{ {
return this->osd2Visible; return this->osd2Visible;
} }
int VideoWidget::getOSD2FontSize() const int VideoWindow::getOSD2FontSize() const
{ {
return this->osd2FontSize; return this->osd2FontSize;
} }
QString VideoWidget::getOSD2Text() const QString VideoWindow::getOSD2Text() const
{ {
return this->osd2Text; return this->osd2Text;
} }
QColor VideoWidget::getOSD2Color() const QColor VideoWindow::getOSD2Color() const
{ {
return this->osd2Color; return this->osd2Color;
} }
QImage VideoWidget::getOSD2Image() const QImage VideoWindow::getOSD2Image() const
{ {
return this->osd2Image; return this->osd2Image;
} }
VideoWidget::OSDFormat VideoWidget::getOSD2Format() const VideoWindow::OSDFormat VideoWindow::getOSD2Format() const
{ {
return this->osd2Format; return this->osd2Format;
} }
VideoWidget::OSDPosition VideoWidget::getOSD2Position() const VideoWindow::OSDPosition VideoWindow::getOSD2Position() const
{ {
return this->osd2Position; return this->osd2Position;
} }
int VideoWidget::getFaceBorder() const int VideoWindow::getFaceBorder() const
{ {
return this->faceBorder; return this->faceBorder;
} }
QColor VideoWidget::getFaceColor() const QColor VideoWindow::getFaceColor() const
{ {
return this->faceColor; return this->faceColor;
} }
QList<QRect> VideoWidget::getFaceRects() const QList<QRect> VideoWindow::getFaceRects() const
{ {
return this->faceRects; return this->faceRects;
} }
QSize VideoWidget::sizeHint() const QSize VideoWindow::sizeHint() const
{ {
return QSize(400, 300); return QSize(400, 300);
} }
QSize VideoWidget::minimumSizeHint() const QSize VideoWindow::minimumSizeHint() const
{ {
return QSize(40, 30); return QSize(40, 30);
} }
void VideoWidget::updateImage(const QImage &image) void VideoWindow::updateImage(const QImage &image)
{ {
//拷贝图片有个好处,当处理器比较差的时候,图片不会产生断层,缺点是占用时间 //拷贝图片有个好处,当处理器比较差的时候,图片不会产生断层,缺点是占用时间
//默认QImage类型是浅拷贝,可能正在绘制的时候,那边已经更改了图片的上部分数据 //默认QImage类型是浅拷贝,可能正在绘制的时候,那边已经更改了图片的上部分数据
@ -588,7 +588,7 @@ void VideoWidget::updateImage(const QImage &image)
this->update(); this->update();
} }
void VideoWidget::checkVideo() void VideoWindow::checkVideo()
{ {
QDateTime now = QDateTime::currentDateTime(); QDateTime now = QDateTime::currentDateTime();
QDateTime lastTime = now; QDateTime lastTime = now;
@ -598,103 +598,103 @@ void VideoWidget::checkVideo()
} }
} }
void VideoWidget::btnClicked() void VideoWindow::btnClicked()
{ {
QPushButton *btn = (QPushButton *)sender(); QPushButton *btn = (QPushButton *)sender();
emit btnClicked(btn->objectName()); emit btnClicked(btn->objectName());
} }
uint VideoWidget::getLength() uint VideoWindow::getLength()
{ {
return 0; return 0;
} }
uint VideoWidget::getPosition() uint VideoWindow::getPosition()
{ {
return 0; return 0;
} }
void VideoWidget::setPosition(int position) void VideoWindow::setPosition(int position)
{ {
} }
bool VideoWidget::getMuted() bool VideoWindow::getMuted()
{ {
return false; return false;
} }
void VideoWidget::setMuted(bool muted) void VideoWindow::setMuted(bool muted)
{ {
} }
int VideoWidget::getVolume() int VideoWindow::getVolume()
{ {
return 0; return 0;
} }
void VideoWidget::setVolume(int volume) void VideoWindow::setVolume(int volume)
{ {
} }
void VideoWidget::setInterval(int interval) void VideoWindow::setInterval(int interval)
{ {
} }
void VideoWidget::setSleepTime(int sleepTime) void VideoWindow::setSleepTime(int sleepTime)
{ {
} }
void VideoWidget::setCheckTime(int checkTime) void VideoWindow::setCheckTime(int checkTime)
{ {
} }
void VideoWidget::setCheckConn(bool checkConn) void VideoWindow::setCheckConn(bool checkConn)
{ {
} }
void VideoWidget::setUrl(const QString &url) void VideoWindow::setUrl(const QString &url)
{ {
this->setProperty("url", url); this->setProperty("url", url);
} }
void VideoWidget::setCallback(bool callback) void VideoWindow::setCallback(bool callback)
{ {
} }
void VideoWidget::setHardware(const QString &hardware) void VideoWindow::setHardware(const QString &hardware)
{ {
} }
void VideoWidget::setTransport(const QString &transport) void VideoWindow::setTransport(const QString &transport)
{ {
} }
void VideoWidget::setSaveFile(bool saveFile) void VideoWindow::setSaveFile(bool saveFile)
{ {
} }
void VideoWidget::setSaveInterval(int saveInterval) void VideoWindow::setSaveInterval(int saveInterval)
{ {
} }
void VideoWidget::setFileFlag(const QString &fileFlag) void VideoWindow::setFileFlag(const QString &fileFlag)
{ {
} }
void VideoWidget::setSavePath(const QString &savePath) void VideoWindow::setSavePath(const QString &savePath)
{ {
//如果目录不存在则新建 //如果目录不存在则新建
QDir dir(savePath); QDir dir(savePath);
@ -703,37 +703,37 @@ void VideoWidget::setSavePath(const QString &savePath)
} }
} }
void VideoWidget::setFileName(const QString &fileName) void VideoWindow::setFileName(const QString &fileName)
{ {
} }
void VideoWidget::setCopyImage(bool copyImage) void VideoWindow::setCopyImage(bool copyImage)
{ {
this->copyImage = copyImage; this->copyImage = copyImage;
} }
void VideoWidget::setCheckLive(bool checkLive) void VideoWindow::setCheckLive(bool checkLive)
{ {
this->checkLive = checkLive; this->checkLive = checkLive;
} }
void VideoWidget::setDrawImage(bool drawImage) void VideoWindow::setDrawImage(bool drawImage)
{ {
this->drawImage = drawImage; this->drawImage = drawImage;
} }
void VideoWidget::setFillImage(bool fillImage) void VideoWindow::setFillImage(bool fillImage)
{ {
this->fillImage = fillImage; this->fillImage = fillImage;
} }
void VideoWidget::setFlowEnable(bool flowEnable) void VideoWindow::setFlowEnable(bool flowEnable)
{ {
this->flowEnable = flowEnable; this->flowEnable = flowEnable;
} }
void VideoWidget::setFlowBgColor(const QColor &flowBgColor) void VideoWindow::setFlowBgColor(const QColor &flowBgColor)
{ {
if (this->flowBgColor != flowBgColor) { if (this->flowBgColor != flowBgColor) {
this->flowBgColor = flowBgColor; this->flowBgColor = flowBgColor;
@ -741,7 +741,7 @@ void VideoWidget::setFlowBgColor(const QColor &flowBgColor)
} }
} }
void VideoWidget::setFlowPressColor(const QColor &flowPressColor) void VideoWindow::setFlowPressColor(const QColor &flowPressColor)
{ {
if (this->flowPressColor != flowPressColor) { if (this->flowPressColor != flowPressColor) {
this->flowPressColor = flowPressColor; this->flowPressColor = flowPressColor;
@ -749,170 +749,170 @@ void VideoWidget::setFlowPressColor(const QColor &flowPressColor)
} }
} }
void VideoWidget::setTimeout(int timeout) void VideoWindow::setTimeout(int timeout)
{ {
this->timeout = timeout; this->timeout = timeout;
} }
void VideoWidget::setBorderWidth(int borderWidth) void VideoWindow::setBorderWidth(int borderWidth)
{ {
this->borderWidth = borderWidth; this->borderWidth = borderWidth;
this->update(); this->update();
} }
void VideoWidget::setBorderColor(const QColor &borderColor) void VideoWindow::setBorderColor(const QColor &borderColor)
{ {
this->borderColor = borderColor; this->borderColor = borderColor;
this->update(); this->update();
} }
void VideoWidget::setFocusColor(const QColor &focusColor) void VideoWindow::setFocusColor(const QColor &focusColor)
{ {
this->focusColor = focusColor; this->focusColor = focusColor;
this->update(); this->update();
} }
void VideoWidget::setBgColor(const QColor &bgColor) void VideoWindow::setBgColor(const QColor &bgColor)
{ {
this->bgColor = bgColor; this->bgColor = bgColor;
this->update(); this->update();
} }
void VideoWidget::setBgText(const QString &bgText) void VideoWindow::setBgText(const QString &bgText)
{ {
this->bgText = bgText; this->bgText = bgText;
this->update(); this->update();
} }
void VideoWidget::setBgImage(const QImage &bgImage) void VideoWindow::setBgImage(const QImage &bgImage)
{ {
this->bgImage = bgImage; this->bgImage = bgImage;
this->update(); this->update();
} }
void VideoWidget::setOSD1Visible(bool osdVisible) void VideoWindow::setOSD1Visible(bool osdVisible)
{ {
this->osd1Visible = osdVisible; this->osd1Visible = osdVisible;
this->update(); this->update();
} }
void VideoWidget::setOSD1FontSize(int osdFontSize) void VideoWindow::setOSD1FontSize(int osdFontSize)
{ {
this->osd1FontSize = osdFontSize; this->osd1FontSize = osdFontSize;
this->update(); this->update();
} }
void VideoWidget::setOSD1Text(const QString &osdText) void VideoWindow::setOSD1Text(const QString &osdText)
{ {
this->osd1Text = osdText; this->osd1Text = osdText;
this->update(); this->update();
} }
void VideoWidget::setOSD1Color(const QColor &osdColor) void VideoWindow::setOSD1Color(const QColor &osdColor)
{ {
this->osd1Color = osdColor; this->osd1Color = osdColor;
this->update(); this->update();
} }
void VideoWidget::setOSD1Image(const QImage &osdImage) void VideoWindow::setOSD1Image(const QImage &osdImage)
{ {
this->osd1Image = osdImage; this->osd1Image = osdImage;
this->update(); this->update();
} }
void VideoWidget::setOSD1Format(const VideoWidget::OSDFormat &osdFormat) void VideoWindow::setOSD1Format(const VideoWindow::OSDFormat &osdFormat)
{ {
this->osd1Format = osdFormat; this->osd1Format = osdFormat;
this->update(); this->update();
} }
void VideoWidget::setOSD1Position(const VideoWidget::OSDPosition &osdPosition) void VideoWindow::setOSD1Position(const VideoWindow::OSDPosition &osdPosition)
{ {
this->osd1Position = osdPosition; this->osd1Position = osdPosition;
this->update(); this->update();
} }
void VideoWidget::setOSD2Visible(bool osdVisible) void VideoWindow::setOSD2Visible(bool osdVisible)
{ {
this->osd2Visible = osdVisible; this->osd2Visible = osdVisible;
this->update(); this->update();
} }
void VideoWidget::setOSD2FontSize(int osdFontSize) void VideoWindow::setOSD2FontSize(int osdFontSize)
{ {
this->osd2FontSize = osdFontSize; this->osd2FontSize = osdFontSize;
this->update(); this->update();
} }
void VideoWidget::setOSD2Text(const QString &osdText) void VideoWindow::setOSD2Text(const QString &osdText)
{ {
this->osd2Text = osdText; this->osd2Text = osdText;
this->update(); this->update();
} }
void VideoWidget::setOSD2Color(const QColor &osdColor) void VideoWindow::setOSD2Color(const QColor &osdColor)
{ {
this->osd2Color = osdColor; this->osd2Color = osdColor;
this->update(); this->update();
} }
void VideoWidget::setOSD2Image(const QImage &osdImage) void VideoWindow::setOSD2Image(const QImage &osdImage)
{ {
this->osd2Image = osdImage; this->osd2Image = osdImage;
this->update(); this->update();
} }
void VideoWidget::setOSD2Format(const VideoWidget::OSDFormat &osdFormat) void VideoWindow::setOSD2Format(const VideoWindow::OSDFormat &osdFormat)
{ {
this->osd2Format = osdFormat; this->osd2Format = osdFormat;
this->update(); this->update();
} }
void VideoWidget::setOSD2Position(const VideoWidget::OSDPosition &osdPosition) void VideoWindow::setOSD2Position(const VideoWindow::OSDPosition &osdPosition)
{ {
this->osd2Position = osdPosition; this->osd2Position = osdPosition;
this->update(); this->update();
} }
void VideoWidget::setOSD1Format(quint8 osdFormat) void VideoWindow::setOSD1Format(quint8 osdFormat)
{ {
setOSD1Format((VideoWidget::OSDFormat)osdFormat); setOSD1Format((VideoWindow::OSDFormat)osdFormat);
} }
void VideoWidget::setOSD2Format(quint8 osdFormat) void VideoWindow::setOSD2Format(quint8 osdFormat)
{ {
setOSD2Format((VideoWidget::OSDFormat)osdFormat); setOSD2Format((VideoWindow::OSDFormat)osdFormat);
} }
void VideoWidget::setOSD1Position(quint8 osdPosition) void VideoWindow::setOSD1Position(quint8 osdPosition)
{ {
setOSD1Position((VideoWidget::OSDPosition)osdPosition); setOSD1Position((VideoWindow::OSDPosition)osdPosition);
} }
void VideoWidget::setOSD2Position(quint8 osdPosition) void VideoWindow::setOSD2Position(quint8 osdPosition)
{ {
setOSD2Position((VideoWidget::OSDPosition)osdPosition); setOSD2Position((VideoWindow::OSDPosition)osdPosition);
} }
void VideoWidget::setFaceBorder(int faceBorder) void VideoWindow::setFaceBorder(int faceBorder)
{ {
this->faceBorder = faceBorder; this->faceBorder = faceBorder;
this->update(); this->update();
} }
void VideoWidget::setFaceColor(const QColor &faceColor) void VideoWindow::setFaceColor(const QColor &faceColor)
{ {
this->faceColor = faceColor; this->faceColor = faceColor;
this->update(); this->update();
} }
void VideoWidget::setFaceRects(const QList<QRect> &faceRects) void VideoWindow::setFaceRects(const QList<QRect> &faceRects)
{ {
this->faceRects = faceRects; this->faceRects = faceRects;
this->update(); this->update();
} }
void VideoWidget::open() void VideoWindow::open()
{ {
//qDebug() << TIMEMS << "open video" << objectName(); //qDebug() << TIMEMS << "open video" << objectName();
clear(); clear();
@ -934,7 +934,7 @@ void VideoWidget::open()
this->setProperty("isPause", false); this->setProperty("isPause", false);
} }
void VideoWidget::pause() void VideoWindow::pause()
{ {
if (!this->property("isPause").toBool()) { if (!this->property("isPause").toBool()) {
//thread->pause(); //thread->pause();
@ -942,7 +942,7 @@ void VideoWidget::pause()
} }
} }
void VideoWidget::next() void VideoWindow::next()
{ {
if (this->property("isPause").toBool()) { if (this->property("isPause").toBool()) {
//thread->next(); //thread->next();
@ -950,7 +950,7 @@ void VideoWidget::next()
} }
} }
void VideoWidget::close() void VideoWindow::close()
{ {
if (checkLive) { if (checkLive) {
timerCheck->stop(); timerCheck->stop();
@ -960,7 +960,7 @@ void VideoWidget::close()
//QTimer::singleShot(5, this, SLOT(clear())); //QTimer::singleShot(5, this, SLOT(clear()));
} }
void VideoWidget::restart(const QString &url, int delayOpen) void VideoWindow::restart(const QString &url, int delayOpen)
{ {
//qDebug() << TIMEMS << "restart video" << objectName(); //qDebug() << TIMEMS << "restart video" << objectName();
//关闭视频 //关闭视频
@ -976,13 +976,13 @@ void VideoWidget::restart(const QString &url, int delayOpen)
} }
} }
void VideoWidget::clear() void VideoWindow::clear()
{ {
image = QImage(); image = QImage();
this->update(); this->update();
} }
void VideoWidget::snap(const QString &fileName) void VideoWindow::snap(const QString &fileName)
{ {
} }

View File

@ -1,5 +1,5 @@
#ifndef VIDEOWIDGET_H #ifndef VIDEOWINDOW_H
#define VIDEOWIDGET_H #define VIDEOWINDOW_H
/** /**
* :feiyangqingyun(QQ:517216493) 2018-05-01 * :feiyangqingyun(QQ:517216493) 2018-05-01
@ -23,9 +23,9 @@
class QTimer; class QTimer;
#ifdef quc #ifdef quc
class Q_DECL_EXPORT VideoWidget : public QWidget class Q_DECL_EXPORT VideoWindow : public QWidget
#else #else
class VideoWidget : public QWidget class VideoWindow : public QWidget
#endif #endif
{ {
@ -84,8 +84,8 @@ public:
OSDPosition_Right_Bottom = 3 //右下角 OSDPosition_Right_Bottom = 3 //右下角
}; };
explicit VideoWidget(QWidget *parent = 0); explicit VideoWindow(QWidget *parent = 0);
~VideoWidget(); ~VideoWindow();
protected: protected:
void resizeEvent(QResizeEvent *); void resizeEvent(QResizeEvent *);
@ -378,4 +378,4 @@ public slots:
void snap(const QString &fileName); void snap(const QString &fileName);
}; };
#endif // VIDEOWIDGET_H #endif // VIDEOWINDOW_H

View File

@ -2,18 +2,18 @@ QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat
TARGET = videowidget TARGET = videowindow
TEMPLATE = app TEMPLATE = app
DESTDIR = $$PWD/../bin DESTDIR = $$PWD/../bin
CONFIG += warn_off CONFIG += warn_off
SOURCES += main.cpp SOURCES += main.cpp
SOURCES += frmvideowidget.cpp SOURCES += frmvideowindow.cpp
SOURCES += videowidget.cpp SOURCES += videowindow.cpp
HEADERS += frmvideowidget.h HEADERS += frmvideowindow.h
HEADERS += videowidget.h HEADERS += videowindow.h
FORMS += frmvideowidget.ui FORMS += frmvideowindow.ui
RESOURCES += main.qrc RESOURCES += main.qrc