Преглед на файлове

V0.7.2
1、修改完成了变色的下拉框

apple преди 1 ден
родител
ревизия
78eb43ec12

+ 1 - 1
.gitignore

@@ -1,2 +1,2 @@
 /.svn
-External/
+/External/

+ 40 - 15
Common/combox/ColorDelegate.cpp

@@ -1,28 +1,53 @@
 #include "ColorDelegate.h"
+#include <qchar.h>
+#include <qcolor.h>
 
 
 
 void ColorDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
 {
-    painter->save();
+
+    QStyleOptionViewItem opt = option;
+    initStyleOption(&opt, index);
+
     // 获取文本
     QString text = index.data().toString();
-    // 分割文本为两部分
-    QStringList parts = text.split(" ");
-    if (parts.size() < 2) {
-        QStyledItemDelegate::paint(painter, option, index);
-        painter->restore();
-        return;
+    // 获取传入的数据
+    bool isConnected = index.data(Qt::UserRole + 1).toBool();
+
+    // 设置颜色
+    if (isConnected)
+    {
+        opt.palette.setColor(QPalette::Text, QColor("#D2D2D2"));
+    }
+    else
+    {
+        opt.palette.setColor(QPalette::Text, QColor("#D21F21"));
+    }
+
+    // 清空 opt 的文本以避免重复绘制
+    opt.text.clear();
+
+    // 调用基类的 paint 方法以应用 QSS 样式
+    // QStyledItemDelegate::paint(painter, opt, index);
+
+    // 自定义绘制逻辑
+    painter->save();
+    
+    // 设置悬浮效果
+    if (option.state & QStyle::State_MouseOver)
+    {
+        painter->fillRect(option.rect, QColor("#438EFF"));
     }
-    // 设置第一部分的颜色
-    painter->setPen(Qt::red);
-    painter->drawText(option.rect, Qt::AlignLeft, parts[0]);
-    // 计算第一部分文本的宽度
-    int firstPartWidth = painter->fontMetrics().width(parts[0]);
-    // 设置第二部分的颜色
-    painter->setPen(Qt::green);
-    painter->drawText(option.rect.adjusted(firstPartWidth, 0, 0, 0), Qt::AlignRight, parts[1]);
+
+    painter->setPen(opt.palette.color(QPalette::Text));
+
+    // 获取样式表中的 padding-left 值
+    QRect textRect = opt.rect.adjusted(12, 0, 0, 0);
+
+    painter->drawText(textRect, Qt::AlignVCenter | Qt::TextSingleLine, text);
     painter->restore();
+
 }
 
 

+ 5 - 0
Common/combox/ColorDelegate.h

@@ -4,6 +4,11 @@
 #include <QStyledItemDelegate>
 #include <QPainter>
 
+
+/**
+ * @brief 下拉框中显示颜色的代理类
+ * 
+ */
 class ColorDelegate : public QStyledItemDelegate 
 {
     Q_OBJECT

+ 2 - 2
EyeMap/EyeMapWidget/eyemapwidget.cpp

@@ -127,10 +127,10 @@ void EyeMapWidget::do_pBtnSettingNum()
 
     /* 设置眼图显示的个数 */
     settingNum->setRowAndColumn(m_row, m_column);
+    /* 设置可选的通道信息,每次获取一次就刷新一次状态 */
+    settingNum->setChannelList(GEyeMapInfo.getChannelInfo());
     /* 设置每个项的信息 */
     settingNum->setEveryEyeMapInfo(GEyeMapInfo.getEyeMapInfo());
-    /* 设置可选的通道信息 */
-    settingNum->setChannelList(GEyeMapInfo.getChannelInfo());
 
     settingNum->exec();
     /* 判断是否点击的是ok,是则重新布局 */

+ 77 - 32
EyeMap/GlobalInfo/EyeMapInfo.cpp

@@ -34,14 +34,14 @@ void AllEyeMapInfo::initEyeMapInfo()
         readSaveFile(m_saveFileName);
     }
 
-    /* 设置可用通道,实际需要根据连接到的示波器个数来设置 */
-    for(int i = 1; i <= 8; i++)
-    {
-        OneChannelInfo info;
-        info.channel = static_cast<OscChnNum>(i);
-        info.channelName = getChannelName(static_cast<OscChnNum>(i));
-        GEyeMapInfo.appendChannelInfo(info);
-    }
+    /* 设置可用通道,给设置页面使用 */
+    // for(int i = 1; i <= 8; i++)
+    // {
+    //     OneChannelInfo info;
+    //     info.channel = static_cast<OscChnNum>(i);
+    //     info.channelName = getChannelName(static_cast<OscChnNum>(i));
+    //     GEyeMapInfo.appendChannelInfo(info);
+    // }
 }
 
 /* 读取保存的文件 */
@@ -290,6 +290,23 @@ void AllEyeMapInfo::resetAllEyeMap()
     }
 }
 
+/* 获取所有的通道信息,每次都是获取最新的状态 */
+QList<OneChannelInfo> AllEyeMapInfo::getChannelInfo()
+{
+    QList<OneChannelInfo> list;
+    for(auto& it : listEyeMapPtr)
+    {
+        list.append(it->getChannelInfo());
+    }
+    return list;
+}
+
+/* 设置通道号对应的示波器是否连接成功 */
+// void AllEyeMapInfo::setChannelConnected(OscChnNum channel, bool isConnected)
+// {
+    
+// }
+
 /* 更新显示的电压刻度信息,这里只更新电压相关的参数 */
 void AllEyeMapInfo::updateVoltageAndTimeGardInfo(const OneEyeMapInfo& info)
 {
@@ -324,30 +341,58 @@ void AllEyeMapInfo::updateInitEyeMapInfo()
 }
 
 /* 获取通道号对应的通道名称 */
