更新文档

master
feiyangqingyun 2023-12-06 19:15:52 +08:00
parent 797d0af704
commit 4e640b2fc1
35 changed files with 290 additions and 207 deletions

View File

@ -230,7 +230,7 @@ void Battery::setValue(double value)
} }
this->value = value; this->value = value;
emit valueChanged(value); Q_EMIT valueChanged(value);
if (animation) { if (animation) {
timer->stop(); timer->stop();
timer->start(); timer->start();

View File

@ -214,8 +214,8 @@ void CpuMemoryLabel::setData()
this->setText(msg); this->setText(msg);
} }
emit textChanged(msg); Q_EMIT textChanged(msg);
emit valueChanged(cpuPercent, memoryPercent, memoryAll, memoryUse, memoryFree); Q_EMIT valueChanged(cpuPercent, memoryPercent, memoryAll, memoryUse, memoryFree);
} }
QSize CpuMemoryLabel::sizeHint() const QSize CpuMemoryLabel::sizeHint() const

View File

@ -94,7 +94,7 @@ bool DeviceButton::eventFilter(QObject *watched, QEvent *event)
if (mouseEvent->button() == Qt::LeftButton) { if (mouseEvent->button() == Qt::LeftButton) {
lastPoint = mouseEvent->pos(); lastPoint = mouseEvent->pos();
isPressed = true; isPressed = true;
emit clicked(); Q_EMIT clicked();
return true; return true;
} }
} else if (event->type() == QEvent::MouseMove) { } else if (event->type() == QEvent::MouseMove) {
@ -108,7 +108,7 @@ bool DeviceButton::eventFilter(QObject *watched, QEvent *event)
} else if (event->type() == QEvent::MouseButtonRelease) { } else if (event->type() == QEvent::MouseButtonRelease) {
isPressed = false; isPressed = false;
} else if (event->type() == QEvent::MouseButtonDblClick) { } else if (event->type() == QEvent::MouseButtonDblClick) {
emit doubleClicked(); Q_EMIT doubleClicked();
} }
return QWidget::eventFilter(watched, event); return QWidget::eventFilter(watched, event);

View File

@ -72,17 +72,17 @@ void DeviceSizeTable::readData()
} else if (result.startsWith("/dev/mmcblk1p")) { } else if (result.startsWith("/dev/mmcblk1p")) {
checkSize(result, "SD卡"); checkSize(result, "SD卡");
QStringList list = result.split(" "); QStringList list = result.split(" ");
emit sdcardReceive(list.at(0)); Q_EMIT sdcardReceive(list.at(0));
} else if (result.startsWith("/dev/sd")) { } else if (result.startsWith("/dev/sd")) {
checkSize(result, "U盘"); checkSize(result, "U盘");
QStringList list = result.split(" "); QStringList list = result.split(" ");
emit udiskReceive(list.at(0)); Q_EMIT udiskReceive(list.at(0));
} }
#else #else
if (result.startsWith("/dev/sd")) { if (result.startsWith("/dev/sd")) {
checkSize(result, ""); checkSize(result, "");
QStringList list = result.split(" "); QStringList list = result.split(" ");
emit udiskReceive(list.at(0)); Q_EMIT udiskReceive(list.at(0));
} }
#endif #endif
} }

View File

@ -18,7 +18,7 @@ void ImageSwitch::mousePressEvent(QMouseEvent *)
{ {
imgFile = isChecked ? imgOffFile : imgOnFile; imgFile = isChecked ? imgOffFile : imgOnFile;
isChecked = !isChecked; isChecked = !isChecked;
emit checkedChanged(isChecked); Q_EMIT checkedChanged(isChecked);
this->update(); this->update();
} }

View File

@ -52,7 +52,7 @@ bool LightButton::eventFilter(QObject *watched, QEvent *event)
} }
} else if (mouseEvent->type() == QEvent::MouseButtonRelease && pressed) { } else if (mouseEvent->type() == QEvent::MouseButtonRelease && pressed) {
pressed = false; pressed = false;
emit clicked(); Q_EMIT clicked();
} }
return QWidget::eventFilter(watched, event); return QWidget::eventFilter(watched, event);

View File

