From fb9e34eb03b9c226b973db12b9044a365b1a5e51 Mon Sep 17 00:00:00 2001 From: feiyangqingyun Date: Sat, 15 Jul 2023 08:58:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 21 +++++++------- control/lightbutton.zip | Bin 0 -> 7005 bytes video/videobox/videobox.cpp | 52 +++++++++++++++++++++++++++++++--- video/videobox/videobox.h | 10 ++++++- video/videopanel/videobox.cpp | 52 +++++++++++++++++++++++++++++++--- video/videopanel/videobox.h | 10 ++++++- 6 files changed, 125 insertions(+), 20 deletions(-) create mode 100644 control/lightbutton.zip diff --git a/README.md b/README.md index 0dc2939..82320fb 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,16 @@ ## 0 前言说明 -1. **项目作品:[https://blog.csdn.net/feiyangqingyun/article/details/97565652](https://blog.csdn.net/feiyangqingyun/article/details/97565652)** -2. **网店地址:https://shop244026315.taobao.com/** -3. **联系方式:QQ(517216493)微信(feiyangqingyun)推荐加微信。** -4. **公 众 号:Qt教程(民间) Qt软件(官方)** -5. **版本支持:所有项目已经全部支持Qt4/5/6所有版本以及后续版本。** -6. 监控作品体验:[https://pan.baidu.com/s/1d7TH_GEYl5nOecuNlWJJ7g](https://pan.baidu.com/s/1d7TH_GEYl5nOecuNlWJJ7g) 提取码:01jf -7. 其他作品体验:[https://pan.baidu.com/s/1ZxG-oyUKe286LPMPxOrO2A](https://pan.baidu.com/s/1ZxG-oyUKe286LPMPxOrO2A) 提取码:o05q -8. 监控系统在线文档:[https://feiyangqingyun.gitee.io/QWidgetDemo/video_system/](https://feiyangqingyun.gitee.io/QWidgetDemo/video_system/) -9. 大屏系统在线文档:[https://feiyangqingyun.gitee.io/QWidgetDemo/bigscreen/](https://feiyangqingyun.gitee.io/QWidgetDemo/bigscreen/) -10. 物联网系统在线文档:[https://feiyangqingyun.gitee.io/QWidgetDemo/iotsystem/](https://feiyangqingyun.gitee.io/QWidgetDemo/iotsystem/) +1. **项目作品:[https://qtchina.blog.csdn.net/article/details/97565652](https://qtchina.blog.csdn.net/article/details/97565652)** +2. **视频主页: [https://space.bilibili.com/687803542](https://space.bilibili.com/687803542)** +3. **网店地址:[https://shop244026315.taobao.com](https://shop244026315.taobao.com)** +4. **联系方式:QQ(517216493)微信(feiyangqingyun)推荐加微信。** +5. **公 众 号:Qt教程(民间) Qt软件(官方)** +6. **版本支持:所有项目已经全部支持Qt4/5/6所有版本以及后续版本。** +7. 监控作品体验:[https://pan.baidu.com/s/1d7TH_GEYl5nOecuNlWJJ7g](https://pan.baidu.com/s/1d7TH_GEYl5nOecuNlWJJ7g) 提取码:01jf +8. 其他作品体验:[https://pan.baidu.com/s/1ZxG-oyUKe286LPMPxOrO2A](https://pan.baidu.com/s/1ZxG-oyUKe286LPMPxOrO2A) 提取码:o05q +9. 监控系统在线文档:[https://feiyangqingyun.gitee.io/QWidgetDemo/video_system/](https://feiyangqingyun.gitee.io/QWidgetDemo/video_system/) +10. 大屏系统在线文档:[https://feiyangqingyun.gitee.io/QWidgetDemo/bigscreen/](https://feiyangqingyun.gitee.io/QWidgetDemo/bigscreen/) +11. 物联网系统在线文档:[https://feiyangqingyun.gitee.io/QWidgetDemo/iotsystem/](https://feiyangqingyun.gitee.io/QWidgetDemo/iotsystem/) ## 1 特别说明 1. 可以选择打开QWidgetDemo.pro一次性编译所有的,也可以到目录下打开pro编译。 diff --git a/control/lightbutton.zip b/control/lightbutton.zip new file mode 100644 index 0000000000000000000000000000000000000000..a9cc4590098c963d7bf43a81fd6593bd182a0134 GIT binary patch literal 7005 zcmaKx1yEes5{3tN4FuQV?h=B#2KS(Y1eXa+kl-31xD#B12Dc!?0Kqj_2=49W%on*y&W`NNz#82{S~8iSNE?7r)8AI6+z^mv1Vg4_IiUd)m73d1acIr zww(}P6|3c1JZiHG%d)ksyp`G`ei0l>Yh*1$^Pj$h!6h6M_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..472f3f4 100644 --- a/video/videobox/videobox.cpp +++ b/video/videobox/videobox.cpp @@ -12,11 +12,13 @@ VideoBox::VideoBox(QObject *parent) : QObject(parent) videoCount = 64; videoType = "1_16"; + enableOther = false; menuFlag = "画面"; actionFlag = "通道"; - //通过这里设置好数据下面只需要循环添加和判断就行 - //灵活性大大增强,只需要这里改动下就行 + //通过这里设置好数据下面只需要循环添加和判断就行(灵活性大大增强/只需要这里改动下就行) + types.insert(2, QStringList() << "1_2"); + types.insert(3, QStringList() << "1_3"); types.insert(4, QStringList() << "1_4" << "5_8" << "9_12" << "13_16" << "17_20" << "21_24" << "25_28" << "29_32" << "33_36"); types.insert(6, QStringList() << "1_6" << "7_12" << "13_18" << "19_24" << "25_30" << "31_36"); types.insert(8, QStringList() << "1_8" << "9_16" << "17_24" << "25_32" << "33_40" << "41_48" << "49_57" << "57_64"); @@ -49,6 +51,8 @@ void VideoBox::addMenu(QMenu *menu, int type) QString end = list.at(1); //对应菜单文本 + start = QString("%1").arg(start, 2, QChar('0')); + end = QString("%1").arg(end, 2, QChar('0')); QString text = QString("%1%2-%1%3").arg(actionFlag).arg(start).arg(end); if (flags.count() == 1) { text = name; @@ -79,6 +83,11 @@ void VideoBox::setWidgets(QWidgetList widgets) this->videoCount = widgets.count(); } +void VideoBox::setEnableOther(bool enableOther) +{ + this->enableOther = enableOther; +} + void VideoBox::setMenuFlag(const QString &menuFlag) { this->menuFlag = menuFlag; @@ -96,6 +105,11 @@ void VideoBox::setTypes(const QMap &types) void VideoBox::initMenu(QMenu *menu, const QList &enable) { + if (enableOther) { + addMenu(menu, 2); + addMenu(menu, 3); + } + //通过菜单是否可见设置每个菜单可见与否 if (enable.count() < 9) { return; @@ -135,6 +149,10 @@ void VideoBox::show_video(int type, int index) //根据不同的父菜单类型执行对应的函数 if (type == 1) { change_video_1(index); + } else if (type == 2) { + change_video_2(index); + } else if (type == 3) { + change_video_3(index); } else if (type == 4) { change_video_4(index); } else if (type == 6) { @@ -332,9 +350,35 @@ void VideoBox::change_video_1(int index) //首先隐藏所有通道 hide_video_all(); //添加通道到布局 - gridLayout->addWidget(widgets.at(index), 0, 0); + gridLayout->addWidget(widgets.at(0), 0, 0); //设置可见 - widgets.at(index)->setVisible(true); + widgets.at(0)->setVisible(true); +} + +void VideoBox::change_video_2(int index) +{ + //首先隐藏所有通道 + hide_video_all(); + //添加通道到布局 + gridLayout->addWidget(widgets.at(0), 0, 0); + gridLayout->addWidget(widgets.at(1), 0, 1); + //设置可见 + widgets.at(0)->setVisible(true); + widgets.at(1)->setVisible(true); +} + +void VideoBox::change_video_3(int index) +{ + //首先隐藏所有通道 + hide_video_all(); + //添加通道到布局 + gridLayout->addWidget(widgets.at(0), 0, 0, 1, 2); + gridLayout->addWidget(widgets.at(1), 1, 0); + gridLayout->addWidget(widgets.at(2), 1, 1); + //设置可见 + widgets.at(0)->setVisible(true); + widgets.at(1)->setVisible(true); + widgets.at(2)->setVisible(true); } void VideoBox::change_video_4(int index) diff --git a/video/videobox/videobox.h b/video/videobox/videobox.h index 6d6474c..ac65216 100644 --- a/video/videobox/videobox.h +++ b/video/videobox/videobox.h @@ -4,7 +4,7 @@ /** * 监控画面切换控件 作者:feiyangqingyun(QQ:517216493) 2021-11-08 * 1. 将所有通道切换处理全部集中到一个类。 - * 2. 通用整数倍数布局切换函数,可方便拓展到100、255通道等。 + * 2. 通用整数倍数布局切换函数,可方便拓展到100/255通道等。 * 3. 通用异形布局切换函数,可以参考进行自定义异形布局。 * 4. 通道布局切换发出信号通知。 * 5. 可控每种布局切换菜单是否启用。 @@ -43,6 +43,9 @@ private: //当前画面类型 QString videoType; + //启用其他通道画面(2画面/3画面) + bool enableOther; + //主菜单子菜单文字标识 QString menuFlag; QString actionFlag; @@ -59,6 +62,9 @@ public Q_SLOTS: //设置视频控件集合 void setWidgets(QWidgetList widgets); + //设置启用其他通道画面 + void setEnableOther(bool enableOther); + //设置主菜单子菜单文字标识 void setMenuFlag(const QString &menuFlag); void setActionFlag(const QString &actionFlag); @@ -88,6 +94,8 @@ public Q_SLOTS: //具体通道切换函数 void change_video_1(int index); + void change_video_2(int index); + void change_video_3(int index); void change_video_4(int index); void change_video_6(int index); void change_video_8(int index); diff --git a/video/videopanel/videobox.cpp b/video/videopanel/videobox.cpp index 91c970b..472f3f4 100644 --- a/video/videopanel/videobox.cpp +++ b/video/videopanel/videobox.cpp @@ -12,11 +12,13 @@ VideoBox::VideoBox(QObject *parent) : QObject(parent) videoCount = 64; videoType = "1_16"; + enableOther = false; menuFlag = "画面"; actionFlag = "通道"; - //通过这里设置好数据下面只需要循环添加和判断就行 - //灵活性大大增强,只需要这里改动下就行 + //通过这里设置好数据下面只需要循环添加和判断就行(灵活性大大增强/只需要这里改动下就行) + types.insert(2, QStringList() << "1_2"); + types.insert(3, QStringList() << "1_3"); types.insert(4, QStringList() << "1_4" << "5_8" << "9_12" << "13_16" << "17_20" << "21_24" << "25_28" << "29_32" << "33_36"); types.insert(6, QStringList() << "1_6" << "7_12" << "13_18" << "19_24" << "25_30" << "31_36"); types.insert(8, QStringList() << "1_8" << "9_16" << "17_24" << "25_32" << "33_40" << "41_48" << "49_57" << "57_64"); @@ -49,6 +51,8 @@ void VideoBox::addMenu(QMenu *menu, int type) QString end = list.at(1); //对应菜单文本 + start = QString("%1").arg(start, 2, QChar('0')); + end = QString("%1").arg(end, 2, QChar('0')); QString text = QString("%1%2-%1%3").arg(actionFlag).arg(start).arg(end); if (flags.count() == 1) { text = name; @@ -79,6 +83,11 @@ void VideoBox::setWidgets(QWidgetList widgets) this->videoCount = widgets.count(); } +void VideoBox::setEnableOther(bool enableOther) +{ + this->enableOther = enableOther; +} + void VideoBox::setMenuFlag(const QString &menuFlag) { this->menuFlag = menuFlag; @@ -96,6 +105,11 @@ void VideoBox::setTypes(const QMap &types) void VideoBox::initMenu(QMenu *menu, const QList &enable) { + if (enableOther) { + addMenu(menu, 2); + addMenu(menu, 3); + } + //通过菜单是否可见设置每个菜单可见与否 if (enable.count() < 9) { return; @@ -135,6 +149,10 @@ void VideoBox::show_video(int type, int index) //根据不同的父菜单类型执行对应的函数 if (type == 1) { change_video_1(index); + } else if (type == 2) { + change_video_2(index); + } else if (type == 3) { + change_video_3(index); } else if (type == 4) { change_video_4(index); } else if (type == 6) { @@ -332,9 +350,35 @@ void VideoBox::change_video_1(int index) //首先隐藏所有通道 hide_video_all(); //添加通道到布局 - gridLayout->addWidget(widgets.at(index), 0, 0); + gridLayout->addWidget(widgets.at(0), 0, 0); //设置可见 - widgets.at(index)->setVisible(true); + widgets.at(0)->setVisible(true); +} + +void VideoBox::change_video_2(int index) +{ + //首先隐藏所有通道 + hide_video_all(); + //添加通道到布局 + gridLayout->addWidget(widgets.at(0), 0, 0); + gridLayout->addWidget(widgets.at(1), 0, 1); + //设置可见 + widgets.at(0)->setVisible(true); + widgets.at(1)->setVisible(true); +} + +void VideoBox::change_video_3(int index) +{ + //首先隐藏所有通道 + hide_video_all(); + //添加通道到布局 + gridLayout->addWidget(widgets.at(0), 0, 0, 1, 2); + gridLayout->addWidget(widgets.at(1), 1, 0); + gridLayout->addWidget(widgets.at(2), 1, 1); + //设置可见 + widgets.at(0)->setVisible(true); + widgets.at(1)->setVisible(true); + widgets.at(2)->setVisible(true); } void VideoBox::change_video_4(int index) diff --git a/video/videopanel/videobox.h b/video/videopanel/videobox.h index 6d6474c..ac65216 100644 --- a/video/videopanel/videobox.h +++ b/video/videopanel/videobox.h @@ -4,7 +4,7 @@ /** * 监控画面切换控件 作者:feiyangqingyun(QQ:517216493) 2021-11-08 * 1. 将所有通道切换处理全部集中到一个类。 - * 2. 通用整数倍数布局切换函数,可方便拓展到100、255通道等。 + * 2. 通用整数倍数布局切换函数,可方便拓展到100/255通道等。 * 3. 通用异形布局切换函数,可以参考进行自定义异形布局。 * 4. 通道布局切换发出信号通知。 * 5. 可控每种布局切换菜单是否启用。 @@ -43,6 +43,9 @@ private: //当前画面类型 QString videoType; + //启用其他通道画面(2画面/3画面) + bool enableOther; + //主菜单子菜单文字标识 QString menuFlag; QString actionFlag; @@ -59,6 +62,9 @@ public Q_SLOTS: //设置视频控件集合 void setWidgets(QWidgetList widgets); + //设置启用其他通道画面 + void setEnableOther(bool enableOther); + //设置主菜单子菜单文字标识 void setMenuFlag(const QString &menuFlag); void setActionFlag(const QString &actionFlag); @@ -88,6 +94,8 @@ public Q_SLOTS: //具体通道切换函数 void change_video_1(int index); + void change_video_2(int index); + void change_video_3(int index); void change_video_4(int index); void change_video_6(int index); void change_video_8(int index);