-QString AllEyeMapInfo::getChannelName(OscChnNum channel)
+QString AllEyeMapInfo::getChannelName(OscChnNum channel, bool isConnected)
 {
-    switch (channel) 
+    if(isConnected)
     {
-        case OscChnNum::Osc_None:
-            return QString("请选择通道");
-        case OscChnNum::Osc1_CHA:
-            return QString("示波器1通道A");
-        case OscChnNum::Osc1_CHB:
-            return QString("示波器1通道B");
-        case OscChnNum::Osc2_CHA:
-            return QString("示波器2通道A");
-        case OscChnNum::Osc2_CHB:
-            return QString("示波器2通道B");
-        case OscChnNum::Osc3_CHA:
-            return QString("示波器3通道A");
-        case OscChnNum::Osc3_CHB:
-            return QString("示波器3通道B");
-        case OscChnNum::Osc4_CHA:
-            return QString("示波器4通道A");
-        case OscChnNum::Osc4_CHB:
-            return QString("示波器4通道B");
-        default:
-            return QString("请选择通道");
+        switch (channel) 
+        {
+            case OscChnNum::Osc_None:
+                return QString("请选择通道");
+            case OscChnNum::Osc1_CHA:
+                return QString("示波器1通道A");
+            case OscChnNum::Osc1_CHB:
+                return QString("示波器1通道B");
+            case OscChnNum::Osc2_CHA:
+                return QString("示波器2通道A");
+            case OscChnNum::Osc2_CHB:
+                return QString("示波器2通道B");
+            case OscChnNum::Osc3_CHA:
+                return QString("示波器3通道A");
+            case OscChnNum::Osc3_CHB:
+                return QString("示波器3通道B");
+            case OscChnNum::Osc4_CHA:
+                return QString("示波器4通道A");
+            case OscChnNum::Osc4_CHB:
+                return QString("示波器4通道B");
+            default:
+                return QString("请选择通道");
+        }
+    }
+    else {
+        switch (channel) 
+        {
+            case OscChnNum::Osc_None:
+                return QString("请选择通道");
+            case OscChnNum::Osc1_CHA:
+                return QString("示波器1通道A (未连接)");
+            case OscChnNum::Osc1_CHB:
+                return QString("示波器1通道B (未连接)");
+            case OscChnNum::Osc2_CHA:
+                return QString("示波器2通道A (未连接)");
+            case OscChnNum::Osc2_CHB:
+                return QString("示波器2通道B (未连接)");
+            case OscChnNum::Osc3_CHA:
+                return QString("示波器3通道A (未连接)");
+            case OscChnNum::Osc3_CHB:
+                return QString("示波器3通道B (未连接)");
+            case OscChnNum::Osc4_CHA:
+                return QString("示波器4通道A (未连接)");
+            case OscChnNum::Osc4_CHB:
+                return QString("示波器4通道B (未连接)");
+            default:
+                return QString("请选择通道");
+        }
     }
 }
 
@@ -389,7 +434,7 @@ OneEyeMapInfo AllEyeMapInfo::getOneEyeMapInfo(int num)
     info.titleBarColor = QColor("#2D2D31");
     info.isShow = false;
     info.channelInfo.channel = OscChnNum::Osc_None;
-    info.channelInfo.channelName = getChannelName(info.channelInfo.channel);
+    info.channelInfo.channelName = getChannelName(info.channelInfo.channel, false);
     info.title = info.channelInfo.channelName;
     info.voltageRange = OscVoltageRange::CR_2V5;
     info.tGridValue = OscTimeGridValue::TGV_200NS;
@@ -406,7 +451,7 @@ OneEyeMapInfo AllEyeMapInfo::getInitEyeMapInfo(int num)
     info.titleBarColor = QColor("#2D2D31");
     info.isShow = false;
     info.channelInfo.channel = static_cast<OscChnNum>(num);
-    info.channelInfo.channelName = getChannelName(info.channelInfo.channel);
+    info.channelInfo.channelName = getChannelName(info.channelInfo.channel, true);
     info.title = info.channelInfo.channelName;
     info.voltageRange = OscVoltageRange::CR_2V5;
     info.tGridValue = OscTimeGridValue::TGV_200NS;

+ 15 - 7
EyeMap/GlobalInfo/EyeMapInfo.h

@@ -15,12 +15,16 @@ struct OneChannelInfo
 {
     OscChnNum channel;                      /* 通道号 */
     QString channelName;                    /* 通道名 */
+    bool isConnected = false;               /* 示波器是否已经连接 */
 
-    OneChannelInfo() : channel(OscChnNum::Osc_None), channelName("") {}
+    OneChannelInfo() : channel(OscChnNum::Osc_None), 
+    channelName(""),
+    isConnected(false) {}
     OneChannelInfo& operator=(const OneChannelInfo& info)
     {
         channel = info.channel;
         channelName = info.channelName;
+        isConnected = info.isConnected;
 
         return *this;
     }
@@ -105,18 +109,22 @@ public:
     /* 重置所有的颜色矩阵 */
     void resetAllEyeMap();
 
-    /* 获取所有的通道信息 */
-    QList<OneChannelInfo>& getChannelInfo() { return listChannelInfo; }
+    /* 获取所有的通道信息,每次都是获取最新的状态 */
+    // QList<OneChannelInfo>& getChannelInfo() { return listChannelInfo; }
+    QList<OneChannelInfo> getChannelInfo();
     /* 设置通道信息 */
-    void setChannelInfo(const QList<OneChannelInfo>& list) { listChannelInfo = list; }
-    void appendChannelInfo(const OneChannelInfo& info) { listChannelInfo.append(info); }
+    // void setChannelInfo(const QList<OneChannelInfo>& list) { listChannelInfo = list; }
+    // void appendChannelInfo(const OneChannelInfo& info) { listChannelInfo.append(info); }
+    /* 设置通道号对应的示波器是否连接成功 */
+    // void setChannelConnected(OscChnNum channel, bool isConnected);
+
     /* 更新显示的电压刻度、时间刻度信息,这里只更新这两个相关的参数 */
     void updateVoltageAndTimeGardInfo(const OneEyeMapInfo& info);
 
     /* 更新初始化数组 */
     void updateInitEyeMapInfo();
     /* 获取通道号对应的通道名称 */
-    static QString getChannelName(OscChnNum channel);
+    static QString getChannelName(OscChnNum channel, bool isConnected);
 
     /* 判断一个示波器是否有显示的眼图 */
     bool hasShowEyeMap(int oscNum);
@@ -132,7 +140,7 @@ public:
 
 public:
     QList<OneEyeMap*> listEyeMapPtr;                    /* 保存8个眼图的指针 */
-    QList<OneChannelInfo> listChannelInfo;              /* 可用的通道号 */
+    // QList<OneChannelInfo> listChannelInfo;              /* 可用的通道号 */
 
     QList<OneEyeMapInfo> listInitEyeMapInfo;            /* 保存每个眼图的初始化信息,程序启动和结束的时候使用 */
 

+ 22 - 0
EyeMap/OneEyeMap/OneEyeMap.cpp

@@ -1,4 +1,6 @@
 #include "OneEyeMap.h"
+#include "EyeMapInfo.h"
+#include "spdlog.h"
 #include "ui_oneeyemap.h"
 
 #include <QApplication>
@@ -151,6 +153,26 @@ void OneEyeMap::setShow(bool isShow)
     }
 }
 
+/* 获取通道信息 */
+OneChannelInfo& OneEyeMap::getChannelInfo()
+{
+    if(m_osc == nullptr)
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "通道号:{} 示波器指针为空", static_cast<int>(m_info.channelInfo.channel));
+        return m_info.channelInfo;
+    }
+    if(m_osc->isOpen())
+    {
+        m_info.channelInfo.isConnected = true;
+        m_info.channelInfo.channelName = GEyeMapInfo.getChannelName(m_info.channelInfo.channel, true);
+    } else
+    {
+        m_info.channelInfo.isConnected = false;
+        m_info.channelInfo.channelName = GEyeMapInfo.getChannelName(m_info.channelInfo.channel, false);
+    }
+    return m_info.channelInfo;
+}
+
 /* 设置电压值 */
 void OneEyeMap::setVoltageRange(OscVoltageRange range)
 {

+ 1 - 1
EyeMap/OneEyeMap/OneEyeMap.h

@@ -51,7 +51,7 @@ public:
     /* 设置通道信息 */
     void setChannelInfo(const OneChannelInfo &info) { m_info.channelInfo = info; }
     /* 获取通道信息 */
-    OneChannelInfo& getChannelInfo() { return m_info.channelInfo; }
+    OneChannelInfo& getChannelInfo();
     /* 设置电压值 */
     void setVoltageRange(OscVoltageRange range);
     /* 获取电压值 */

+ 17 - 1
EyeMap/SettingNum/OneItem/OneSettingItem.qss

@@ -28,6 +28,7 @@ QComboBox
 	color: #D2D2D2;
 	padding-left: 12px;
 }