@ -196,7 +196,7 @@ void SaveLog::save(const QString &content)
{ {
//如果重定向输出到网络则通过网络发出去,否则输出到日志文件 //如果重定向输出到网络则通过网络发出去,否则输出到日志文件
if (toNet) { if (toNet) {
emit send(content); Q_EMIT send(content);
} else { } else {
//目录不存在则先新建目录 //目录不存在则先新建目录
QDir dir(path); QDir dir(path);

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 114 KiB

View File

@ -101,7 +101,7 @@ void NtpClient::readData()
//有些时候返回的数据可能有误或者解析不正确,导致填充的时间不正确 //有些时候返回的数据可能有误或者解析不正确,导致填充的时间不正确
if (dateTime.isValid()) { if (dateTime.isValid()) {
emit receiveTime(dateTime); Q_EMIT receiveTime(dateTime);
} }
} }

View File

@ -17,20 +17,25 @@ VideoBox::VideoBox(QObject *parent) : QObject(parent)
actionFlag = "通道"; actionFlag = "通道";
//通过这里设置好数据下面只需要循环添加和判断就行(灵活性大大增强/只需要这里改动下就行) //通过这里设置好数据下面只需要循环添加和判断就行(灵活性大大增强/只需要这里改动下就行)
types.insert(2, QStringList() << "1_2"); //1_2表示通道1-通道2/前面是通道开始的索引/后面是通道结束的索引
types.insert(3, QStringList() << "1_3"); //1_2x4表示通道1开始2x4行列布局画面(相当于通道1-8按照2行4列排列)
types.insert(4, QStringList() << "1_4" << "5_8" << "9_12" << "13_16" << "17_20" << "21_24" << "25_28" << "29_32" << "33_36"); //9_2x4表示通道9开始2x4行列布局画面(相当于通道9-16按照2行4列排列)
types.insert(6, QStringList() << "1_6" << "7_12" << "13_18" << "19_24" << "25_30" << "31_36"); types.insert("2", QStringList() << "1_2");
types.insert(8, QStringList() << "1_8" << "9_16" << "17_24" << "25_32" << "33_40" << "41_48" << "49_57" << "57_64"); types.insert("3", QStringList() << "1_3");
types.insert(9, QStringList() << "1_9" << "9_17" << "18_26" << "27_35" << "36_42" << "43_50" << "51_59"); //按照行列数生成的可以自行添加其他布局
types.insert(13, QStringList() << "1_13" << "14_26" << "27_39" << "40_52" << "52_64"); types.insert("x", QStringList() << "1_4x1" << "1_2x4" << "9_2x4" << "1_4x2" << "9_4x2" << "1_2x5" << "10_2x5" << "1_5x2" << "1_6x2" << "1_7x2");
types.insert(16, QStringList() << "1_16" << "17_32" << "33_48" << "49_64"); types.insert("4", QStringList() << "1_4" << "5_8" << "9_12" << "13_16" << "17_20" << "21_24" << "25_28" << "29_32" << "33_36");
types.insert(25, QStringList() << "1_25"); types.insert("6", QStringList() << "1_6" << "7_12" << "13_18" << "19_24" << "25_30" << "31_36");
types.insert(36, QStringList() << "1_36"); types.insert("8", QStringList() << "1_8" << "9_16" << "17_24" << "25_32" << "33_40" << "41_48" << "49_57" << "57_64");
types.insert(64, QStringList() << "1_64"); types.insert("9", QStringList() << "1_9" << "9_17" << "18_26" << "27_35" << "36_42" << "43_50" << "51_59");
types.insert("13", QStringList() << "1_13" << "14_26" << "27_39" << "40_52" << "52_64");
types.insert("16", QStringList() << "1_16" << "17_32" << "33_48" << "49_64");
types.insert("25", QStringList() << "1_25");
types.insert("36", QStringList() << "1_36");
types.insert("64", QStringList() << "1_64");
} }
void VideoBox::addMenu(QMenu *menu, int type) void VideoBox::addMenu(QMenu *menu, const QString &type)
{ {
//父菜单文字 //父菜单文字
QString name = QString("切换到%1%2").arg(type).arg(menuFlag); QString name = QString("切换到%1%2").arg(type).arg(menuFlag);
@ -46,14 +51,23 @@ void VideoBox::addMenu(QMenu *menu, int type)
} }
foreach (QString flag, flags) { foreach (QString flag, flags) {
QString text;
QStringList list = flag.split("_"); QStringList list = flag.split("_");
QString start = list.at(0); QString start = list.at(0);
QString end = list.at(1); QString end = list.at(1);
start = QString("%1").arg(start, 2, QChar('0'));
//对应菜单文本 //对应菜单文本
start = QString("%1").arg(start, 2, QChar('0')); if (type == "x") {
end = QString("%1").arg(end, 2, QChar('0')); list = end.split("x");
QString text = QString("%1%2-%1%3").arg(actionFlag).arg(start).arg(end); text = QString("%1 x %2").arg(list.at(0)).arg(list.at(1));
text = QString("%1%2 (%3)").arg(actionFlag).arg(start).arg(text);
} else {
end = QString("%1").arg(end, 2, QChar('0'));
text = QString("%1%2-%1%3").arg(actionFlag).arg(start).arg(end);
}
//只有一个节点则子菜单文字=主菜单文字
if (flags.count() == 1) { if (flags.count() == 1) {
text = name; text = name;
} }
@ -67,14 +81,19 @@ void VideoBox::addMenu(QMenu *menu, int type)
} }
} }
QString VideoBox::getVideoType() const
{
return this->videoType;
}
void VideoBox::setVideoType(const QString &videoType) void VideoBox::setVideoType(const QString &videoType)
{ {
this->videoType = videoType; this->videoType = videoType;
} }
void VideoBox::setLayout(QGridLayout *gridLayout) QWidgetList VideoBox::getWidgets() const
{ {
this->gridLayout = gridLayout; return this->widgets;
} }
void VideoBox::setWidgets(QWidgetList widgets) void VideoBox::setWidgets(QWidgetList widgets)
@ -83,6 +102,11 @@ void VideoBox::setWidgets(QWidgetList widgets)
this->videoCount = widgets.count(); this->videoCount = widgets.count();
} }
void VideoBox::setLayout(QGridLayout *gridLayout)
{
this->gridLayout = gridLayout;
}
void VideoBox::setEnableOther(bool enableOther) void VideoBox::setEnableOther(bool enableOther)
{ {
this->enableOther = enableOther; this->enableOther = enableOther;
@ -98,7 +122,7 @@ void VideoBox::setActionFlag(const QString &actionFlag)
this->actionFlag = actionFlag; this->actionFlag = actionFlag;
} }
void VideoBox::setTypes(const QMap<int, QStringList> &types) void VideoBox::setTypes(const QMap<QString, QStringList> &types)
{ {
this->types = types; this->types = types;
} }
@ -106,8 +130,9 @@ 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 (enableOther) { if (enableOther) {
addMenu(menu, 2); addMenu(menu, "2");
addMenu(menu, 3); addMenu(menu, "3");
addMenu(menu, "x");
} }
//通过菜单是否可见设置每个菜单可见与否 //通过菜单是否可见设置每个菜单可见与否
@ -116,38 +141,45 @@ void VideoBox::initMenu(QMenu *menu, const QList<bool> &enable)
} }
if (enable.at(0)) { if (enable.at(0)) {
addMenu(menu, 4); addMenu(menu, "4");
} }
if (enable.at(1)) { if (enable.at(1)) {
addMenu(menu, 6); addMenu(menu, "6");
} }
if (enable.at(2)) { if (enable.at(2)) {
addMenu(menu, 8); addMenu(menu, "8");
} }
if (enable.at(3)) { if (enable.at(3)) {
addMenu(menu, 9); addMenu(menu, "9");
} }
if (enable.at(4)) { if (enable.at(4)) {
addMenu(menu, 13); addMenu(menu, "13");
} }
if (enable.at(5)) { if (enable.at(5)) {
addMenu(menu, 16); addMenu(menu, "16");
} }
if (enable.at(6)) { if (enable.at(6)) {
addMenu(menu, 25); addMenu(menu, "25");
} }
if (enable.at(7)) { if (enable.at(7)) {
addMenu(menu, 36); addMenu(menu, "36");
} }
if (enable.at(8)) { if (enable.at(8)) {
addMenu(menu, 64); addMenu(menu, "64");
} }
} }
void VideoBox::show_video(int type, int index) void VideoBox::show_video(int type, int index)
{ {
//根据不同的父菜单类型执行对应的函数 //根据不同的父菜单类型执行对应的函数
if (type == 1) { if (type == 0) {
//取出行列
QString text = videoType.split("_").last();
QStringList list = text.split("x");
int row = list.at(0).toInt();
int column = list.at(1).toInt();
change_video_normal(index, row, column);
} else if (type == 1) {
change_video_1(index); change_video_1(index);
} else if (type == 2) { } else if (type == 2) {
change_video_2(index); change_video_2(index);
@ -173,7 +205,7 @@ void VideoBox::show_video(int type, int index)
change_video_64(index); change_video_64(index);
} }
emit changeVideo(type, videoType, false); Q_EMIT changeVideo(type, videoType, false);
} }
void VideoBox::show_video() void VideoBox::show_video()
@ -199,14 +231,14 @@ void VideoBox::show_video_all()
if (videoType.startsWith("0_")) { if (videoType.startsWith("0_")) {
int index = videoType.split("_").last().toInt() - 1; int index = videoType.split("_").last().toInt() - 1;
change_video_1(index); change_video_1(index);
emit changeVideo(type, videoType, true); Q_EMIT changeVideo(type, videoType, true);
} else { } else {
int index = videoType.split("_").first().toInt() - 1; int index = videoType.split("_").first().toInt() - 1;
QMap<int, QStringList>::iterator iter = types.begin(); QMap<QString, QStringList>::iterator iter = types.begin();
while (iter != types.end()) { while (iter != types.end()) {
QStringList flags = iter.value(); QStringList flags = iter.value();
if (flags.contains(videoType)) { if (flags.contains(videoType)) {
type = iter.key(); type = iter.key().toInt();
show_video(type, index); show_video(type, index);
break; break;
} }
@ -223,31 +255,34 @@ void VideoBox::hide_video_all()
} }
} }
void VideoBox::change_video_normal(int index, int flag) //行列数一致的比如 2*2 3*3 4*4 5*5 等可以直接套用通用的公式
//按照这个函数还可以非常容易的拓展出 10*10 16*16=256 通道界面
void VideoBox::change_video_normal(int index, int row, int column)
{ {
int size = 0;
int rowCount = 0;
int columnCount = 0;
//首先隐藏所有通道 //首先隐藏所有通道
hide_video_all(); hide_video_all();
int size = 0;
int row = 0;
int column = 0;
//行列数一致的比如 2*2 3*4 4*4 5*5 等可以直接套用通用的公式 //按照指定的行列数逐个添加
//按照这个函数还可以非常容易的拓展出 10*10 16*16=256 通道界面
for (int i = 0; i < videoCount; ++i) { for (int i = 0; i < videoCount; ++i) {
if (i >= index) { if (i >= index) {
//添加到对应布局并设置可见 //添加到对应布局并设置可见
gridLayout->addWidget(widgets.at(i), row, column); gridLayout->addWidget(widgets.at(i), rowCount, columnCount);
widgets.at(i)->setVisible(true); widgets.at(i)->setVisible(true);
size++; size++;
column++; columnCount++;
if (column == flag) { if (columnCount == column) {
row++; rowCount++;
column = 0; columnCount = 0;
} }
} }
if (size == (flag * flag)) { //到了规定的数量则不用继续
if (size == (row * column)) {
break; break;
} }
} }
@ -270,6 +305,14 @@ void VideoBox::change_video_custom(int index, int type)
} }
} }
void VideoBox::change_video_visible(int start, int end)
{
//设置通道控件可见
for (int i = start; i <= end; ++i) {
widgets.at(i)->setVisible(true);
}
}
void VideoBox::change_video_6(const QList<int> &indexs) void VideoBox::change_video_6(const QList<int> &indexs)
{ {
//过滤防止索引越界 //过滤防止索引越界
@ -287,9 +330,7 @@ void VideoBox::change_video_6(const QList<int> &indexs)
gridLayout->addWidget(widgets.at(indexs.at(4)), 2, 1, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(4)), 2, 1, 1, 1);
gridLayout->addWidget(widgets.at(indexs.at(5)), 2, 0, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(5)), 2, 0, 1, 1);
//设置通道控件可见 //设置通道控件可见
for (int i = indexs.first(); i <= indexs.last(); ++i) { change_video_visible(indexs.first(), indexs.last());
widgets.at(i)->setVisible(true);
}
} }
void VideoBox::change_video_8(const QList<int> &indexs) void VideoBox::change_video_8(const QList<int> &indexs)
@ -311,9 +352,7 @@ void VideoBox::change_video_8(const QList<int> &indexs)
gridLayout->addWidget(widgets.at(indexs.at(6)), 3, 1, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(6)), 3, 1, 1, 1);
gridLayout->addWidget(widgets.at(indexs.at(7)), 3, 0, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(7)), 3, 0, 1, 1);
//设置通道控件可见 //设置通道控件可见
for (int i = indexs.first(); i <= indexs.last(); ++i) { change_video_visible(indexs.first(), indexs.last());
widgets.at(i)->setVisible(true);
}
} }
void VideoBox::change_video_13(const QList<int> &indexs) void VideoBox::change_video_13(const QList<int> &indexs)
@ -340,9 +379,7 @@ void VideoBox::change_video_13(const QList<int> &indexs)
gridLayout->addWidget(widgets.at(indexs.at(11)), 3, 2, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(11)), 3, 2, 1, 1);
gridLayout->addWidget(widgets.at(indexs.at(12)), 3, 3, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(12)), 3, 3, 1, 1);
//设置通道控件可见 //设置通道控件可见
for (int i = indexs.first(); i <= indexs.last(); ++i) { change_video_visible(indexs.first(), indexs.last());
widgets.at(i)->setVisible(true);
}
} }
void VideoBox::change_video_1(int index) void VideoBox::change_video_1(int index)
@ -351,7 +388,7 @@ void VideoBox::change_video_1(int index)
hide_video_all(); hide_video_all();
//添加通道到布局 //添加通道到布局
gridLayout->addWidget(widgets.at(index), 0, 0); gridLayout->addWidget(widgets.at(index), 0, 0);
//设置可见 //设置通道控件可见
widgets.at(index)->setVisible(true); widgets.at(index)->setVisible(true);
} }
@ -360,11 +397,10 @@ void VideoBox::change_video_2(int index)
//首先隐藏所有通道 //首先隐藏所有通道
hide_video_all(); hide_video_all();
//添加通道到布局 //添加通道到布局
gridLayout->addWidget(widgets.at(0), 0, 0); gridLayout->addWidget(widgets.at(index), 0, 0);
gridLayout->addWidget(widgets.at(1), 0, 1); gridLayout->addWidget(widgets.at(index + 1), 0, 1);
//设置可见 //设置通道控件可见
widgets.at(0)->setVisible(true); change_video_visible(index, index + 1);
widgets.at(1)->setVisible(true);
} }
void VideoBox::change_video_3(int index) void VideoBox::change_video_3(int index)
@ -372,18 +408,16 @@ void VideoBox::change_video_3(int index)
//首先隐藏所有通道 //首先隐藏所有通道
hide_video_all(); hide_video_all();
//添加通道到布局 //添加通道到布局
gridLayout->addWidget(widgets.at(0), 0, 0, 1, 2); gridLayout->addWidget(widgets.at(index), 0, 0, 1, 2);
gridLayout->addWidget(widgets.at(1), 1, 0); gridLayout->addWidget(widgets.at(index + 1), 1, 0);
gridLayout->addWidget(widgets.at(2), 1, 1); gridLayout->addWidget(widgets.at(index + 2), 1, 1);
//设置可见 //设置通道控件可见
widgets.at(0)->setVisible(true); change_video_visible(index, index + 2);
widgets.at(1)->setVisible(true);
widgets.at(2)->setVisible(true);
} }
void VideoBox::change_video_4(int index) void VideoBox::change_video_4(int index)
{ {
change_video_normal(index, 2); change_video_normal(index, 2, 2);
} }
void VideoBox::change_video_6(int index) void VideoBox::change_video_6(int index)
@ -398,7 +432,7 @@ void VideoBox::change_video_8(int index)
void VideoBox::change_video_9(int index) void VideoBox::change_video_9(int index)
{ {
change_video_normal(index, 3); change_video_normal(index, 3, 3);
} }
void VideoBox::change_video_13(int index) void VideoBox::change_video_13(int index)
@ -408,20 +442,20 @@ void VideoBox::change_video_13(int index)
void VideoBox::change_video_16(int index) void VideoBox::change_video_16(int index)
{ {
change_video_normal(index, 4); change_video_normal(index, 4, 4);
} }
void VideoBox::change_video_25(int index) void VideoBox::change_video_25(int index)
{ {
change_video_normal(index, 5); change_video_normal(index, 5, 5);
} }
void VideoBox::change_video_36(int index) void VideoBox::change_video_36(int index)
{ {
change_video_normal(index, 6); change_video_normal(index, 6, 6);
} }
void VideoBox::change_video_64(int index) void VideoBox::change_video_64(int index)
{ {
change_video_normal(index, 8); change_video_normal(index, 8, 8);
} }

