更新代码
This commit is contained in:
@@ -218,7 +218,7 @@ void DeviceSizeTable::checkSize(const QString &result, const QString &name)
|
|||||||
QStringList list = result.split(" ");
|
QStringList list = result.split(" ");
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
for (int i = 0; i < list.count(); ++i) {
|
for (int i = 0; i < list.size(); ++i) {
|
||||||
QString s = list.at(i).trimmed();
|
QString s = list.at(i).trimmed();
|
||||||
if (s.isEmpty()) {
|
if (s.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ IconHelper::IconHelper(const QString &fontFile, const QString &fontName, QObject
|
|||||||
if (!fontDb.families().contains(fontName) && QFile(fontFile).exists()) {
|
if (!fontDb.families().contains(fontName) && QFile(fontFile).exists()) {
|
||||||
int fontId = fontDb.addApplicationFont(fontFile);
|
int fontId = fontDb.addApplicationFont(fontFile);
|
||||||
QStringList listName = fontDb.applicationFontFamilies(fontId);
|
QStringList listName = fontDb.applicationFontFamilies(fontId);
|
||||||
if (listName.count() == 0) {
|
if (listName.size() == 0) {
|
||||||
qDebug() << QString("load %1 error").arg(fontName);
|
qDebug() << QString("load %1 error").arg(fontName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -265,8 +265,8 @@ void IconHelper::setStyle1(QWidget *widget, QList<QToolButton *> btns, QList<int
|
|||||||
|
|
||||||
void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList<int> icons, const IconHelper::StyleColor &styleColor)
|
void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList<int> icons, const IconHelper::StyleColor &styleColor)
|
||||||
{
|
{
|
||||||
int btnCount = btns.count();
|
int btnCount = btns.size();
|
||||||
int iconCount = icons.count();
|
int iconCount = icons.size();
|
||||||
if (btnCount <= 0 || iconCount <= 0 || btnCount != iconCount) {
|
if (btnCount <= 0 || iconCount <= 0 || btnCount != iconCount) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -329,7 +329,7 @@ void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList
|
|||||||
|
|
||||||
//可能会重复调用设置所以先要移除上一次的
|
//可能会重复调用设置所以先要移除上一次的
|
||||||
for (int i = 0; i < btnCount; ++i) {
|
for (int i = 0; i < btnCount; ++i) {
|
||||||
for (int j = 0; j < this->btns.count(); j++) {
|
for (int j = 0; j < this->btns.size(); j++) {
|
||||||
if (this->btns.at(j) == btns.at(i)) {
|
if (this->btns.at(j) == btns.at(i)) {
|
||||||
disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
|
disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
|
||||||
this->btns.at(j)->removeEventFilter(this);
|
this->btns.at(j)->removeEventFilter(this);
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ SaveLog::SaveLog(QObject *parent) : QObject(parent)
|
|||||||
//默认取应用程序可执行文件名称
|
//默认取应用程序可执行文件名称
|
||||||
QString str = qApp->applicationFilePath();
|
QString str = qApp->applicationFilePath();
|
||||||
QStringList list = str.split("/");
|
QStringList list = str.split("/");
|
||||||
name = list.at(list.count() - 1).split(".").at(0);
|
name = list.at(list.size() - 1).split(".").at(0);
|
||||||
fileName = "";
|
fileName = "";
|
||||||
|
|
||||||
//默认所有类型都输出
|
//默认所有类型都输出
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ SaveRunTime::SaveRunTime(QObject *parent) : QObject(parent)
|
|||||||
path = qApp->applicationDirPath();
|
path = qApp->applicationDirPath();
|
||||||
QString str = qApp->applicationFilePath();
|
QString str = qApp->applicationFilePath();
|
||||||
QStringList list = str.split("/");
|
QStringList list = str.split("/");
|
||||||
name = list.at(list.count() - 1).split(".").at(0);
|
name = list.at(list.size() - 1).split(".").at(0);
|
||||||
|
|
||||||
saveInterval = 1 * 60 * 1000;
|
saveInterval = 1 * 60 * 1000;
|
||||||
startTime = QDateTime::currentDateTime();
|
startTime = QDateTime::currentDateTime();
|
||||||
@@ -187,7 +187,7 @@ void SaveRunTime::saveLog()
|
|||||||
//重新清空文件
|
//重新清空文件
|
||||||
file.resize(0);
|
file.resize(0);
|
||||||
//如果行数小于2则返回
|
//如果行数小于2则返回
|
||||||
if (content.count() < 2) {
|
if (content.size() < 2) {
|
||||||
file.close();
|
file.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -206,7 +206,7 @@ void SaveRunTime::saveLog()
|
|||||||
lastLine = list.join("\t");
|
lastLine = list.join("\t");
|
||||||
|
|
||||||
//重新替换最后一行并写入新的数据
|
//重新替换最后一行并写入新的数据
|
||||||
content[content.count() - 1] = lastLine;
|
content[content.size() - 1] = lastLine;
|
||||||
|
|
||||||
QTextStream stream(&file);
|
QTextStream stream(&file);
|
||||||
stream << content.join("") << "\n";
|
stream << content.join("") << "\n";
|
||||||
|
|||||||
@@ -24,13 +24,13 @@ QPainterPath SmoothCurve::createSmoothCurve(const QVector<QPointF> &points)
|
|||||||
QPainterPath SmoothCurve::createSmoothCurve2(const QVector<QPointF> &points)
|
QPainterPath SmoothCurve::createSmoothCurve2(const QVector<QPointF> &points)
|
||||||
{
|
{
|
||||||
//采用Qt原生方法不做任何处理
|
//采用Qt原生方法不做任何处理
|
||||||
int count = points.count();
|
int size = points.size();
|
||||||
if (count == 0) {
|
if (size == 0) {
|
||||||
return QPainterPath();
|
return QPainterPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
QPainterPath path(points.at(0));
|
QPainterPath path(points.at(0));
|
||||||
for (int i = 0; i < count - 1; ++i) {
|
for (int i = 0; i < size - 1; ++i) {
|
||||||
//控制点的 x 坐标为 sp 与 ep 的 x 坐标和的一半
|
//控制点的 x 坐标为 sp 与 ep 的 x 坐标和的一半
|
||||||
//第一个控制点 c1 的 y 坐标为起始点 sp 的 y 坐标
|
//第一个控制点 c1 的 y 坐标为起始点 sp 的 y 坐标
|
||||||
//第二个控制点 c2 的 y 坐标为结束点 ep 的 y 坐标
|
//第二个控制点 c2 的 y 坐标为结束点 ep 的 y 坐标
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ void ZhToPY::loadPY(const QString &fileName)
|
|||||||
|
|
||||||
QString ZhToPY::zhToPY(const QString &chinese)
|
QString ZhToPY::zhToPY(const QString &chinese)
|
||||||
{
|
{
|
||||||
if (listPY.count() == 0) {
|
if (listPY.size() == 0) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,13 +24,13 @@ QPainterPath SmoothCurve::createSmoothCurve(const QVector<QPointF> &points)
|
|||||||
QPainterPath SmoothCurve::createSmoothCurve2(const QVector<QPointF> &points)
|
QPainterPath SmoothCurve::createSmoothCurve2(const QVector<QPointF> &points)
|
||||||
{
|
{
|
||||||
//采用Qt原生方法不做任何处理
|
//采用Qt原生方法不做任何处理
|
||||||
int count = points.count();
|
int size = points.size();
|
||||||
if (count == 0) {
|
if (size == 0) {
|
||||||
return QPainterPath();
|
return QPainterPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
QPainterPath path(points.at(0));
|
QPainterPath path(points.at(0));
|
||||||
for (int i = 0; i < count - 1; ++i) {
|
for (int i = 0; i < size - 1; ++i) {
|
||||||
//控制点的 x 坐标为 sp 与 ep 的 x 坐标和的一半
|
//控制点的 x 坐标为 sp 与 ep 的 x 坐标和的一半
|
||||||
//第一个控制点 c1 的 y 坐标为起始点 sp 的 y 坐标
|
//第一个控制点 c1 的 y 坐标为起始点 sp 的 y 坐标
|
||||||
//第二个控制点 c2 的 y 坐标为结束点 ep 的 y 坐标
|
//第二个控制点 c2 的 y 坐标为结束点 ep 的 y 坐标
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ IconHelper::IconHelper(const QString &fontFile, const QString &fontName, QObject
|
|||||||
if (!fontDb.families().contains(fontName) && QFile(fontFile).exists()) {
|
if (!fontDb.families().contains(fontName) && QFile(fontFile).exists()) {
|
||||||
int fontId = fontDb.addApplicationFont(fontFile);
|
int fontId = fontDb.addApplicationFont(fontFile);
|
||||||
QStringList listName = fontDb.applicationFontFamilies(fontId);
|
QStringList listName = fontDb.applicationFontFamilies(fontId);
|
||||||
if (listName.count() == 0) {
|
if (listName.size() == 0) {
|
||||||
qDebug() << QString("load %1 error").arg(fontName);
|
qDebug() << QString("load %1 error").arg(fontName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -265,8 +265,8 @@ void IconHelper::setStyle1(QWidget *widget, QList<QToolButton *> btns, QList<int
|
|||||||
|
|
||||||
void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList<int> icons, const IconHelper::StyleColor &styleColor)
|
void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList<int> icons, const IconHelper::StyleColor &styleColor)
|
||||||
{
|
{
|
||||||
int btnCount = btns.count();
|
int btnCount = btns.size();
|
||||||
int iconCount = icons.count();
|
int iconCount = icons.size();
|
||||||
if (btnCount <= 0 || iconCount <= 0 || btnCount != iconCount) {
|
if (btnCount <= 0 || iconCount <= 0 || btnCount != iconCount) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -329,7 +329,7 @@ void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList
|
|||||||
|
|
||||||
//可能会重复调用设置所以先要移除上一次的
|
//可能会重复调用设置所以先要移除上一次的
|
||||||
for (int i = 0; i < btnCount; ++i) {
|
for (int i = 0; i < btnCount; ++i) {
|
||||||
for (int j = 0; j < this->btns.count(); j++) {
|
for (int j = 0; j < this->btns.size(); j++) {
|
||||||
if (this->btns.at(j) == btns.at(i)) {
|
if (this->btns.at(j) == btns.at(i)) {
|
||||||
disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
|
disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
|
||||||
this->btns.at(j)->removeEventFilter(this);
|
this->btns.at(j)->removeEventFilter(this);
|
||||||
|
|||||||
Binary file not shown.
@@ -136,7 +136,7 @@ IconHelper::IconHelper(const QString &fontFile, const QString &fontName, QObject
|
|||||||
if (!fontDb.families().contains(fontName) && QFile(fontFile).exists()) {
|
if (!fontDb.families().contains(fontName) && QFile(fontFile).exists()) {
|
||||||
int fontId = fontDb.addApplicationFont(fontFile);
|
int fontId = fontDb.addApplicationFont(fontFile);
|
||||||
QStringList listName = fontDb.applicationFontFamilies(fontId);
|
QStringList listName = fontDb.applicationFontFamilies(fontId);
|
||||||
if (listName.count() == 0) {
|
if (listName.size() == 0) {
|
||||||
qDebug() << QString("load %1 error").arg(fontName);
|
qDebug() << QString("load %1 error").arg(fontName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -265,8 +265,8 @@ void IconHelper::setStyle1(QWidget *widget, QList<QToolButton *> btns, QList<int
|
|||||||
|
|
||||||
void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList<int> icons, const IconHelper::StyleColor &styleColor)
|
void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList<int> icons, const IconHelper::StyleColor &styleColor)
|
||||||
{
|
{
|
||||||
int btnCount = btns.count();
|
int btnCount = btns.size();
|
||||||
int iconCount = icons.count();
|
int iconCount = icons.size();
|
||||||
if (btnCount <= 0 || iconCount <= 0 || btnCount != iconCount) {
|
if (btnCount <= 0 || iconCount <= 0 || btnCount != iconCount) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -329,7 +329,7 @@ void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList
|
|||||||
|
|
||||||
//可能会重复调用设置所以先要移除上一次的
|
//可能会重复调用设置所以先要移除上一次的
|
||||||
for (int i = 0; i < btnCount; ++i) {
|
for (int i = 0; i < btnCount; ++i) {
|
||||||
for (int j = 0; j < this->btns.count(); j++) {
|
for (int j = 0; j < this->btns.size(); j++) {
|
||||||
if (this->btns.at(j) == btns.at(i)) {
|
if (this->btns.at(j) == btns.at(i)) {
|
||||||
disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
|
disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
|
||||||
this->btns.at(j)->removeEventFilter(this);
|
this->btns.at(j)->removeEventFilter(this);
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -136,7 +136,7 @@ IconHelper::IconHelper(const QString &fontFile, const QString &fontName, QObject
|
|||||||
if (!fontDb.families().contains(fontName) && QFile(fontFile).exists()) {
|
if (!fontDb.families().contains(fontName) && QFile(fontFile).exists()) {
|
||||||
int fontId = fontDb.addApplicationFont(fontFile);
|
int fontId = fontDb.addApplicationFont(fontFile);
|
||||||
QStringList listName = fontDb.applicationFontFamilies(fontId);
|
QStringList listName = fontDb.applicationFontFamilies(fontId);
|
||||||
if (listName.count() == 0) {
|
if (listName.size() == 0) {
|
||||||
qDebug() << QString("load %1 error").arg(fontName);
|
qDebug() << QString("load %1 error").arg(fontName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -265,8 +265,8 @@ void IconHelper::setStyle1(QWidget *widget, QList<QToolButton *> btns, QList<int
|
|||||||
|
|
||||||
void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList<int> icons, const IconHelper::StyleColor &styleColor)
|
void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList<int> icons, const IconHelper::StyleColor &styleColor)
|
||||||
{
|
{
|
||||||
int btnCount = btns.count();
|
int btnCount = btns.size();
|
||||||
int iconCount = icons.count();
|
int iconCount = icons.size();
|
||||||
if (btnCount <= 0 || iconCount <= 0 || btnCount != iconCount) {
|
if (btnCount <= 0 || iconCount <= 0 || btnCount != iconCount) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -329,7 +329,7 @@ void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList
|
|||||||
|
|
||||||
//可能会重复调用设置所以先要移除上一次的
|
//可能会重复调用设置所以先要移除上一次的
|
||||||
for (int i = 0; i < btnCount; ++i) {
|
for (int i = 0; i < btnCount; ++i) {
|
||||||
for (int j = 0; j < this->btns.count(); j++) {
|
for (int j = 0; j < this->btns.size(); j++) {
|
||||||
if (this->btns.at(j) == btns.at(i)) {
|
if (this->btns.at(j) == btns.at(i)) {
|
||||||
disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
|
disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
|
||||||
this->btns.at(j)->removeEventFilter(this);
|
this->btns.at(j)->removeEventFilter(this);
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ PanelWidget::PanelWidget(QWidget *parent) : QWidget(parent)
|
|||||||
scrollArea->setWidget(scrollAreaContents);
|
scrollArea->setWidget(scrollAreaContents);
|
||||||
frame->setStyleSheet("QFrame#frameMain{border-width:0px;}");
|
frame->setStyleSheet("QFrame#frameMain{border-width:0px;}");
|
||||||
|
|
||||||
|
hSpacer = new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||||
|
vSpacer = new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||||
|
|
||||||
margin = 0;
|
margin = 0;
|
||||||
space = 0;
|
space = 0;
|
||||||
autoWidth = false;
|
autoWidth = false;
|
||||||
@@ -133,12 +136,16 @@ void PanelWidget::loadWidgets()
|
|||||||
int column = 0;
|
int column = 0;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
//先把之前的所有移除并不可见
|
//先把之前的所有移除并不可见
|
||||||
foreach (QWidget *widget, widgets) {
|
foreach (QWidget *widget, widgets) {
|
||||||
gridLayout->removeWidget(widget);
|
gridLayout->removeWidget(widget);
|
||||||
widget->setVisible(false);
|
widget->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//移除所有弹簧
|
||||||
|
gridLayout->removeItem(hSpacer);
|
||||||
|
gridLayout->removeItem(vSpacer);
|
||||||
|
|
||||||
//重新添加到布局中并可见
|
//重新添加到布局中并可见
|
||||||
foreach (QWidget *widget, widgets) {
|
foreach (QWidget *widget, widgets) {
|
||||||
gridLayout->addWidget(widget, row, column);
|
gridLayout->addWidget(widget, row, column);
|
||||||
@@ -156,13 +163,11 @@ void PanelWidget::loadWidgets()
|
|||||||
|
|
||||||
//设置右边弹簧
|
//设置右边弹簧
|
||||||
if (!autoWidth) {
|
if (!autoWidth) {
|
||||||
QSpacerItem *hSpacer = new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
|
||||||
gridLayout->addItem(hSpacer, 0, gridLayout->columnCount());
|
gridLayout->addItem(hSpacer, 0, gridLayout->columnCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置底边弹簧
|
//设置底边弹簧
|
||||||
if (!autoHeight) {
|
if (!autoHeight) {
|
||||||
QSpacerItem *vSpacer = new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
|
||||||
gridLayout->addItem(vSpacer, row, 0);
|
gridLayout->addItem(vSpacer, row, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class QScrollArea;
|
|||||||
class QFrame;
|
class QFrame;
|
||||||
class QVBoxLayout;
|
class QVBoxLayout;
|
||||||
class QGridLayout;
|
class QGridLayout;
|
||||||
|
class QSpacerItem;
|
||||||
|
|
||||||
#ifdef quc
|
#ifdef quc
|
||||||
class Q_DECL_EXPORT PanelWidget : public QWidget
|
class Q_DECL_EXPORT PanelWidget : public QWidget
|
||||||
@@ -43,6 +44,8 @@ private:
|
|||||||
QFrame *frame; //放置设备的框架,自动变宽变高
|
QFrame *frame; //放置设备的框架,自动变宽变高
|
||||||
QVBoxLayout *verticalLayout; //设备面板总布局
|
QVBoxLayout *verticalLayout; //设备面板总布局
|
||||||
QGridLayout *gridLayout; //设备表格布局
|
QGridLayout *gridLayout; //设备表格布局
|
||||||
|
QSpacerItem *hSpacer; //横向弹簧
|
||||||
|
QSpacerItem *vSpacer; //垂直弹簧
|
||||||
|
|
||||||
int margin; //边距
|
int margin; //边距
|
||||||
int space; //设备之间的间隔
|
int space; //设备之间的间隔
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ void FFmpegThread::run()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
frameFinish = avcodec_receive_frame(videoCodec, avFrame2);
|
frameFinish = avcodec_receive_frame(videoCodec, avFrame2);
|
||||||
if (frameFinish < 0) {
|
if (frameFinish < 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -383,7 +383,16 @@ void FFmpegWidget::paintEvent(QPaintEvent *)
|
|||||||
|
|
||||||
//qDebug() << TIMEMS << "paintEvent" << objectName();
|
//qDebug() << TIMEMS << "paintEvent" << objectName();
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
|
#if 0
|
||||||
|
//image = image.scaled(this->size(), Qt::KeepAspectRatio);
|
||||||
|
//按照比例自动居中绘制
|
||||||
|
int pixX = rect().center().x() - image.width() / 2;
|
||||||
|
int pixY = rect().center().y() - image.height() / 2;
|
||||||
|
QPoint point(pixX, pixY);
|
||||||
|
painter.drawImage(point, image);
|
||||||
|
#else
|
||||||
painter.drawImage(this->rect(), image);
|
painter.drawImage(this->rect(), image);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void FFmpegWidget::updateImage(const QImage &image)
|
void FFmpegWidget::updateImage(const QImage &image)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
### 特别说明
|
### 特别说明
|
||||||
1. 编译完成以后记得将动态库文件复制到可执行文件同一目录。
|
1. 编译完成以后记得将动态库文件复制到可执行文件同一目录。
|
||||||
2. 动态库地址:[https://pan.baidu.com/s/13LDRu6mXC6gaADtrGprNVA](https://pan.baidu.com/s/13LDRu6mXC6gaADtrGprNVA) 提取码: ujm7
|
2. 动态库地址:[https://pan.baidu.com/s/13LDRu6mXC6gaADtrGprNVA](https://pan.baidu.com/s/13LDRu6mXC6gaADtrGprNVA) 提取码: ujm7
|
||||||
3. 收费增强版:[https://qtchina.blog.csdn.net/article/details/103946731](https://qtchina.blog.csdn.net/article/details/103946731)
|
3. 收费增强版:[https://qtchina.blog.csdn.net/article/details/103946067](https://qtchina.blog.csdn.net/article/details/103946067)
|
||||||
|
|
||||||
### 其他说明
|
### 其他说明
|
||||||
1. 作品大全:[https://qtchina.blog.csdn.net/article/details/97565652](https://qtchina.blog.csdn.net/article/details/97565652)
|
1. 作品大全:[https://qtchina.blog.csdn.net/article/details/97565652](https://qtchina.blog.csdn.net/article/details/97565652)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
QStringList urls;
|
QStringList urls;
|
||||||
urls << "https://hls01open.ys7.com/openlive/6e0b2be040a943489ef0b9bb344b96b8.hd.m3u8";
|
urls << "f:/1.mp4";
|
||||||
urls << "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov";
|
urls << "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov";
|
||||||
urls << "http://vfx.mtime.cn/Video/2019/02/04/mp4/190204084208765161.mp4";
|
urls << "http://vfx.mtime.cn/Video/2019/02/04/mp4/190204084208765161.mp4";
|
||||||
urls << "rtsp://admin:Admin123456@192.168.0.15:554/media/video1";
|
urls << "rtsp://admin:Admin123456@192.168.0.15:554/media/video1";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
### 特别说明
|
### 特别说明
|
||||||
1. 编译完成以后记得将dll文件复制到可执行文件同一目录。
|
1. 编译完成以后记得将dll文件复制到可执行文件同一目录。
|
||||||
2. 动态库地址:[https://pan.baidu.com/s/13LDRu6mXC6gaADtrGprNVA](https://pan.baidu.com/s/13LDRu6mXC6gaADtrGprNVA) 提取码: ujm7
|
2. 动态库地址:[https://pan.baidu.com/s/13LDRu6mXC6gaADtrGprNVA](https://pan.baidu.com/s/13LDRu6mXC6gaADtrGprNVA) 提取码: ujm7
|
||||||
3. 收费增强版:[https://qtchina.blog.csdn.net/article/details/107972067](https://qtchina.blog.csdn.net/article/details/107972067)
|
3. 收费增强版:[https://qtchina.blog.csdn.net/article/details/103946067](https://qtchina.blog.csdn.net/article/details/103946067)
|
||||||
|
|
||||||
### 其他说明
|
### 其他说明
|
||||||
1. 作品大全:[https://qtchina.blog.csdn.net/article/details/97565652](https://qtchina.blog.csdn.net/article/details/97565652)
|
1. 作品大全:[https://qtchina.blog.csdn.net/article/details/97565652](https://qtchina.blog.csdn.net/article/details/97565652)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ void VideoBox::addMenu(QMenu *menu, int type)
|
|||||||
|
|
||||||
//超过一个子元素则添加子菜单
|
//超过一个子元素则添加子菜单
|
||||||
QMenu *menuSub;
|
QMenu *menuSub;
|
||||||
if (flags.count() > 1) {
|
if (flags.size() > 1) {
|
||||||
menuSub = menu->addMenu(name);
|
menuSub = menu->addMenu(name);
|
||||||
} else {
|
} else {
|
||||||
menuSub = menu;
|
menuSub = menu;
|
||||||
@@ -50,7 +50,7 @@ void VideoBox::addMenu(QMenu *menu, int type)
|
|||||||
|
|
||||||
//对应菜单文本
|
//对应菜单文本
|
||||||
QString text = QString("%1%2-%1%3").arg(actionFlag).arg(start).arg(end);
|
QString text = QString("%1%2-%1%3").arg(actionFlag).arg(start).arg(end);
|
||||||
if (flags.count() == 1) {
|
if (flags.size() == 1) {
|
||||||
text = name;
|
text = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ void VideoBox::setLayout(QGridLayout *gridLayout)
|
|||||||
void VideoBox::setWidgets(QWidgetList widgets)
|
void VideoBox::setWidgets(QWidgetList widgets)
|
||||||
{
|
{
|
||||||
this->widgets = widgets;
|
this->widgets = widgets;
|
||||||
this->videoCount = widgets.count();
|
this->videoCount = widgets.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoBox::setMenuFlag(const QString &menuFlag)
|
void VideoBox::setMenuFlag(const QString &menuFlag)
|
||||||
@@ -97,7 +97,7 @@ void VideoBox::setTypes(const QMap<int, QStringList> &types)
|
|||||||
void VideoBox::initMenu(QMenu *menu, const QList<bool> &enable)
|
void VideoBox::initMenu(QMenu *menu, const QList<bool> &enable)
|
||||||
{
|
{
|
||||||
//通过菜单是否可见设置每个菜单可见与否
|
//通过菜单是否可见设置每个菜单可见与否
|
||||||
if (enable.count() < 9) {
|
if (enable.size() < 9) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ void VideoBox::change_video_normal(int index, int flag)
|
|||||||
{
|
{
|
||||||
//首先隐藏所有通道
|
//首先隐藏所有通道
|
||||||
hide_video_all();
|
hide_video_all();
|
||||||
int count = 0;
|
int size = 0;
|
||||||
int row = 0;
|
int row = 0;
|
||||||
int column = 0;
|
int column = 0;
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@ void VideoBox::change_video_normal(int index, int flag)
|
|||||||
gridLayout->addWidget(widgets.at(i), row, column);
|
gridLayout->addWidget(widgets.at(i), row, column);
|
||||||
widgets.at(i)->setVisible(true);
|
widgets.at(i)->setVisible(true);
|
||||||
|
|
||||||
count++;
|
size++;
|
||||||
column++;
|
column++;
|
||||||
if (column == flag) {
|
if (column == flag) {
|
||||||
row++;
|
row++;
|
||||||
@@ -229,7 +229,7 @@ void VideoBox::change_video_normal(int index, int flag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count == (flag * flag)) {
|
if (size == (flag * flag)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -255,7 +255,7 @@ void VideoBox::change_video_custom(int index, int type)
|
|||||||
void VideoBox::change_video_6(const QList<int> &indexs)
|
void VideoBox::change_video_6(const QList<int> &indexs)
|
||||||
{
|
{
|
||||||
//过滤防止索引越界
|
//过滤防止索引越界
|
||||||
if (indexs.count() < 6) {
|
if (indexs.size() < 6) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,7 +277,7 @@ void VideoBox::change_video_6(const QList<int> &indexs)
|
|||||||
void VideoBox::change_video_8(const QList<int> &indexs)
|
void VideoBox::change_video_8(const QList<int> &indexs)
|
||||||
{
|
{
|
||||||
//过滤防止索引越界
|
//过滤防止索引越界
|
||||||
if (indexs.count() < 8) {
|
if (indexs.size() < 8) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,7 +301,7 @@ void VideoBox::change_video_8(const QList<int> &indexs)
|
|||||||
void VideoBox::change_video_13(const QList<int> &indexs)
|
void VideoBox::change_video_13(const QList<int> &indexs)
|
||||||
{
|
{
|
||||||
//过滤防止索引越界
|
//过滤防止索引越界
|
||||||
if (indexs.count() < 13) {
|
if (indexs.size() < 13) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ void VideoBox::addMenu(QMenu *menu, int type)
|
|||||||
|
|
||||||
//超过一个子元素则添加子菜单
|
//超过一个子元素则添加子菜单
|
||||||
QMenu *menuSub;
|
QMenu *menuSub;
|
||||||
if (flags.count() > 1) {
|
if (flags.size() > 1) {
|
||||||
menuSub = menu->addMenu(name);
|
menuSub = menu->addMenu(name);
|
||||||
} else {
|
} else {
|
||||||
menuSub = menu;
|
menuSub = menu;
|
||||||
@@ -50,7 +50,7 @@ void VideoBox::addMenu(QMenu *menu, int type)
|
|||||||
|
|
||||||
//对应菜单文本
|
//对应菜单文本
|
||||||
QString text = QString("%1%2-%1%3").arg(actionFlag).arg(start).arg(end);
|
QString text = QString("%1%2-%1%3").arg(actionFlag).arg(start).arg(end);
|
||||||
if (flags.count() == 1) {
|
if (flags.size() == 1) {
|
||||||
text = name;
|
text = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ void VideoBox::setLayout(QGridLayout *gridLayout)
|
|||||||
void VideoBox::setWidgets(QWidgetList widgets)
|
void VideoBox::setWidgets(QWidgetList widgets)
|
||||||
{
|
{
|
||||||
this->widgets = widgets;
|
this->widgets = widgets;
|
||||||
this->videoCount = widgets.count();
|
this->videoCount = widgets.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoBox::setMenuFlag(const QString &menuFlag)
|
void VideoBox::setMenuFlag(const QString &menuFlag)
|
||||||
@@ -97,7 +97,7 @@ void VideoBox::setTypes(const QMap<int, QStringList> &types)
|
|||||||
void VideoBox::initMenu(QMenu *menu, const QList<bool> &enable)
|
void VideoBox::initMenu(QMenu *menu, const QList<bool> &enable)
|
||||||
{
|
{
|
||||||
//通过菜单是否可见设置每个菜单可见与否
|
//通过菜单是否可见设置每个菜单可见与否
|
||||||
if (enable.count() < 9) {
|
if (enable.size() < 9) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ void VideoBox::change_video_normal(int index, int flag)
|
|||||||
{
|
{
|
||||||
//首先隐藏所有通道
|
//首先隐藏所有通道
|
||||||
hide_video_all();
|
hide_video_all();
|
||||||
int count = 0;
|
int size = 0;
|
||||||
int row = 0;
|
int row = 0;
|
||||||
int column = 0;
|
int column = 0;
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@ void VideoBox::change_video_normal(int index, int flag)
|
|||||||
gridLayout->addWidget(widgets.at(i), row, column);
|
gridLayout->addWidget(widgets.at(i), row, column);
|
||||||
widgets.at(i)->setVisible(true);
|
widgets.at(i)->setVisible(true);
|
||||||
|
|
||||||
count++;
|
size++;
|
||||||
column++;
|
column++;
|
||||||
if (column == flag) {
|
if (column == flag) {
|
||||||
row++;
|
row++;
|
||||||
@@ -229,7 +229,7 @@ void VideoBox::change_video_normal(int index, int flag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count == (flag * flag)) {
|
if (size == (flag * flag)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -255,7 +255,7 @@ void VideoBox::change_video_custom(int index, int type)
|
|||||||
void VideoBox::change_video_6(const QList<int> &indexs)
|
void VideoBox::change_video_6(const QList<int> &indexs)
|
||||||
{
|
{
|
||||||
//过滤防止索引越界
|
//过滤防止索引越界
|
||||||
if (indexs.count() < 6) {
|
if (indexs.size() < 6) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,7 +277,7 @@ void VideoBox::change_video_6(const QList<int> &indexs)
|
|||||||
void VideoBox::change_video_8(const QList<int> &indexs)
|
void VideoBox::change_video_8(const QList<int> &indexs)
|
||||||
{
|
{
|
||||||
//过滤防止索引越界
|
//过滤防止索引越界
|
||||||
if (indexs.count() < 8) {
|
if (indexs.size() < 8) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,7 +301,7 @@ void VideoBox::change_video_8(const QList<int> &indexs)
|
|||||||
void VideoBox::change_video_13(const QList<int> &indexs)
|
void VideoBox::change_video_13(const QList<int> &indexs)
|
||||||
{
|
{
|
||||||
//过滤防止索引越界
|
//过滤防止索引越界
|
||||||
if (indexs.count() < 13) {
|
if (indexs.size() < 13) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -109,7 +109,7 @@ void VideoWindow::initFlowPanel()
|
|||||||
if (!fontDb.families().contains("iconfont")) {
|
if (!fontDb.families().contains("iconfont")) {
|
||||||
int fontId = fontDb.addApplicationFont(":/font/iconfont.ttf");
|
int fontId = fontDb.addApplicationFont(":/font/iconfont.ttf");
|
||||||
QStringList fontName = fontDb.applicationFontFamilies(fontId);
|
QStringList fontName = fontDb.applicationFontFamilies(fontId);
|
||||||
if (fontName.count() == 0) {
|
if (fontName.size() == 0) {
|
||||||
qDebug() << "load iconfont.ttf error";
|
qDebug() << "load iconfont.ttf error";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ void VideoWindow::initFlowPanel()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//循环添加顶部按钮
|
//循环添加顶部按钮
|
||||||
for (int i = 0; i < btns.count(); ++i) {
|
for (int i = 0; i < btns.size(); ++i) {
|
||||||
QPushButton *btn = new QPushButton;
|
QPushButton *btn = new QPushButton;
|
||||||
//绑定按钮单击事件,用来发出信号通知
|
//绑定按钮单击事件,用来发出信号通知
|
||||||
connect(btn, SIGNAL(clicked(bool)), this, SLOT(btnClicked()));
|
connect(btn, SIGNAL(clicked(bool)), this, SLOT(btnClicked()));
|
||||||
@@ -208,7 +208,7 @@ void VideoWindow::dropEvent(QDropEvent *event)
|
|||||||
url = event->mimeData()->urls().first().toLocalFile();
|
url = event->mimeData()->urls().first().toLocalFile();
|
||||||
} else if (event->mimeData()->hasFormat("application/x-qabstractitemmodeldatalist")) {
|
} else if (event->mimeData()->hasFormat("application/x-qabstractitemmodeldatalist")) {
|
||||||
QTreeWidget *treeWidget = (QTreeWidget *)event->source();
|
QTreeWidget *treeWidget = (QTreeWidget *)event->source();
|
||||||
if (treeWidget != 0) {
|
if (treeWidget) {
|
||||||
url = treeWidget->currentItem()->data(0, Qt::UserRole).toString();
|
url = treeWidget->currentItem()->data(0, Qt::UserRole).toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ bool FramelessDialog::nativeEvent(const QByteArray &eventType, void *message, lo
|
|||||||
}
|
}
|
||||||
|
|
||||||
//识别标题栏拖动产生半屏全屏效果
|
//识别标题栏拖动产生半屏全屏效果
|
||||||
if (titleBar != 0 && titleBar->rect().contains(pos)) {
|
if (titleBar && titleBar->rect().contains(pos)) {
|
||||||
QWidget *child = titleBar->childAt(pos);
|
QWidget *child = titleBar->childAt(pos);
|
||||||
if (!child) {
|
if (!child) {
|
||||||
*result = HTCAPTION;
|
*result = HTCAPTION;
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ bool FramelessMainWindow::nativeEvent(const QByteArray &eventType, void *message
|
|||||||
}
|
}
|
||||||
|
|
||||||
//识别标题栏拖动产生半屏全屏效果
|
//识别标题栏拖动产生半屏全屏效果
|
||||||
if (titleBar != 0 && titleBar->rect().contains(pos)) {
|
if (titleBar && titleBar->rect().contains(pos)) {
|
||||||
QWidget *child = titleBar->childAt(pos);
|
QWidget *child = titleBar->childAt(pos);
|
||||||
if (!child) {
|
if (!child) {
|
||||||
*result = HTCAPTION;
|
*result = HTCAPTION;
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ bool FramelessWidget::nativeEvent(const QByteArray &eventType, void *message, lo
|
|||||||
}
|
}
|
||||||
|
|
||||||
//识别标题栏拖动产生半屏全屏效果
|
//识别标题栏拖动产生半屏全屏效果
|
||||||
if (titleBar != 0 && titleBar->rect().contains(pos)) {
|
if (titleBar && titleBar->rect().contains(pos)) {
|
||||||
QWidget *child = titleBar->childAt(pos);
|
QWidget *child = titleBar->childAt(pos);
|
||||||
if (!child) {
|
if (!child) {
|
||||||
*result = HTCAPTION;
|
*result = HTCAPTION;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ FramelessWidget2::FramelessWidget2(QObject *parent) : QObject(parent)
|
|||||||
|
|
||||||
bool FramelessWidget2::eventFilter(QObject *watched, QEvent *event)
|
bool FramelessWidget2::eventFilter(QObject *watched, QEvent *event)
|
||||||
{
|
{
|
||||||
if (widget != 0 && watched == widget) {
|
if (widget && watched == widget) {
|
||||||
if (event->type() == QEvent::WindowStateChange) {
|
if (event->type() == QEvent::WindowStateChange) {
|
||||||
//解决mac系统上无边框最小化失效的bug
|
//解决mac系统上无边框最小化失效的bug
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ LunarCalendarWidget::LunarCalendarWidget(QWidget *parent) : QWidget(parent)
|
|||||||
if (!fontDb.families().contains("FontAwesome")) {
|
if (!fontDb.families().contains("FontAwesome")) {
|
||||||
int fontId = fontDb.addApplicationFont(":/font/fontawesome-webfont.ttf");
|
int fontId = fontDb.addApplicationFont(":/font/fontawesome-webfont.ttf");
|
||||||
QStringList fontName = fontDb.applicationFontFamilies(fontId);
|
QStringList fontName = fontDb.applicationFontFamilies(fontId);
|
||||||
if (fontName.count() == 0) {
|
if (fontName.size() == 0) {
|
||||||
qDebug() << "load fontawesome-webfont.ttf error";
|
qDebug() << "load fontawesome-webfont.ttf error";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ void MaskWidget::setBgColor(const QColor &bgColor)
|
|||||||
|
|
||||||
void MaskWidget::showEvent(QShowEvent *)
|
void MaskWidget::showEvent(QShowEvent *)
|
||||||
{
|
{
|
||||||
if (mainWidget != 0) {
|
if (mainWidget) {
|
||||||
this->setGeometry(mainWidget->geometry());
|
this->setGeometry(mainWidget->geometry());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,7 +91,7 @@ bool MaskWidget::eventFilter(QObject *obj, QEvent *event)
|
|||||||
}
|
}
|
||||||
} else if (event->type() == QEvent::WindowActivate) {
|
} else if (event->type() == QEvent::WindowActivate) {
|
||||||
//当主窗体激活时,同时激活遮罩层
|
//当主窗体激活时,同时激活遮罩层
|
||||||
if (mainWidget != 0) {
|
if (mainWidget) {
|
||||||
if (obj->objectName() == mainWidget->objectName()) {
|
if (obj->objectName() == mainWidget->objectName()) {
|
||||||
if (this->isVisible()) {
|
if (this->isVisible()) {
|
||||||
this->activateWindow();
|
this->activateWindow();
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ MoveWidget::MoveWidget(QObject *parent) : QObject(parent)
|
|||||||
|
|
||||||
bool MoveWidget::eventFilter(QObject *watched, QEvent *event)
|
bool MoveWidget::eventFilter(QObject *watched, QEvent *event)
|
||||||
{
|
{
|
||||||
if (widget != 0 && watched == widget) {
|
if (widget && watched == widget) {
|
||||||
QMouseEvent *mouseEvent = (QMouseEvent *)event;
|
QMouseEvent *mouseEvent = (QMouseEvent *)event;
|
||||||
if (mouseEvent->type() == QEvent::MouseButtonPress) {
|
if (mouseEvent->type() == QEvent::MouseButtonPress) {
|
||||||
//如果限定了只能鼠标左键拖动则判断当前是否是鼠标左键
|
//如果限定了只能鼠标左键拖动则判断当前是否是鼠标左键
|
||||||
@@ -38,7 +38,7 @@ bool MoveWidget::eventFilter(QObject *watched, QEvent *event)
|
|||||||
bool xyOut = (x + widget->width() < offset || y + widget->height() < offset);
|
bool xyOut = (x + widget->width() < offset || y + widget->height() < offset);
|
||||||
bool whOut = false;
|
bool whOut = false;
|
||||||
QWidget *w = (QWidget *)widget->parent();
|
QWidget *w = (QWidget *)widget->parent();
|
||||||
if (w != 0) {
|
if (w) {
|
||||||
whOut = (w->width() - x < offset || w->height() - y < offset);
|
whOut = (w->width() - x < offset || w->height() - y < offset);
|
||||||
}
|
}
|
||||||
if (xyOut || whOut) {
|
if (xyOut || whOut) {
|
||||||
@@ -71,4 +71,4 @@ void MoveWidget::setWidget(QWidget *widget)
|
|||||||
this->widget = widget;
|
this->widget = widget;
|
||||||
this->widget->installEventFilter(this);
|
this->widget->installEventFilter(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user