+
 QComboBox:hover, QComboBox:on 
 {
 	border: 1px solid #438EFF;
@@ -45,11 +46,13 @@ QComboBox::down-arrow
 	width: 16px;
 	image: url(:/image/Resource/image/DownArrow.png);
 }
+
 QComboBox::drop-down
 {
     background-color:transparent;
 	padding-right:12px;
 }
+
 /* 下拉后,整个下拉窗体样式 */
 QComboBox QAbstractItemView
 {
@@ -59,6 +62,7 @@ QComboBox QAbstractItemView
 	outline:0px;
 	border-radius: 4px;
 }
+
 /* 下拉后,整个下拉窗体每项的样式 */
 QComboBox QAbstractItemView::item 
 {
@@ -68,8 +72,20 @@ QComboBox QAbstractItemView::item
 	background-color: #5C5E61;
 	font-weight: 400;
 	font-size: 14px;
-	padding-left: 11px;
+	padding-left: 12px;
 }
+
+QComboBox QAbstractItemView::item[NoDevice=true] 
+{
+    border-radius: 4px;
+	color: #D21F21;
+    height: 32px;
+	background-color: #5C5E61;
+	font-weight: 400;
+	font-size: 14px;
+	padding-left: 12px;
+}
+
 QComboBox QAbstractItemView::item:hover 
 {
 	font-weight: 400;

+ 26 - 5
EyeMap/SettingNum/OneItem/onesettingitem.cpp

@@ -1,9 +1,11 @@
 #include "onesettingitem.h"
+#include "spdlog.h"
 #include "ui_onesettingitem.h"
 
 #include <QDebug>
 #include <QFile>
 #include <QEvent>
+#include <qnamespace.h>
 #include "colordialogapi.h"
 #include "ColorDelegate.h"
 
@@ -79,7 +81,7 @@ void OneSettingItem::setItemInfo(const OneEyeMapInfo& info)
     ui->label_num->setText(QString::number(info.num));
     ui->lineEdit->setText(info.title);
     setColor(info.titleBarColor);
-    setCurrentChannel(info.channelInfo.channelName);
+    setCurrentChannel(info.channelInfo.channel);
     // SPDLOG_LOGGER_DEBUG(m_logger, "当前通道号: {}", eyeMapInfo.channelInfo.channelName.toStdString());
 }
 
@@ -87,16 +89,17 @@ void OneSettingItem::setItemInfo(const OneEyeMapInfo& info)
 void OneSettingItem::setChannelList(const QList<OneChannelInfo>& list)
 {
     ui->comboBox->clear();
-    ui->comboBox->addItem(GEyeMapInfo.getChannelName(OscChnNum::Osc_None), 0);
+    ui->comboBox->addItem(GEyeMapInfo.getChannelName(OscChnNum::Osc_None, true), 0);
+    ui->comboBox->setItemData(ui->comboBox->count() - 1, true, Qt::UserRole + 1);
     for(const auto &it : list)
     {
+        /* 设置可选项,用户数据设置为通道号 */
         ui->comboBox->addItem(it.channelName, static_cast<int>(it.channel));
+        ui->comboBox->setItemData(ui->comboBox->count() - 1, it.isConnected, Qt::UserRole + 1);
+        // SPDLOG_LOGGER_DEBUG(m_logger, "通道号: {}, 通道名: {}", static_cast<int>(it.channel), it.channelName.toStdString());
     }
     /* 设置自定义委托 */
     ui->comboBox->setItemDelegate(new ColorDelegate(ui->comboBox));
-    /* 设置当前选项 */
-    ui->comboBox->setCurrentText(eyeMapInfo.channelInfo.channelName);
-    // SPDLOG_LOGGER_DEBUG(m_logger, "---当前通道号: {}", eyeMapInfo.channelInfo.channelName.toStdString());
 }
 
 /* 设置当前通道名 */
@@ -107,6 +110,24 @@ void OneSettingItem::setCurrentChannel(const QString& channelName)
     eyeMapInfo.channelInfo.channel = static_cast<OscChnNum>(ui->comboBox->currentData().toInt());
 }
 