View File

@ -51,17 +51,20 @@ private:
QString actionFlag; QString actionFlag;
//布局方案标识集合 //布局方案标识集合
QMap<int, QStringList> types; QMap<QString, QStringList> types;
void addMenu(QMenu *menu, int type); void addMenu(QMenu *menu, const QString &type);
public Q_SLOTS: public Q_SLOTS:
//设置当前画面类型 //获取和设置当前画面类型
QString getVideoType() const;
void setVideoType(const QString &videoType); void setVideoType(const QString &videoType);
//设置表格布局
void setLayout(QGridLayout *gridLayout); //获取和设置视频控件集合
//设置视频控件集合 QWidgetList getWidgets() const;
void setWidgets(QWidgetList widgets); void setWidgets(QWidgetList widgets);
//设置表格布局
void setLayout(QGridLayout *gridLayout);
//设置启用其他通道画面 //设置启用其他通道画面
void setEnableOther(bool enableOther); void setEnableOther(bool enableOther);
@ -69,8 +72,8 @@ public Q_SLOTS:
void setMenuFlag(const QString &menuFlag); void setMenuFlag(const QString &menuFlag);
void setActionFlag(const QString &actionFlag); void setActionFlag(const QString &actionFlag);
//设置菜单类型集合 //设置菜单类型集合
void setTypes(const QMap<int, QStringList> &types); void setTypes(const QMap<QString, QStringList> &types);
//初始化菜单 //初始化菜单
void initMenu(QMenu *menu, const QList<bool> &enable); void initMenu(QMenu *menu, const QList<bool> &enable);
@ -84,9 +87,12 @@ public Q_SLOTS:
void hide_video_all(); void hide_video_all();
//常规及异形通道布局 //常规及异形通道布局
void change_video_normal(int index, int flag); void change_video_normal(int index, int row, int column);
void change_video_custom(int index, int type); void change_video_custom(int index, int type);
//设置可见
void change_video_visible(int start, int end);
//异形布局 //异形布局
void change_video_6(const QList<int> &indexs); void change_video_6(const QList<int> &indexs);
void change_video_8(const QList<int> &indexs); void change_video_8(const QList<int> &indexs);