+/**
+ * @brief 使用通道号设置当前通道,这里的通道号和下拉列表的index一一对应
+ * 
+ * @param channel 
+ */
+void OneSettingItem::setCurrentChannel(const OscChnNum channel)
+{
+    // SPDLOG_LOGGER_DEBUG(m_logger, "设置通道号: {}", static_cast<int>(channel));
+    ui->comboBox->setCurrentIndex(static_cast<int>(channel));
+    // SPDLOG_LOGGER_DEBUG(m_logger, "当前index: {}", ui->comboBox->currentIndex());
+    // for(int i = 0; i < ui->comboBox->count(); i++)
+    // {
+    //     SPDLOG_LOGGER_WARN(m_logger, "通道号: {}, 通道名: {}", ui->comboBox->itemData(i).toInt(), ui->comboBox->itemText(i).toStdString());
+    // }
+    eyeMapInfo.channelInfo.channelName = ui->comboBox->currentText();
+    eyeMapInfo.channelInfo.channel = channel;
+}
+
 /* 获取当前通道号 */
 OneChannelInfo OneSettingItem::getCurrentChannel()
 {

+ 1 - 0
EyeMap/SettingNum/OneItem/onesettingitem.h

@@ -31,6 +31,7 @@ public:
     void setChannelList(const QList<OneChannelInfo>& list);
     /* 设置当前通道号 */
     void setCurrentChannel(const QString& channelName);
+    void setCurrentChannel(const OscChnNum channel);
     /* 获取当前通道号 */
     OneChannelInfo  getCurrentChannel();
 

+ 0 - 230
EyeMap/SettingNum/back/settingnum.cpp_

@@ -1,230 +0,0 @@
-#include "settingnum.h"
-#include "ui_settingnum.h"
-
-#include <QDebug>
-#include <QFile>
-#include <QPainter>
-
-#include "customcombobox.h"
-#include "onesettingitem.h"
-#include "oneshadow.h"
-
-SettingNum::SettingNum(QDialog *parent) :
-    QDialog(parent),
-    ui(new Ui::SettingNum)
-{
-    ui->setupUi(this);
-
-    m_logger = spdlog::get("EyeMap");
-    if(m_logger == nullptr)
-    {
-        qDebug() << "获取 EyeMap logger 失败";
-        return;
-    }
-    /* 注册事件过滤,主要是消除滚轮对comboBox的影响 */
-    ui->comboBox_rowNum->installEventFilter(this);
-    ui->comboBox_columnNum->installEventFilter(this);
-
-    /* 设置无边框和背景透明 */
-    this->setWindowFlags(Qt::FramelessWindowHint);
-    this->setAttribute(Qt::WA_TranslucentBackground);
-    /* 加载QSS */
-    QFile fileQss(":/qss/SettingNum/SettingNum.qss");
-    if(fileQss.open(QFile::ReadOnly))
-    {
-        QString qss = fileQss.readAll();
-        this->setStyleSheet(qss);
-        fileQss.close();
-    } else
-    {
-        SPDLOG_LOGGER_ERROR(m_logger, "加载QSS文件失败");
-    }
-    /* 设置阴影 */
-    m_shadow = new OneShadow(ui->widget->size(), 16);
-    ui->verticalLayout->setMargin(16);
-
-    /* 初始化变量 */
-    for(auto item : m_listItem)
-    {
-        item = nullptr;
-    }
-
-    // ui->pBtn_close->move(ui->widget_top->width() - 40, 13);
-
-    /* 设置下拉框可选个数 */
-    QStringList listRow;
-    listRow << "1" << "2" << "3" << "4";
-    ui->comboBox_rowNum->addItems(listRow);
-    ui->comboBox_columnNum->addItem("1");
-    ui->comboBox_columnNum->addItem("2");
-    ui->comboBox_rowNum->setCurrentIndex(1);
-    ui->comboBox_columnNum->setCurrentIndex(1);
-
-
-    connect(ui->pBtn_close, &QPushButton::clicked, this, &SettingNum::do_pBtn_close);
-    connect(ui->pBtn_ok, &QPushButton::clicked, this, &SettingNum::do_pBtn_ok);
-    connect(ui->pBtn_cancel, &QPushButton::clicked, this, &SettingNum::do_pBtn_cancel);
-
-    connect(ui->comboBox_rowNum, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SettingNum::do_selectRowAndColumn);
-    connect(ui->comboBox_columnNum, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SettingNum::do_selectRowAndColumn);
-
-}
-
-SettingNum::~SettingNum()
-{
-    for(auto item : m_listItem)
-    {
-        if(item == nullptr)
-        {
-            continue;
-        }
-        delete item;
-        item = nullptr;
-    }
-    if(m_shadow != nullptr)
-    {
-        delete m_shadow;
-        m_shadow = nullptr;
-    }
-    delete ui;
-}
-
-/* 设置行数和列数 */
-void SettingNum::setRowAndColumn(int row, int column)
-{
-    ui->comboBox_rowNum->setCurrentIndex(row - 1);
-    ui->comboBox_columnNum->setCurrentIndex(column - 1);
-    /* 根据 行 x 列 总数计算需要显示的个数 */
-    int num = row * column;
-    for(int i = 0; i < 8; i++)
-    {
-        OneSettingItem *item = new OneSettingItem(ui->widget_list);
-        item->setNum(i + 1);
-        connect(item, &OneSettingItem::signal_select_channel, this, &SettingNum::do_selectChannel);
-        m_listItem.append(item);
-    }
-    /* 移动item的位置 */
-    layoutItem(num);
-}
-
-/* 设置每个项的信息 */
-void SettingNum::setEveryEyeMapInfo(const QList<OneEyeMapInfo> &listInfo)
-{
-    for(auto &item : m_listItem)
-    {
-        for(auto &info : listInfo)
-        {
-            if(item->getNum() == info.num)
-            {
-                item->setItemInfo(info);
-                break;
-            }
-        }
-    }
-}
-
-/* 设置可用的通道信息 */
-void SettingNum::setChannelList(const QList<OneChannelInfo> &listChannelInfo)
-{
-    for(auto &item : m_listItem)
-    {
-        item->setChannelList(listChannelInfo);
-    }
-}
-
-/* 绘制阴影 */
-void SettingNum::paintEvent(QPaintEvent *event)
-{
-    // QPainter painter(this);
-    // painter.setRenderHint(QPainter::Antialiasing);
-    // painter.drawImage(QPoint(0,0),m_shadow->image());
-}
-
-/* 事件过滤器 */
-bool SettingNum::eventFilter(QObject *watched, QEvent *event)
-{
-    if(watched == ui->comboBox_rowNum || watched == ui->comboBox_columnNum)
-    {
-        if(event->type() == QEvent::Wheel)
-        {
-            return true;
-        }
-    }
-    return QWidget::eventFilter(watched, event);
-}
-
-/* 关闭按钮槽函数 */
-void SettingNum::do_pBtn_close()
-{
-    this->close();
-}
-
-/* 点击了OK按钮 */
-void SettingNum::do_pBtn_ok()
-{
-    isOk = true;
-    row = ui->comboBox_rowNum->currentText().toInt();
-    column = ui->comboBox_columnNum->currentText().toInt();
-
-    /* 更新全局信息 */
-    for(auto &item : m_listItem)
-    {
-        GEyeMapInfo.updateSettingNum(item->getEyeMapInfo());
-    }
-
-    this->close();
-}
-
-/* 点击了取消按钮 */
-void SettingNum::do_pBtn_cancel()
-{
-    isOk = false;
-    this->close();
-}
-
-/* 选择行和列槽函数 */
-void SettingNum::do_selectRowAndColumn(int index)
-{
-    row = ui->comboBox_rowNum->currentText().toInt();
-    column = ui->comboBox_columnNum->currentText().toInt();
-    int num = row * column;
-    layoutItem(num);
-}
-
-/* 通道选择槽函数,选择了一个通道,取消其他项可能已经选择的相同通道 */
-void SettingNum::do_selectChannel(const OscChnNum channel, const QString &channelName)
-{
-    auto sender = qobject_cast<OneSettingItem*>(QObject::sender());
-    for(auto item : m_listItem)
-    {
-        if((item->getCurrentChannel().channel == channel) && (item != sender))
-        {
-            item->setCurrentChannel(GEyeMapInfo.getChannelName(OscChnNum::Osc_None));
-        }
-    }
-}
-
-
-/**
- * @brief 布局item
- * 
- * @param num 需要显示的几个item
- */
-void SettingNum::layoutItem(int num)
-{
-    for(auto item : m_listItem)
-    {
-        auto dy = (item->getNum() - 1) * 48;
-        item->move(0, dy);
-        if(item->getNum() > num)
-        {
-            item->hide();
-        } else
-        {
-            item->show();
-        }
-    }
-    
-}
-
-

+ 0 - 299
EyeMap/SettingNum/back/settingnum.cpp__

@@ -1,299 +0,0 @@
-#include "settingnum.h"
-#include "ui_settingnum.h"
-
-#include <QDebug>
-#include <QFile>
-#include <QPainter>
-#include <QVBoxLayout>
-#include <QHeaderView>
-
-#include "customcombobox.h"
-#include "onesettingitem.h"
-#include "oneshadow.h"
-
-SettingNum::SettingNum(QDialog *parent) :
-    QDialog(parent),
-    ui(new Ui::SettingNum)
-{
-    ui->setupUi(this);
-
-    m_logger = spdlog::get("EyeMap");
-    if(m_logger == nullptr)
-    {
-        qDebug() << "获取 EyeMap logger 失败";
-        return;
-    }
-    /* 注册事件过滤,主要是消除滚轮对comboBox的影响 */
-    ui->comboBox_rowNum->installEventFilter(this);
-    ui->comboBox_columnNum->installEventFilter(this);
-
-    /* 设置无边框和背景透明 */
-    this->setWindowFlags(Qt::FramelessWindowHint);
-    this->setAttribute(Qt::WA_TranslucentBackground);
-    /* 加载QSS */
-    QFile fileQss(":/qss/SettingNum/SettingNum.qss");
-    if(fileQss.open(QFile::ReadOnly))
-    {
-        QString qss = fileQss.readAll();
-        this->setStyleSheet(qss);
-        fileQss.close();
-    } else
-    {
-        SPDLOG_LOGGER_ERROR(m_logger, "加载QSS文件失败");
-    }
-    /* 设置阴影 */
-    m_shadow = new OneShadow(ui->widget->size(), 16);
-    ui->verticalLayout->setMargin(16);
-
-    /* 初始化变量 */
-    for(auto item : m_listItem)
-    {
-        item = nullptr;
-    }
-
-    // ui->pBtn_close->move(ui->widget_top->width() - 40, 13);
-
-    /* 设置下拉框可选个数 */
-    QStringList listRow;
-    listRow << "1" << "2" << "3" << "4";
-    ui->comboBox_rowNum->addItems(listRow);
-    ui->comboBox_columnNum->addItem("1");
-    ui->comboBox_columnNum->addItem("2");
-    ui->comboBox_rowNum->setCurrentIndex(1);
-    ui->comboBox_columnNum->setCurrentIndex(1);
-
-    /* 初始化表格列表 */
-    initTableList();
-
-
-    connect(ui->pBtn_close, &QPushButton::clicked, this, &SettingNum::do_pBtn_close);
-    connect(ui->pBtn_ok, &QPushButton::clicked, this, &SettingNum::do_pBtn_ok);
-    connect(ui->pBtn_cancel, &QPushButton::clicked, this, &SettingNum::do_pBtn_cancel);
-
-    connect(ui->comboBox_rowNum, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SettingNum::do_selectRowAndColumn);
-    connect(ui->comboBox_columnNum, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SettingNum::do_selectRowAndColumn);
-
-}
-
-SettingNum::~SettingNum()
-{
-    for(auto item : m_listItem)
-    {
-        if(item == nullptr)
-        {
-            continue;
-        }
-        delete item;
-        item = nullptr;
-    }
-    if(m_shadow != nullptr)
-    {
-        delete m_shadow;
-        m_shadow = nullptr;
-    }
-    delete ui;
-}
-
-/* 设置行数和列数 */
-void SettingNum::setRowAndColumn(int row, int column)
-{
-    ui->comboBox_rowNum->setCurrentIndex(row - 1);
-    ui->comboBox_columnNum->setCurrentIndex(column - 1);
-    /* 根据 行 x 列 总数计算需要显示的个数 */
-    int num = row * column;
-    // for(int i = 0; i < 8; i++)
-    // {
-    //     OneSettingItem *item = new OneSettingItem(ui->widget_list);
-    //     item->setNum(i + 1);
-    //     connect(item, &OneSettingItem::signal_select_channel, this, &SettingNum::do_selectChannel);
-    //     m_listItem.append(item);
-    // }
-    /* 移动item的位置 */
-    // layoutItem(num);
-}
-
-/* 设置每个项的信息 */
-void SettingNum::setEveryEyeMapInfo(const QList<OneEyeMapInfo> &listInfo)
-{
-    // for(auto &item : m_listItem)
-    // {
-    //     for(auto &info : listInfo)
-    //     {
-    //         if(item->getNum() == info.num)
-    //         {
-    //             item->setItemInfo(info);
-    //             break;
-    //         }
-    //     }
-    // }
-}
-
-/* 设置可用的通道信息 */
-void SettingNum::setChannelList(const QList<OneChannelInfo> &listChannelInfo)
-{
-    // for(auto &item : m_listItem)
-    // {
-    //     item->setChannelList(listChannelInfo);
-    // }
-}
-
-/* 绘制阴影 */
-// void SettingNum::paintEvent(QPaintEvent *event)
-// {
-//     // QPainter painter(this);
-//     // painter.setRenderHint(QPainter::Antialiasing);
-//     // painter.drawImage(QPoint(0,0),m_shadow->image());
-// }
-
-/* 事件过滤器 */
-bool SettingNum::eventFilter(QObject *watched, QEvent *event)
-{
-    if(watched == ui->comboBox_rowNum || watched == ui->comboBox_columnNum)
-    {
-        if(event->type() == QEvent::Wheel)
-        {
-            return true;
-        }
-    }
-    return QWidget::eventFilter(watched, event);
-}
-
-/* 关闭按钮槽函数 */
-void SettingNum::do_pBtn_close()
-{
-    this->close();
-}
-
-/* 点击了OK按钮 */
-void SettingNum::do_pBtn_ok()
-{
-    isOk = true;
-    row = ui->comboBox_rowNum->currentText().toInt();
-    column = ui->comboBox_columnNum->currentText().toInt();
-
-    /* 更新全局信息 */
-    for(auto &item : m_listItem)
-    {
-        GEyeMapInfo.updateSettingNum(item->getEyeMapInfo());
-    }
-
-    this->close();
-}
-
-/* 点击了取消按钮 */
-void SettingNum::do_pBtn_cancel()
-{
-    isOk = false;
-    this->close();
-}
-
-/* 选择行和列槽函数 */
-void SettingNum::do_selectRowAndColumn(int index)
-{
-    row = ui->comboBox_rowNum->currentText().toInt();
-    column = ui->comboBox_columnNum->currentText().toInt();
-    int num = row * column;
-    layoutItem(num);
-}
-
-/* 通道选择槽函数,选择了一个通道,取消其他项可能已经选择的相同通道 */
-void SettingNum::do_selectChannel(const OscChnNum channel, const QString &channelName)
-{
-    auto sender = qobject_cast<OneSettingItem*>(QObject::sender());
-    for(auto item : m_listItem)
-    {
-        if((item->getCurrentChannel().channel == channel) && (item != sender))
-        {
-            item->setCurrentChannel(GEyeMapInfo.getChannelName(OscChnNum::Osc_None));
-        }
-    }
-}
-
-
-/**
- * @brief 布局item
- * 
- * @param num 需要显示的几个item
- */
-void SettingNum::layoutItem(int num)
-{
-    for(auto item : m_listItem)
-    {
-        auto dy = (item->getNum() - 1) * 48;
-        item->move(0, dy);
-        if(item->getNum() > num)
-        {
-            item->hide();
-        } else
-        {
-            item->show();
-        }
-    }
-    
-}
-
-/* 初始化表格列表 */
-void SettingNum::initTableList()
-{
-    /* 设置一个布局 */
-    QVBoxLayout *layout = new QVBoxLayout(ui->widget_list);
-    layout->setMargin(0);
-    layout->setSpacing(0);
-    ui->widget_list->setLayout(layout);
-
-    /* 设置模型和视图 */
-    m_tableView = new QTableView(ui->widget_list);
-    m_model = new QStandardItemModel(this);
-    m_tableView->setModel(m_model);
-    layout->addWidget(m_tableView);
-
-    /****** 设置表格属性 ******/
-    /* 设置列数和标题 */
-    m_model->setColumnCount(4);
-    m_model->setHeaderData(0, Qt::Horizontal, "序号");
-    m_model->setHeaderData(1, Qt::Horizontal, "通道");
-    m_model->setHeaderData(2, Qt::Horizontal, "通道展示名称");
-    m_model->setHeaderData(3, Qt::Horizontal, "底色");
-
-    /* 设置标题栏属性 */
-    m_tableView->horizontalHeader()->setFixedHeight(48);
-    /* 禁止点击标题选择一列 */
-    m_tableView->horizontalHeader()->setSectionsClickable(false);
-    /* 设置标题栏文字间距等都在样式表中设置 */
-    m_tableView->horizontalHeader()->setDefaultAlignment(Qt::AlignVCenter | Qt::AlignLeft);
-    
-    /* 设置列宽,各减少1个像素点给分割线 */
-    m_tableView->setColumnWidth(0, 67);
-    m_tableView->setColumnWidth(1, 296);
-    m_tableView->setColumnWidth(2, 296);
-    m_tableView->setColumnWidth(3, 64);
-
-    /* 设置行高 */
-    m_tableView->verticalHeader()->setDefaultSectionSize(48);
-    /* 去掉列序号 */
-    m_tableView->verticalHeader()->hide();
-    /* 设置第一列内容文字左间距为12px */
-    // m_tableView->setStyleSheet("QTableView::item{padding-left: 12px;}");
-
-    /* 添加8列,展示效果用的 */
-    for(int i = 0; i < 8; i++)
-    {
-        m_model->setRowCount(i + 1);
-        m_model->setData(m_model->index(i, 0), i + 1);
-        m_model->setData(m_model->index(i, 1), "通道" + QString::number(i + 1));
-        m_model->setData(m_model->index(i, 2), "通道" + QString::number(i + 1));
-        m_model->setData(m_model->index(i, 3), QColor(255, 255, 255));
-    }
-    
-    /* 设置QCombobox */
-    m_tableView->setIndexWidget(m_model->index(0, 1), new CustomComboBox(m_tableView));
-    m_tableView->setIndexWidget(m_model->index(1, 1), new CustomComboBox(m_tableView));
-    m_tableView->setIndexWidget(m_model->index(2, 1), new CustomComboBox(m_tableView));
-    m_tableView->setIndexWidget(m_model->index(3, 1), new CustomComboBox(m_tableView));
-    // m_tableView->setItemDelegateForColumn(1, new CustomComboBoxDelegate(m_tableView));
-
-    
-
-}
-
-

+ 0 - 64
EyeMap/SettingNum/back/settingnum.h_

@@ -1,64 +0,0 @@
-#ifndef SETTINGNUM_H
-#define SETTINGNUM_H
-
-#include <QDialog>
-
-#include "spdlog/spdlog.h"
-#include "EyeMapInfo.h"
-
-class OneShadow;
-class OneSettingItem;
-
-namespace Ui {
-class SettingNum;
-}
-
-class SettingNum : public QDialog
-{
-    Q_OBJECT
-
-public:
-    explicit SettingNum(QDialog *parent = nullptr);
-    ~SettingNum();
-
-    /* 设置行数和列数 */
-    void setRowAndColumn(int row, int column);
-    /* 设置每个项的信息 */
-    void setEveryEyeMapInfo(const QList<OneEyeMapInfo> &listInfo);
-    /* 设置可用的通道信息 */
-    void setChannelList(const QList<OneChannelInfo> &listChannelInfo);
-
-protected:
-    void paintEvent(QPaintEvent *event) override;
-    /* 事件过滤器 */
-    bool eventFilter(QObject *watched, QEvent *event) override;
-
-private slots:
-    /* 关闭按钮槽函数 */
-    void do_pBtn_close();
-    /* 点击了OK按钮 */
-    void do_pBtn_ok();
-    /* 点击了取消按钮 */
-    void do_pBtn_cancel();
-    /* 选择行和列槽函数 */
-    void do_selectRowAndColumn(int index);
-    /* 通道选择槽函数,选择了一个通道,取消其他项可能已经选择的相同通道 */
-    void do_selectChannel(const OscChnNum channel, const QString &channelName);
-
-private:
-    /* 布局item */
-    void layoutItem(int num);
-
-public:
-    int row = 0;            /* 行 */
-    int column = 0;         /* 列 */
-    bool isOk = false;      /* 是否点击了OK按钮 */
-private:
-    Ui::SettingNum *ui;
-    std::shared_ptr<spdlog::logger> m_logger = nullptr;
-    OneShadow *m_shadow = nullptr;
-
-    QList<OneSettingItem*> m_listItem;
-};
-
-#endif // SETTINGNUM_H

+ 0 - 72
EyeMap/SettingNum/back/settingnum.h__

@@ -1,72 +0,0 @@
-#ifndef SETTINGNUM_H
-#define SETTINGNUM_H
-
-#include <QDialog>
-
-#include "spdlog/spdlog.h"
-#include "EyeMapInfo.h"
-
-#include <QStandardItemModel>
-#include <QTableView>
-
-class OneShadow;
-class OneSettingItem;
-
-namespace Ui {
-class SettingNum;
-}
-
-class SettingNum : public QDialog
-{
-    Q_OBJECT
-
-public:
-    explicit SettingNum(QDialog *parent = nullptr);
-    ~SettingNum();
-
-    /* 设置行数和列数 */
-    void setRowAndColumn(int row, int column);
-    /* 设置每个项的信息 */
-    void setEveryEyeMapInfo(const QList<OneEyeMapInfo> &listInfo);
-    /* 设置可用的通道信息 */
-    void setChannelList(const QList<OneChannelInfo> &listChannelInfo);
-
-protected:
-    // void paintEvent(QPaintEvent *event) override;
-    /* 事件过滤器 */
-    bool eventFilter(QObject *watched, QEvent *event) override;
-
-private slots:
-    /* 关闭按钮槽函数 */
-    void do_pBtn_close();
-    /* 点击了OK按钮 */
-    void do_pBtn_ok();
-    /* 点击了取消按钮 */
-    void do_pBtn_cancel();
-    /* 选择行和列槽函数 */
-    void do_selectRowAndColumn(int index);
-    /* 通道选择槽函数,选择了一个通道,取消其他项可能已经选择的相同通道 */
-    void do_selectChannel(const OscChnNum channel, const QString &channelName);
-
-private:
-    /* 布局item */
-    void layoutItem(int num);
-    /* 初始化表格列表 */
-    void initTableList();
-
-public:
-    int row = 0;            /* 行 */
-    int column = 0;         /* 列 */
-    bool isOk = false;      /* 是否点击了OK按钮 */
-private:
-    Ui::SettingNum *ui;
-    std::shared_ptr<spdlog::logger> m_logger = nullptr;
-    OneShadow *m_shadow = nullptr;
-
-    QList<OneSettingItem*> m_listItem;
-
-    QStandardItemModel *m_model = nullptr;
-    QTableView *m_tableView = nullptr;
-};
-
-#endif // SETTINGNUM_H

+ 0 - 267
EyeMap/SettingNum/back/settingnum.ui_

@@ -1,267 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>SettingNum</class>
- <widget class="QDialog" name="SettingNum">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>810</width>
-    <height>705</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Form</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
-    <widget class="QWidget" name="widget" native="true">
-     <widget class="QWidget" name="widget_top" native="true">
-      <property name="geometry">
-       <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>788</width>
-        <height>50</height>
-       </rect>
-      </property>
-      <widget class="QLabel" name="label_settingName">
-       <property name="geometry">
-        <rect>
-         <x>32</x>
-         <y>16</y>
-         <width>80</width>
-         <height>18</height>
-        </rect>
-       </property>
-       <property name="text">
-        <string>组屏配置</string>
-       </property>
-      </widget>
-      <widget class="QPushButton" name="pBtn_close">
-       <property name="geometry">
-        <rect>
-         <x>738</x>
-         <y>13</y>
-         <width>24</width>
-         <height>24</height>
-        </rect>
-       </property>
-       <property name="text">
-        <string/>
-       </property>
-      </widget>
-     </widget>
-     <widget class="QLabel" name="label_x1">
-      <property name="geometry">
-       <rect>
-        <x>32</x>
-        <y>89</y>
-        <width>7</width>
-        <height>14</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string>*</string>
-      </property>
-     </widget>
-     <widget class="QLabel" name="label_nc1">
-      <property name="geometry">
-       <rect>
-        <x>40</x>
-        <y>89</y>
-        <width>70</width>
-        <height>14</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string>通道行数:</string>
-      </property>
-     </widget>
-     <widget class="CustomComboBox" name="comboBox_rowNum">
-      <property name="geometry">
-       <rect>
-        <x>110</x>
-        <y>80</y>
-        <width>82</width>
-        <height>32</height>
-       </rect>
-      </property>
-     </widget>
-     <widget class="QLabel" name="label_nc2">
-      <property name="geometry">
-       <rect>
-        <x>240</x>
-        <y>89</y>
-        <width>70</width>
-        <height>14</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string>通道列数:</string>
-      </property>
-     </widget>
-     <widget class="QLabel" name="label_x2">
-      <property name="geometry">
-       <rect>
-        <x>232</x>
-        <y>89</y>
-        <width>7</width>
-        <height>14</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string>*</string>
-      </property>
-     </widget>
-     <widget class="CustomComboBox" name="comboBox_columnNum">
-      <property name="geometry">
-       <rect>
-        <x>310</x>
-        <y>80</y>
-        <width>82</width>
-        <height>32</height>
-       </rect>
-      </property>
-     </widget>
-     <widget class="QLabel" name="label_line1">
-      <property name="geometry">
-       <rect>
-        <x>32</x>
-        <y>142</y>
-        <width>724</width>
-        <height>1</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string/>
-      </property>
-     </widget>
-     <widget class="QLabel" name="label_line2">
-      <property name="geometry">
-       <rect>
-        <x>32</x>
-        <y>190</y>
-        <width>724</width>
-        <height>1</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string/>
-      </property>
-     </widget>
-     <widget class="QLabel" name="label_nc3">
-      <property name="geometry">
-       <rect>
-        <x>44</x>
-        <y>160</y>
-        <width>40</width>
-        <height>14</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string>序号</string>
-      </property>
-     </widget>
-     <widget class="QLabel" name="label_nc4">
-      <property name="geometry">
-       <rect>
-        <x>100</x>
-        <y>160</y>
-        <width>40</width>
-        <height>14</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string>通道</string>
-      </property>
-     </widget>
-     <widget class="QLabel" name="label_nc5">
-      <property name="geometry">
-       <rect>
-        <x>396</x>
-        <y>160</y>
-        <width>280</width>
-        <height>14</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string>通道展示名称</string>
-      </property>
-     </widget>
-     <widget class="QLabel" name="label_nc6">
-      <property name="geometry">
-       <rect>
-        <x>692</x>
-        <y>160</y>
-        <width>40</width>
-        <height>14</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string>底色</string>
-      </property>
-     </widget>
-     <widget class="QLabel" name="label_line3">
-      <property name="geometry">
-       <rect>
-        <x>32</x>
-        <y>575</y>
-        <width>724</width>
-        <height>1</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string/>
-      </property>
-     </widget>
-     <widget class="QWidget" name="widget_list" native="true">
-      <property name="geometry">
-       <rect>
-        <x>32</x>
-        <y>191</y>
-        <width>724</width>
-        <height>384</height>
-       </rect>
-      </property>
-     </widget>
-     <widget class="QPushButton" name="pBtn_ok">
-      <property name="geometry">
-       <rect>
-        <x>560</x>
-        <y>606</y>
-        <width>90</width>
-        <height>40</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string>保存</string>
-      </property>
-     </widget>
-     <widget class="QPushButton" name="pBtn_cancel">
-      <property name="geometry">
-       <rect>
-        <x>666</x>
-        <y>606</y>
-        <width>90</width>
-        <height>40</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string>取消</string>
-      </property>
-     </widget>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <customwidgets>
-  <customwidget>
-   <class>CustomComboBox</class>
-   <extends>QComboBox</extends>
-   <header location="global">customcombobox.h</header>
-  </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>

+ 0 - 176
EyeMap/SettingNum/back/settingnum.ui__

@@ -1,176 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>SettingNum</class>
- <widget class="QDialog" name="SettingNum">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>810</width>
-    <height>705</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Form</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
-    <widget class="QWidget" name="widget" native="true">
-     <widget class="QWidget" name="widget_top" native="true">
-      <property name="geometry">
-       <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>788</width>
-        <height>50</height>
-       </rect>
-      </property>
-      <widget class="QLabel" name="label_settingName">
-       <property name="geometry">
-        <rect>
-         <x>32</x>
-         <y>16</y>
-         <width>80</width>
-         <height>18</height>
-        </rect>
-       </property>
-       <property name="text">
-        <string>组屏配置</string>
-       </property>
-      </widget>
-      <widget class="QPushButton" name="pBtn_close">
-       <property name="geometry">
-        <rect>
-         <x>738</x>
-         <y>13</y>
-         <width>24</width>
-         <height>24</height>
-        </rect>
-       </property>
-       <property name="text">
-        <string/>
-       </property>
-      </widget>
-     </widget>
-     <widget class="QLabel" name="label_x1">
-      <property name="geometry">
-       <rect>
-        <x>32</x>
-        <y>89</y>
-        <width>7</width>
-        <height>14</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string>*</string>
-      </property>
-     </widget>
-     <widget class="QLabel" name="label_nc1">
-      <property name="geometry">
-       <rect>
-        <x>40</x>
-        <y>89</y>
-        <width>70</width>
-        <height>14</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string>通道行数:</string>
-      </property>
-     </widget>
-     <widget class="CustomComboBox" name="comboBox_rowNum">
-      <property name="geometry">
-       <rect>
-        <x>110</x>
-        <y>80</y>
-        <width>82</width>
-        <height>32</height>
-       </rect>
-      </property>
-     </widget>
-     <widget class="QLabel" name="label_nc2">
-      <property name="geometry">
-       <rect>
-        <x>240</x>
-        <y>89</y>
-        <width>70</width>
-        <height>14</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string>通道列数:</string>
-      </property>
-     </widget>
-     <widget class="QLabel" name="label_x2">
-      <property name="geometry">
-       <rect>
-        <x>232</x>
-        <y>89</y>
-        <width>7</width>
-        <height>14</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string>*</string>
-      </property>
-     </widget>
-     <widget class="CustomComboBox" name="comboBox_columnNum">
-      <property name="geometry">
-       <rect>
-        <x>310</x>
-        <y>80</y>
-        <width>82</width>
-        <height>32</height>
-       </rect>
-      </property>
-     </widget>
-     <widget class="QWidget" name="widget_list" native="true">
-      <property name="geometry">
-       <rect>
-        <x>32</x>
-        <y>143</y>
-        <width>724</width>
-        <height>432</height>
-       </rect>
-      </property>
-     </widget>
-     <widget class="QPushButton" name="pBtn_ok">
-      <property name="geometry">
-       <rect>
-        <x>560</x>
-        <y>606</y>
-        <width>90</width>
-        <height>40</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string>保存</string>
-      </property>
-     </widget>
-     <widget class="QPushButton" name="pBtn_cancel">
-      <property name="geometry">
-       <rect>
-        <x>666</x>
-        <y>606</y>
-        <width>90</width>
-        <height>40</height>
-       </rect>
-      </property>
-      <property name="text">
-       <string>取消</string>
-      </property>
-     </widget>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <customwidgets>
-  <customwidget>
-   <class>CustomComboBox</class>
-   <extends>QComboBox</extends>
-   <header location="global">customcombobox.h</header>
-  </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>

+ 4 - 1
EyeMap/SettingNum/settingnum.cpp

@@ -1,4 +1,5 @@
 #include "settingnum.h"
+#include "spdlog.h"
 #include "ui_settingnum.h"
 
 #include <QDebug>
@@ -301,6 +302,7 @@ void SettingNum::do_pBtn_cancel()
 /* 选择行和列槽函数 */
 void SettingNum::do_selectRowAndColumn(int index)
 {
+    // SPDLOG_LOGGER_DEBUG(m_logger, "选择了行和列");
     m_row = ui->comboBox_rowNum->currentText().toInt();
     m_column = ui->comboBox_columnNum->currentText().toInt();
     int num = m_row * m_column;
@@ -316,7 +318,8 @@ void SettingNum::do_selectChannel(const OscChnNum channel, const QString &channe
     {
         if((item->getCurrentChannel().channel == channel) && (item != sender))
         {
-            item->setCurrentChannel(GEyeMapInfo.getChannelName(OscChnNum::Osc_None));
+            // item->setCurrentChannel(GEyeMapInfo.getChannelName(OscChnNum::Osc_None));
+            item->setCurrentChannel(OscChnNum::Osc_None);
         }
     }
 }

+ 18 - 10
EyeMap/main.cpp

@@ -3,6 +3,7 @@
 #include <QApplication>
 #include <QFontDatabase>
 #include <QMessageBox>
+#include <QDebug>
 
 #include "spdlog/spdlog.h"
 #include "logs/loginit.h"
@@ -42,9 +43,9 @@ int main(int argc, char* argv[])
     // }
 #endif
 
-    /* 初始化数据 */
+    /* 初始化眼图组件 */
     GEyeMapInfo.initEyeMapInfo();
-    /* 初始化示波器的数据内存区域 */
+    /* 初始化示波器实例 */
     GOscDataInfo.initOscData();
 
     EyeMapWidget w;
@@ -75,22 +76,29 @@ int main(int argc, char* argv[])
 void addFont(const QString& appPath)
 {
     QString fontPath = appPath + "/Rec/SiYuanBlack_ttf";
+    SPDLOG_DEBUG("font path:{}", fontPath.toStdString());
     /* 加载字体 */
-    QFontDatabase::addApplicationFont(appPath + "/SiYuanBlack_Bold.ttf");
-    QFontDatabase::addApplicationFont(appPath + "/SiYuanBlack_M.ttf");
-    QFontDatabase::addApplicationFont(appPath + "/SiYuanBlack_R.ttf");
+    int id1 = QFontDatabase::addApplicationFont(fontPath + "/SiYuanBlack_Bold.ttf");
+    int id2 = QFontDatabase::addApplicationFont(fontPath + "/SiYuanBlack_M.ttf");
+    int id3 = QFontDatabase::addApplicationFont(fontPath + "/SiYuanBlack_R.ttf");
     /***************************************************
      * 字体使用方式
      * id1 ("思源黑体-粗")
      * id2 ("思源黑体M")
      * id3 ("思源黑体R")
     ****************************************************/
-    //    SPDLOG_LOGGER_DEBUG(m_logger,"id1 = {}",QFontDatabase::applicationFontFamilies(id1));
-    //    qDebug() << "id1" << QFontDatabase::applicationFontFamilies(id1);
-    //    qDebug() << "id2" << QFontDatabase::applicationFontFamilies(id2);
-    //    qDebug() << "id3" << QFontDatabase::applicationFontFamilies(id3);
+    if (id1 == -1 || id2 == -1 || id3 == -1) {
+        SPDLOG_ERROR("Failed to load one or more fonts");
+    } else {
+        // qDebug() << "font id1" << QFontDatabase::applicationFontFamilies(id1);
+        // qDebug() << "font id2" << QFontDatabase::applicationFontFamilies(id2);
+        // qDebug() << "font id3" << QFontDatabase::applicationFontFamilies(id3);
+        SPDLOG_INFO("font id1:{}", QFontDatabase::applicationFontFamilies(id1).at(0).toStdString());
+        SPDLOG_INFO("font id2:{}", QFontDatabase::applicationFontFamilies(id2).at(0).toStdString());
+        SPDLOG_INFO("font id3:{}", QFontDatabase::applicationFontFamilies(id3).at(0).toStdString());
+    }
     QFont font_main;
-   font_main.setFamily("思源黑体R");
+    font_main.setFamily("思源黑体R");
     font_main.setPixelSize(14);
     QApplication::setFont(font_main);
 }