View File

@ -17,20 +17,25 @@ VideoBox::VideoBox(QObject *parent) : QObject(parent)
actionFlag = "通道"; actionFlag = "通道";
//通过这里设置好数据下面只需要循环添加和判断就行(灵活性大大增强/只需要这里改动下就行) //通过这里设置好数据下面只需要循环添加和判断就行(灵活性大大增强/只需要这里改动下就行)
types.insert(2, QStringList() << "1_2"); //1_2表示通道1-通道2/前面是通道开始的索引/后面是通道结束的索引
types.insert(3, QStringList() << "1_3"); //1_2x4表示通道1开始2x4行列布局画面(相当于通道1-8按照2行4列排列)
types.insert(4, QStringList() << "1_4" << "5_8" << "9_12" << "13_16" << "17_20" << "21_24" << "25_28" << "29_32" << "33_36"); //9_2x4表示通道9开始2x4行列布局画面(相当于通道9-16按照2行4列排列)
types.insert(6, QStringList() << "1_6" << "7_12" << "13_18" << "19_24" << "25_30" << "31_36"); types.insert("2", QStringList() << "1_2");
types.insert(8, QStringList() << "1_8" << "9_16" << "17_24" << "25_32" << "33_40" << "41_48" << "49_57" << "57_64"); types.insert("3", QStringList() << "1_3");
types.insert(9, QStringList() << "1_9" << "9_17" << "18_26" << "27_35" << "36_42" << "43_50" << "51_59"); //按照行列数生成的可以自行添加其他布局
types.insert(13, QStringList() << "1_13" << "14_26" << "27_39" << "40_52" << "52_64"); types.insert("x", QStringList() << "1_4x1" << "1_2x4" << "9_2x4" << "1_4x2" << "9_4x2" << "1_2x5" << "10_2x5" << "1_5x2" << "1_6x2" << "1_7x2");
types.insert(16, QStringList() << "1_16" << "17_32" << "33_48" << "49_64"); types.insert("4", QStringList() << "1_4" << "5_8" << "9_12" << "13_16" << "17_20" << "21_24" << "25_28" << "29_32" << "33_36");
types.insert(25, QStringList() << "1_25"); types.insert("6", QStringList() << "1_6" << "7_12" << "13_18" << "19_24" << "25_30" << "31_36");
types.insert(36, QStringList() << "1_36"); types.insert("8", QStringList() << "1_8" << "9_16" << "17_24" << "25_32" << "33_40" << "41_48" << "49_57" << "57_64");
types.insert(64, QStringList() << "1_64"); types.insert("9", QStringList() << "1_9" << "9_17" << "18_26" << "27_35" << "36_42" << "43_50" << "51_59");
types.insert("13", QStringList() << "1_13" << "14_26" << "27_39" << "40_52" << "52_64");
types.insert("16", QStringList() << "1_16" << "17_32" << "33_48" << "49_64");
types.insert("25", QStringList() << "1_25");
types.insert("36", QStringList() << "1_36");
types.insert("64", QStringList() << "1_64");
} }
void VideoBox::addMenu(QMenu *menu, int type) void VideoBox::addMenu(QMenu *menu, const QString &type)
{ {
//父菜单文字 //父菜单文字
QString name = QString("切换到%1%2").arg(type).arg(menuFlag); QString name = QString("切换到%1%2").arg(type).arg(menuFlag);
@ -46,14 +51,23 @@ void VideoBox::addMenu(QMenu *menu, int type)
} }
foreach (QString flag, flags) { foreach (QString flag, flags) {
QString text;
QStringList list = flag.split("_"); QStringList list = flag.split("_");
QString start = list.at(0); QString start = list.at(0);
QString end = list.at(1); QString end = list.at(1);
start = QString("%1").arg(start, 2, QChar('0'));
//对应菜单文本 //对应菜单文本
start = QString("%1").arg(start, 2, QChar('0')); if (type == "x") {
end = QString("%1").arg(end, 2, QChar('0')); list = end.split("x");
QString text = QString("%1%2-%1%3").arg(actionFlag).arg(start).arg(end); text = QString("%1 x %2").arg(list.at(0)).arg(list.at(1));
text = QString("%1%2 (%3)").arg(actionFlag).arg(start).arg(text);
} else {
end = QString("%1").arg(end, 2, QChar('0'));
text = QString("%1%2-%1%3").arg(actionFlag).arg(start).arg(end);
}
//只有一个节点则子菜单文字=主菜单文字
if (flags.count() == 1) { if (flags.count() == 1) {
text = name; text = name;
} }
@ -67,14 +81,19 @@ void VideoBox::addMenu(QMenu *menu, int type)
} }
} }
QString VideoBox::getVideoType() const
{
return this->videoType;
}
void VideoBox::setVideoType(const QString &videoType) void VideoBox::setVideoType(const QString &videoType)
{ {
this->videoType = videoType; this->videoType = videoType;
} }
void VideoBox::setLayout(QGridLayout *gridLayout) QWidgetList VideoBox::getWidgets() const
{ {
this->gridLayout = gridLayout; return this->widgets;
} }
void VideoBox::setWidgets(QWidgetList widgets) void VideoBox::setWidgets(QWidgetList widgets)
@ -83,6 +102,11 @@ void VideoBox::setWidgets(QWidgetList widgets)
this->videoCount = widgets.count(); this->videoCount = widgets.count();
} }
void VideoBox::setLayout(QGridLayout *gridLayout)
{
this->gridLayout = gridLayout;
}
void VideoBox::setEnableOther(bool enableOther) void VideoBox::setEnableOther(bool enableOther)
{ {
this->enableOther = enableOther; this->enableOther = enableOther;
@ -98,7 +122,7 @@ void VideoBox::setActionFlag(const QString &actionFlag)
this->actionFlag = actionFlag; this->actionFlag = actionFlag;
} }
void VideoBox::setTypes(const QMap<int, QStringList> &types) void VideoBox::setTypes(const QMap<QString, QStringList> &types)
{ {
this->types = types; this->types = types;
} }
@ -106,8 +130,9 @@ 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 (enableOther) { if (enableOther) {
addMenu(menu, 2); addMenu(menu, "2");
addMenu(menu, 3); addMenu(menu, "3");
addMenu(menu, "x");
} }
//通过菜单是否可见设置每个菜单可见与否 //通过菜单是否可见设置每个菜单可见与否
@ -116,38 +141,45 @@ void VideoBox::initMenu(QMenu *menu, const QList<bool> &enable)
} }
if (enable.at(0)) { if (enable.at(0)) {
addMenu(menu, 4); addMenu(menu, "4");
} }
if (enable.at(1)) { if (enable.at(1)) {
addMenu(menu, 6); addMenu(menu, "6");
} }
if (enable.at(2)) { if (enable.at(2)) {
addMenu(menu, 8); addMenu(menu, "8");
} }
if (enable.at(3)) { if (enable.at(3)) {
addMenu(menu, 9); addMenu(menu, "9");
} }
if (enable.at(4)) { if (enable.at(4)) {
addMenu(menu, 13); addMenu(menu, "13");
} }
if (enable.at(5)) { if (enable.at(5)) {
addMenu(menu, 16); addMenu(menu, "16");
} }
if (enable.at(6)) { if (enable.at(6)) {
addMenu(menu, 25); addMenu(menu, "25");
} }
if (enable.at(7)) { if (enable.at(7)) {
addMenu(menu, 36); addMenu(menu, "36");
} }
if (enable.at(8)) { if (enable.at(8)) {
addMenu(menu, 64); addMenu(menu, "64");
} }
} }
void VideoBox::show_video(int type, int index) void VideoBox::show_video(int type, int index)
{ {
//根据不同的父菜单类型执行对应的函数 //根据不同的父菜单类型执行对应的函数
if (type == 1) { if (type == 0) {
//取出行列
QString text = videoType.split("_").last();
QStringList list = text.split("x");
int row = list.at(0).toInt();
int column = list.at(1).toInt();
change_video_normal(index, row, column);
} else if (type == 1) {
change_video_1(index); change_video_1(index);
} else if (type == 2) { } else if (type == 2) {
change_video_2(index); change_video_2(index);
@ -173,7 +205,7 @@ void VideoBox::show_video(int type, int index)
change_video_64(index); change_video_64(index);
} }
emit changeVideo(type, videoType, false); Q_EMIT changeVideo(type, videoType, false);
} }
void VideoBox::show_video() void VideoBox::show_video()
@ -199,14 +231,14 @@ void VideoBox::show_video_all()
if (videoType.startsWith("0_")) { if (videoType.startsWith("0_")) {
int index = videoType.split("_").last().toInt() - 1; int index = videoType.split("_").last().toInt() - 1;
change_video_1(index); change_video_1(index);
emit changeVideo(type, videoType, true); Q_EMIT changeVideo(type, videoType, true);
} else { } else {
int index = videoType.split("_").first().toInt() - 1; int index = videoType.split("_").first().toInt() - 1;
QMap<int, QStringList>::iterator iter = types.begin(); QMap<QString, QStringList>::iterator iter = types.begin();
while (iter != types.end()) { while (iter != types.end()) {
QStringList flags = iter.value(); QStringList flags = iter.value();
if (flags.contains(videoType)) { if (flags.contains(videoType)) {
type = iter.key(); type = iter.key().toInt();
show_video(type, index); show_video(type, index);
break; break;
} }
@ -223,31 +255,34 @@ void VideoBox::hide_video_all()
} }
} }
void VideoBox::change_video_normal(int index, int flag) //行列数一致的比如 2*2 3*3 4*4 5*5 等可以直接套用通用的公式
//按照这个函数还可以非常容易的拓展出 10*10 16*16=256 通道界面
void VideoBox::change_video_normal(int index, int row, int column)
{ {
int size = 0;
int rowCount = 0;
int columnCount = 0;
//首先隐藏所有通道 //首先隐藏所有通道
hide_video_all(); hide_video_all();
int size = 0;
int row = 0;
int column = 0;
//行列数一致的比如 2*2 3*4 4*4 5*5 等可以直接套用通用的公式 //按照指定的行列数逐个添加
//按照这个函数还可以非常容易的拓展出 10*10 16*16=256 通道界面
for (int i = 0; i < videoCount; ++i) { for (int i = 0; i < videoCount; ++i) {
if (i >= index) { if (i >= index) {
//添加到对应布局并设置可见 //添加到对应布局并设置可见
gridLayout->addWidget(widgets.at(i), row, column); gridLayout->addWidget(widgets.at(i), rowCount, columnCount);
widgets.at(i)->setVisible(true); widgets.at(i)->setVisible(true);
size++; size++;
column++; columnCount++;
if (column == flag) { if (columnCount == column) {
row++; rowCount++;
column = 0; columnCount = 0;
} }
} }
if (size == (flag * flag)) { //到了规定的数量则不用继续
if (size == (row * column)) {
break; break;
} }
} }
@ -270,6 +305,14 @@ void VideoBox::change_video_custom(int index, int type)
} }
} }
void VideoBox::change_video_visible(int start, int end)
{
//设置通道控件可见
for (int i = start; i <= end; ++i) {
widgets.at(i)->setVisible(true);
}
}
void VideoBox::change_video_6(const QList<int> &indexs) void VideoBox::change_video_6(const QList<int> &indexs)
{ {
//过滤防止索引越界 //过滤防止索引越界
@ -287,9 +330,7 @@ void VideoBox::change_video_6(const QList<int> &indexs)
gridLayout->addWidget(widgets.at(indexs.at(4)), 2, 1, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(4)), 2, 1, 1, 1);
gridLayout->addWidget(widgets.at(indexs.at(5)), 2, 0, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(5)), 2, 0, 1, 1);
//设置通道控件可见 //设置通道控件可见
for (int i = indexs.first(); i <= indexs.last(); ++i) { change_video_visible(indexs.first(), indexs.last());
widgets.at(i)->setVisible(true);
}
} }
void VideoBox::change_video_8(const QList<int> &indexs) void VideoBox::change_video_8(const QList<int> &indexs)
@ -311,9 +352,7 @@ void VideoBox::change_video_8(const QList<int> &indexs)
gridLayout->addWidget(widgets.at(indexs.at(6)), 3, 1, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(6)), 3, 1, 1, 1);
gridLayout->addWidget(widgets.at(indexs.at(7)), 3, 0, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(7)), 3, 0, 1, 1);
//设置通道控件可见 //设置通道控件可见
for (int i = indexs.first(); i <= indexs.last(); ++i) { change_video_visible(indexs.first(), indexs.last());
widgets.at(i)->setVisible(true);
}
} }
void VideoBox::change_video_13(const QList<int> &indexs) void VideoBox::change_video_13(const QList<int> &indexs)
@ -340,9 +379,7 @@ void VideoBox::change_video_13(const QList<int> &indexs)
gridLayout->addWidget(widgets.at(indexs.at(11)), 3, 2, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(11)), 3, 2, 1, 1);
gridLayout->addWidget(widgets.at(indexs.at(12)), 3, 3, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(12)), 3, 3, 1, 1);
//设置通道控件可见 //设置通道控件可见
for (int i = indexs.first(); i <= indexs.last(); ++i) { change_video_visible(indexs.first(), indexs.last());
widgets.at(i)->setVisible(true);
}
} }
void VideoBox::change_video_1(int index) void VideoBox::change_video_1(int index)
@ -351,7 +388,7 @@ void VideoBox::change_video_1(int index)
hide_video_all(); hide_video_all();
//添加通道到布局 //添加通道到布局
gridLayout->addWidget(widgets.at(index), 0, 0); gridLayout->addWidget(widgets.at(index), 0, 0);
//设置可见 //设置通道控件可见
widgets.at(index)->setVisible(true); widgets.at(index)->setVisible(true);
} }
@ -360,11 +397,10 @@ void VideoBox::change_video_2(int index)
//首先隐藏所有通道 //首先隐藏所有通道
hide_video_all(); hide_video_all();
//添加通道到布局 //添加通道到布局
gridLayout->addWidget(widgets.at(0), 0, 0); gridLayout->addWidget(widgets.at(index), 0, 0);
gridLayout->addWidget(widgets.at(1), 0, 1); gridLayout->addWidget(widgets.at(index + 1), 0, 1);
//设置可见 //设置通道控件可见
widgets.at(0)->setVisible(true); change_video_visible(index, index + 1);
widgets.at(1)->setVisible(true);
} }
void VideoBox::change_video_3(int index) void VideoBox::change_video_3(int index)
@ -372,18 +408,16 @@ void VideoBox::change_video_3(int index)
//首先隐藏所有通道 //首先隐藏所有通道
hide_video_all(); hide_video_all();
//添加通道到布局 //添加通道到布局
gridLayout->addWidget(widgets.at(0), 0, 0, 1, 2); gridLayout->addWidget(widgets.at(index), 0, 0, 1, 2);
gridLayout->addWidget(widgets.at(1), 1, 0); gridLayout->addWidget(widgets.at(index + 1), 1, 0);
gridLayout->addWidget(widgets.at(2), 1, 1); gridLayout->addWidget(widgets.at(index + 2), 1, 1);
//设置可见 //设置通道控件可见
widgets.at(0)->setVisible(true); change_video_visible(index, index + 2);
widgets.at(1)->setVisible(true);
widgets.at(2)->setVisible(true);
} }
void VideoBox::change_video_4(int index) void VideoBox::change_video_4(int index)
{ {
change_video_normal(index, 2); change_video_normal(index, 2, 2);
} }
void VideoBox::change_video_6(int index) void VideoBox::change_video_6(int index)
@ -398,7 +432,7 @@ void VideoBox::change_video_8(int index)
void VideoBox::change_video_9(int index) void VideoBox::change_video_9(int index)
{ {
change_video_normal(index, 3); change_video_normal(index, 3, 3);
} }
void VideoBox::change_video_13(int index) void VideoBox::change_video_13(int index)
@ -408,20 +442,20 @@ void VideoBox::change_video_13(int index)
void VideoBox::change_video_16(int index) void VideoBox::change_video_16(int index)
{ {
change_video_normal(index, 4); change_video_normal(index, 4, 4);
} }
void VideoBox::change_video_25(int index) void VideoBox::change_video_25(int index)
{ {
change_video_normal(index, 5); change_video_normal(index, 5, 5);
} }
void VideoBox::change_video_36(int index) void VideoBox::change_video_36(int index)
{ {
change_video_normal(index, 6); change_video_normal(index, 6, 6);
} }
void VideoBox::change_video_64(int index) void VideoBox::change_video_64(int index)
{ {
change_video_normal(index, 8); change_video_normal(index, 8, 8);
} }

View File

@ -51,17 +51,20 @@ private:
QString actionFlag; QString actionFlag;
//布局方案标识集合 //布局方案标识集合
QMap<int, QStringList> types; QMap<QString, QStringList> types;
void addMenu(QMenu *menu, int type); void addMenu(QMenu *menu, const QString &type);
public Q_SLOTS: public Q_SLOTS:
//设置当前画面类型 //获取和设置当前画面类型
QString getVideoType() const;
void setVideoType(const QString &videoType); void setVideoType(const QString &videoType);
//设置表格布局
void setLayout(QGridLayout *gridLayout); //获取和设置视频控件集合
//设置视频控件集合 QWidgetList getWidgets() const;
void setWidgets(QWidgetList widgets); void setWidgets(QWidgetList widgets);
//设置表格布局
void setLayout(QGridLayout *gridLayout);
//设置启用其他通道画面 //设置启用其他通道画面
void setEnableOther(bool enableOther); void setEnableOther(bool enableOther);
@ -69,8 +72,8 @@ public Q_SLOTS:
void setMenuFlag(const QString &menuFlag); void setMenuFlag(const QString &menuFlag);
void setActionFlag(const QString &actionFlag); void setActionFlag(const QString &actionFlag);
//设置菜单类型集合 //设置菜单类型集合
void setTypes(const QMap<int, QStringList> &types); void setTypes(const QMap<QString, QStringList> &types);
//初始化菜单 //初始化菜单
void initMenu(QMenu *menu, const QList<bool> &enable); void initMenu(QMenu *menu, const QList<bool> &enable);
@ -84,9 +87,12 @@ public Q_SLOTS:
void hide_video_all(); void hide_video_all();
//常规及异形通道布局 //常规及异形通道布局
void change_video_normal(int index, int flag); void change_video_normal(int index, int row, int column);
void change_video_custom(int index, int type); void change_video_custom(int index, int type);
//设置可见
void change_video_visible(int start, int end);
//异形布局 //异形布局
void change_video_6(const QList<int> &indexs); void change_video_6(const QList<int> &indexs);
void change_video_8(const QList<int> &indexs); void change_video_8(const QList<int> &indexs);

View File

@ -124,10 +124,10 @@ void VideoPanel::initMenu()
void VideoPanel::full() void VideoPanel::full()
{ {
if (actionFull->text() == "切换全屏模式") { if (actionFull->text() == "切换全屏模式") {
emit fullScreen(true); Q_EMIT fullScreen(true);
actionFull->setText("切换正常模式"); actionFull->setText("切换正常模式");
} else { } else {
emit fullScreen(false); Q_EMIT fullScreen(false);
actionFull->setText("切换全屏模式"); actionFull->setText("切换全屏模式");
} }

View File

@ -58,9 +58,9 @@ private slots:
private slots: private slots:
void play_video_all(); void play_video_all();
void snapshot_video_one(); void snapshot_video_one();
void snapshot_video_all(); void snapshot_video_all();
signals: Q_SIGNALS:
//全屏切换信号 //全屏切换信号
void fullScreen(bool full); void fullScreen(bool full);
}; };

View File

@ -214,7 +214,7 @@ void VideoWindow::dropEvent(QDropEvent *event)
} }
if (!url.isEmpty()) { if (!url.isEmpty()) {
emit fileDrag(url); Q_EMIT fileDrag(url);
this->restart(url); this->restart(url);
} }
} }
@ -601,7 +601,7 @@ void VideoWindow::checkVideo()
void VideoWindow::btnClicked() void VideoWindow::btnClicked()
{ {
QPushButton *btn = (QPushButton *)sender(); QPushButton *btn = (QPushButton *)sender();
emit btnClicked(btn->objectName()); Q_EMIT btnClicked(btn->objectName());
} }
uint VideoWindow::getLength() uint VideoWindow::getLength()

View File

@ -219,7 +219,7 @@ private slots:
//处理按钮单击 //处理按钮单击
void btnClicked(); void btnClicked();
signals: Q_SIGNALS:
//播放成功 //播放成功
void receivePlayStart(); void receivePlayStart();
//播放失败 //播放失败
@ -241,7 +241,7 @@ signals:
//工具栏单击 //工具栏单击
void btnClicked(const QString &objName); void btnClicked(const QString &objName);
public slots: public Q_SLOTS:
//获取长度 //获取长度
uint getLength(); uint getLength();
//获取当前播放位置 //获取当前播放位置

View File

@ -67,7 +67,7 @@ void FramelessDialog::doWindowStateChange(QEvent *event)
} }
//发出最大化最小化等改变事件,以便界面上更改对应的信息比如右上角图标和文字 //发出最大化最小化等改变事件,以便界面上更改对应的信息比如右上角图标和文字
emit windowStateChange(!moveEnable); Q_EMIT windowStateChange(!moveEnable);
//解决mac系统上无边框最小化失效的bug //解决mac系统上无边框最小化失效的bug
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
@ -248,9 +248,9 @@ bool FramelessDialog::eventFilter(QObject *watched, QEvent *event)
//下面的 *result = HTCAPTION; 标志位也会自动识别双击标题栏 //下面的 *result = HTCAPTION; 标志位也会自动识别双击标题栏
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
if (event->type() == QEvent::MouseButtonDblClick) { if (event->type() == QEvent::MouseButtonDblClick) {
emit titleDblClick(); Q_EMIT titleDblClick();
} else if (event->type() == QEvent::NonClientAreaMouseButtonDblClick) { } else if (event->type() == QEvent::NonClientAreaMouseButtonDblClick) {
emit titleDblClick(); Q_EMIT titleDblClick();
} }
#endif #endif
} }

View File

@ -67,7 +67,7 @@ void FramelessMainWindow::doWindowStateChange(QEvent *event)
} }
//发出最大化最小化等改变事件,以便界面上更改对应的信息比如右上角图标和文字 //发出最大化最小化等改变事件,以便界面上更改对应的信息比如右上角图标和文字
emit windowStateChange(!moveEnable); Q_EMIT windowStateChange(!moveEnable);
//解决mac系统上无边框最小化失效的bug //解决mac系统上无边框最小化失效的bug
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
@ -248,9 +248,9 @@ bool FramelessMainWindow::eventFilter(QObject *watched, QEvent *event)
//下面的 *result = HTCAPTION; 标志位也会自动识别双击标题栏 //下面的 *result = HTCAPTION; 标志位也会自动识别双击标题栏
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
if (event->type() == QEvent::MouseButtonDblClick) { if (event->type() == QEvent::MouseButtonDblClick) {
emit titleDblClick(); Q_EMIT titleDblClick();
} else if (event->type() == QEvent::NonClientAreaMouseButtonDblClick) { } else if (event->type() == QEvent::NonClientAreaMouseButtonDblClick) {
emit titleDblClick(); Q_EMIT titleDblClick();
} }
#endif #endif
} }

View File

@ -67,7 +67,7 @@ void FramelessWidget::doWindowStateChange(QEvent *event)
} }
//发出最大化最小化等改变事件,以便界面上更改对应的信息比如右上角图标和文字 //发出最大化最小化等改变事件,以便界面上更改对应的信息比如右上角图标和文字
emit windowStateChange(!moveEnable); Q_EMIT windowStateChange(!moveEnable);
//解决mac系统上无边框最小化失效的bug //解决mac系统上无边框最小化失效的bug
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
@ -248,9 +248,9 @@ bool FramelessWidget::eventFilter(QObject *watched, QEvent *event)
//下面的 *result = HTCAPTION; 标志位也会自动识别双击标题栏 //下面的 *result = HTCAPTION; 标志位也会自动识别双击标题栏
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
if (event->type() == QEvent::MouseButtonDblClick) { if (event->type() == QEvent::MouseButtonDblClick) {
emit titleDblClick(); Q_EMIT titleDblClick();
} else if (event->type() == QEvent::NonClientAreaMouseButtonDblClick) { } else if (event->type() == QEvent::NonClientAreaMouseButtonDblClick) {
emit titleDblClick(); Q_EMIT titleDblClick();
} }
#endif #endif
} }

View File

@ -61,7 +61,7 @@ void LunarCalendarItem::mousePressEvent(QMouseEvent *)
pressed = true; pressed = true;
this->update(); this->update();
emit clicked(date, dayType); Q_EMIT clicked(date, dayType);
} }
void LunarCalendarItem::mouseReleaseEvent(QMouseEvent *) void LunarCalendarItem::mouseReleaseEvent(QMouseEvent *)

View File

@ -412,9 +412,9 @@ void LunarCalendarWidget::dayChanged(const QDate &date)
} }
//发送日期单击信号 //发送日期单击信号
emit clicked(date); Q_EMIT clicked(date);
//发送日期更新信号 //发送日期更新信号
emit selectionChanged(); Q_EMIT selectionChanged();
} }
void LunarCalendarWidget::dateChanged(int year, int month, int day) void LunarCalendarWidget::dateChanged(int year, int month, int day)