فهرست منبع

V0.2.2
1、修改完成了弹窗基类
2、添加了表格

apple 3 هفته پیش
والد
کامیت
a02ac17f02

+ 21 - 2
SettingLibrary/DialogBase/DialogBase.cpp

@@ -6,6 +6,7 @@
 #include <QPushButton>
 #include <QBoxLayout>
 #include <QStyle>
+#include <qsize.h>
 
 
 #include "OneShadowEffect.h"
@@ -55,16 +56,18 @@ bool DialogBase::setContentWidget(QWidget *widget)
         SPDLOG_LOGGER_ERROR(m_logger, "设置内容容器失败,widget为nullptr");
         return false;
     }
+    if(m_widgetContent == widget)
+    {
+        return true; // 如果已经是这个widget了,就不需要重新设置
+    }
     if(m_widgetContent != nullptr)
     {
         m_layoutBackground->removeWidget(m_widgetContent);
         delete m_widgetContent;
         m_widgetContent = nullptr;
     }
-    QSize size = widget->size();
     m_widgetContent = widget;
     m_layoutBackground->insertWidget(1, m_widgetContent);
-    m_widgetContent->resize(size);
     return true;
 }
 
@@ -88,6 +91,20 @@ bool DialogBase::setBottomWidget(QWidget *widget)
     return true;
 }
 
+/* 移除底栏 */
+bool DialogBase::removeBottomWidget()
+{
+    if(m_widgetBottom == nullptr)
+    {
+        return true;
+    }
+    m_layoutBackground->removeWidget(m_widgetBottom);
+    delete m_widgetBottom;
+    m_widgetBottom = nullptr;
+
+    return true;
+}
+
 /* 初始化UI */
 void DialogBase::initUI()
 {
@@ -139,6 +156,7 @@ void DialogBase::initUI()
 
     /*--------------------- 初始化内容栏 -----------------------*/
     // m_widgetContent = new QWidget(this);
+    // m_widgetContent->resize(400, 300);
     // m_layoutBackground->addWidget(m_widgetContent);
 
     /*--------------------- 初始底栏 -----------------------*/
@@ -275,6 +293,7 @@ void DialogBase::showEvent(QShowEvent *event)
 
     /* 重新布局顶栏 */
     layoutTop();
+    
 }
 
 

+ 9 - 2
SettingLibrary/DialogBase/DialogBase.h

@@ -39,6 +39,13 @@ protected:
     bool setContentWidget(QWidget *widget);
     /* 设置底栏容器 */
     bool setBottomWidget(QWidget *widget);
+    /* 移除底栏 */
+    bool removeBottomWidget();
+
+    /* 获取内容指针 */
+    QWidget* getContentWidget() const { return m_widgetContent; }
+    /* 获取底部容器指针 */
+    QWidget* getBottomWidget() const { return m_widgetBottom; }
 
 protected:
     /* 初始化UI */
@@ -78,6 +85,8 @@ protected:
 
 protected:
     std::shared_ptr<spdlog::logger> m_logger = nullptr;
+    bool m_isOK = false;                        /* 是否点击了确认按钮 */
+private:
     QPoint m_lastPos;                           /* 鼠标点击的位置 */
 
     QWidget* m_widgetBackground = nullptr;      /* 背景容器,这个才是真正容纳所有内容的容器 */
@@ -91,8 +100,6 @@ protected:
     QPushButton* m_pBtn_Close = nullptr;        /* 关闭按钮 */
     QPushButton* m_pBtn_OK = nullptr;           /* 确认按钮 */
     QPushButton* m_pBtn_Cancel = nullptr;       /* 取消按钮 */
-
-    bool m_isOK = false;                        /* 是否点击了确认按钮 */
 };
 
 

+ 128 - 9
SettingLibrary/Modules/Basic/compareitemlistdialog.cpp

@@ -3,40 +3,159 @@
 #include "compareitemdialog.h"
 
 #include "UIStyleManager.h"
+#include <qwidget.h>
+
+
+
+
+
+
+/* 重载比较函数 */
+bool CSortModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
+{
+    // /* 先比较是正常日还是特殊日 */
+    // auto leftDay = sourceModel()->data(left, UserRole_WeekDay).toInt();
+    // auto rightDay = sourceModel()->data(right, UserRole_WeekDay).toInt();
+    // if(leftDay != rightDay)
+    // {
+    //     return leftDay < rightDay; /* 比较周几 */
+    // }
+    // /* 日期类型相等,再比较时间 */
+    // auto leftTime = sourceModel()->data(left, UserRole_Time).toDateTime();
+    // auto rightTime = sourceModel()->data(right, UserRole_Time).toDateTime();
+    // if(leftDay == static_cast<int>(enum_WeekDay::WeekDay_Special))
+    // {
+    //     /* 特殊日,比较日期和时间 */
+    //     return leftTime < rightTime;
+    // }else {
+    //     /* 正常日,只比较时间 */
+    //     return leftTime.time() < rightTime.time();
+    // }
+
+    return true;
+}
+
+
+
+
+
+
+
+
+
 
 CompareItemListDialog::CompareItemListDialog(QWidget *parent) :
     DialogBase(parent),
     ui(new Ui::CompareItemListWidget)
 {
-    QWidget* widgetContent = new QWidget(this);
+    QWidget *widgetContent = new QWidget(this);
     ui->setupUi(widgetContent);
 
     /* 设置内容 */
     setContentWidget(widgetContent);
     
-    /* 设置底栏 */
-    // setBottomWidget(ui->widgetBottom);
+    /* 移除底栏 */
+    removeBottomWidget();
 
     /* 设置标题 */
     setTitle("对比项列表", QSize(120, 18));
     
 
-    // connect(ui->btnClose, &QPushButton::clicked, this, &CompareItemListDialog::close);
-    // connect(ui->btnAdd, &QPushButton::clicked, this, &CompareItemListDialog::OnBtnAddClicked);
-
     UIStyle.registerWidget(widgetContent);
 
-    SPDLOG_LOGGER_DEBUG(m_logger, "ObjectName: {}", this->objectName().toStdString());
+    // SPDLOG_LOGGER_DEBUG(m_logger, "ObjectName: {}", widgetContent->objectName().toStdString());
+    this->resize(1000 + 40, 800 + 40); /* 设置对话框大小,包含阴影的宽度 */
+    
+    /* 连接信号和槽 */
+    connect(ui->pBtn_close, &QPushButton::clicked, this, &CompareItemListDialog::do_pBtn_close_Clicked);
+    connect(ui->pBtn_add, &QPushButton::clicked, this, &CompareItemListDialog::do_pBtn_add_Clicked);
+    connect(ui->pBtn_delete, &QPushButton::clicked, this, &CompareItemListDialog::do_pBtn_delete_Clicked);
+    connect(ui->pBtn_modify, &QPushButton::clicked, this, &CompareItemListDialog::do_pBtn_edit_Clicked);
+
+    /* 初始化表格 */
+    initTable();
 }
 
 CompareItemListDialog::~CompareItemListDialog()
 {
-    UIStyle.unregisterWidget(this);
+    UIStyle.unregisterWidget(getContentWidget());
     delete ui;
 }
 
-void CompareItemListDialog::OnBtnAddClicked()
+/* 点击了关闭按钮 */
+void CompareItemListDialog::do_pBtn_close_Clicked()
+{
+    this->close();
+}
+
+/* 点击了添加按钮 */
+void CompareItemListDialog::do_pBtn_add_Clicked()
 {
     CompareItemDialog dlg;
     dlg.exec();
 }
+
+/* 点击了删除按钮 */
+void CompareItemListDialog::do_pBtn_delete_Clicked()
+{
+
+}
+
+/* 点击了编辑按钮 */
+void CompareItemListDialog::do_pBtn_edit_Clicked()
+{
+
+}
+
+/* 初始化表格 */
+void CompareItemListDialog::initTable()
+{
+    /* 初始化视图模型 */
+    m_model = new QStandardItemModel(this);
+    m_model->setColumnCount(5);
+    /* 设置每一列的标题 */
+    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_model->setHeaderData(4, Qt::Horizontal, "操作");
+    // m_model->clear();
+    // m_sortModel = new CSortModel(this);
+    // m_sortModel->setSourceModel(m_model);
+    // m_sortModel->sort(0, Qt::AscendingOrder); /* 默认升序 */
+    /* 设置排序数据 */
+    // m_sortModel->setSortRole(QtUserRole::UserRole_Time); /* 设置排序角色 */
+    ui->tableView->setModel(m_model);
+
+    // 设置选择模式为整行选择
+    ui->tableView->setSelectionMode(QAbstractItemView::SingleSelection);
+    ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
+    
+    /* 设置每列的高度 */
+    ui->tableView->verticalHeader()->setDefaultSectionSize(48);
+
+    
+    /* 设置横向标题可见 */
+    ui->tableView->horizontalHeader()->setVisible(true);
+    /* 去掉列标题 */
+    ui->tableView->verticalHeader()->setVisible(false);
+    /* 去掉网格线 */
+    ui->tableView->setShowGrid(false);
+    /* 设置单元格不可编辑 */
+    ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
+    /* 禁止显示横向滚动条 */
+    // ui->tableView->horizontalHeader()->setStretchLastSection(true); /* 设置最后一列拉伸 */
+    ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed); /* 设置列宽度固定 */
+
+    /* 设置固定列宽度 */
+    ui->tableView->setColumnWidth(0, 160);  /* 第一列宽度 */
+    ui->tableView->setColumnWidth(1, 160);  /* 第二列宽度 */
+    ui->tableView->setColumnWidth(3, 240);  /* 第三列宽度 */
+    ui->tableView->setColumnWidth(4, 280);  /* 第四列宽度 */
+    ui->tableView->setColumnWidth(5, 96);   /* 第五列宽度 */
+
+
+    
+}
+
+

+ 45 - 3
SettingLibrary/Modules/Basic/compareitemlistdialog.h

@@ -1,9 +1,34 @@
 #ifndef COMPAREITEMLISTDIALOG_H
 #define COMPAREITEMLISTDIALOG_H
 
-#include <QDialog>
+#include <QStandardItemModel>
+#include <QSortFilterProxyModel>
+
 #include "DialogBase.h"
 
+
+
+
+/**
+ * @brief 自定义排序类
+ * 
+ */
+class CSortModel : public QSortFilterProxyModel
+{
+    Q_OBJECT
+public:
+    explicit CSortModel(QObject *parent = nullptr) : QSortFilterProxyModel(parent) {}
+    ~CSortModel() {}
+
+protected:
+    /* 重载比较函数 */
+    bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
+};
+
+
+
+
+
 namespace Ui {
 class CompareItemListWidget;
 }
@@ -14,13 +39,30 @@ class CompareItemListDialog : public DialogBase
 
 public:
     explicit CompareItemListDialog(QWidget *parent = nullptr);
-    ~CompareItemListDialog();
+    ~CompareItemListDialog() override;
 
 private slots:
-    void OnBtnAddClicked();
+    /* 点击了关闭按钮 */
+    void do_pBtn_close_Clicked();
+
+    /* 点击了添加按钮 */
+    void do_pBtn_add_Clicked();
+    /* 点击了删除按钮 */
+    void do_pBtn_delete_Clicked();
+    /* 点击了编辑按钮 */
+    void do_pBtn_edit_Clicked();
+
+private:
+    /* 初始化表格 */
+    void initTable();
 
 private:
     Ui::CompareItemListWidget *ui;
+
+
+    QStandardItemModel* m_model;    /* 表格模型,存储数据 */
+    CSortModel* m_sortModel;        /* 排序模型 */
+
 };
 
 #endif // COMPAREITEMLISTDIALOG_H

+ 0 - 375
SettingLibrary/Modules/Basic/compareitemlistdialog.ui

@@ -1,375 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>CompareItemListDialog</class>
- <widget class="QDialog" name="CompareItemListDialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>856</width>
-    <height>680</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Dialog</string>
-  </property>
-  <property name="styleSheet">
-   <string notr="true">QWidget#widgetBackground
-{
-	background: #FFFFFF;
-	border-radius: 8px;
-}
-QWidget#widgetTop
-{
-	border-bottom: 1px solid #E6E9F4;
-}
-
-QLabel#labelTitle
-{
-	font-weight: 500;
-	font-size: 18px;
-	color: #3A3F63;
-}
-
-QPushButton#btnClose
-{
-	border-image: url(:/close.png);
-}
-QPushButton#btnClose:hover
-{
-	border-image: url(:/close_hover.png);
-}
-QPushButton#btnMod,#btnDel,#btnEnable,#btnDisable
-{
-	background: #FFFFFF;
-	border-radius: 4px;
-	border: 1px solid #E6E9F4;
-	font-weight: 500;
-	font-size: 14px;
-	color: #3A3F63;
-}
-QPushButton#btnMod:hover,#btnDel:hover,#btnEnable:hover,#btnDisable:hover
-{
-	border: 1px solid #4458FE;
-	color: #4458FE;
-}
-QPushButton#btnAdd
-{
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #4F8AFF, stop:1 #4B5EFF);
-	border-radius: 4px;
-	font-weight: 500;
-	font-size: 14px;
-	color: #FFFFFF;
-}
-QPushButton#btnAdd:hover
-{
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #4F8AFF, stop:1 #7182ff);
-}
-
-QTableView
-{
-	border: none;
-	background: transparent;
-	border-bottom: 1px solid #E6E9F4;
-}</string>
-  </property>
-  <layout class="QGridLayout" name="gridLayout">
-   <property name="leftMargin">
-    <number>0</number>
-   </property>
-   <property name="topMargin">
-    <number>0</number>
-   </property>
-   <property name="rightMargin">
-    <number>0</number>
-   </property>
-   <property name="bottomMargin">
-    <number>0</number>
-   </property>
-   <property name="spacing">
-    <number>0</number>
-   </property>
-   <item row="0" column="0">
-    <widget class="QWidget" name="widgetBackground" native="true">
-     <layout class="QVBoxLayout" name="verticalLayout">
-      <property name="spacing">
-       <number>0</number>
-      </property>
-      <property name="leftMargin">
-       <number>0</number>
-      </property>
-      <property name="topMargin">
-       <number>0</number>
-      </property>
-      <property name="rightMargin">
-       <number>0</number>
-      </property>
-      <property name="bottomMargin">
-       <number>0</number>
-      </property>
-      <item>
-       <widget class="QWidget" name="widgetTop" native="true">
-        <property name="minimumSize">
-         <size>
-          <width>0</width>
-          <height>57</height>
-         </size>
-        </property>
-        <property name="maximumSize">
-         <size>
-          <width>16777215</width>
-          <height>57</height>
-         </size>
-        </property>
-        <layout class="QHBoxLayout" name="horizontalLayout_2">
-         <property name="spacing">
-          <number>0</number>
-         </property>
-         <property name="leftMargin">
-          <number>32</number>
-         </property>
-         <property name="topMargin">
-          <number>0</number>
-         </property>
-         <property name="rightMargin">
-          <number>16</number>
-         </property>
-         <property name="bottomMargin">
-          <number>0</number>
-         </property>
-         <item>
-          <widget class="QLabel" name="labelTitle">
-           <property name="text">
-            <string>对比项列表</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QPushButton" name="btnClose">
-           <property name="minimumSize">
-            <size>
-             <width>32</width>
-             <height>32</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>32</width>
-             <height>32</height>
-            </size>
-           </property>
-           <property name="text">
-            <string/>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </widget>
-      </item>
-      <item>
-       <widget class="QWidget" name="widgetContent" native="true">
-        <layout class="QVBoxLayout" name="verticalLayout_2">
-         <property name="spacing">
-          <number>25</number>
-         </property>
-         <property name="leftMargin">
-          <number>32</number>
-         </property>
-         <property name="topMargin">
-          <number>32</number>
-         </property>
-         <property name="rightMargin">
-          <number>32</number>
-         </property>
-         <property name="bottomMargin">
-          <number>32</number>
-         </property>
-         <item>
-          <widget class="QWidget" name="widget" native="true">
-           <layout class="QHBoxLayout" name="horizontalLayout">
-            <property name="spacing">
-             <number>16</number>
-            </property>
-            <property name="leftMargin">
-             <number>0</number>
-            </property>
-            <property name="topMargin">
-             <number>0</number>
-            </property>
-            <property name="rightMargin">
-             <number>0</number>
-            </property>
-            <property name="bottomMargin">
-             <number>0</number>
-            </property>
-            <item>
-             <widget class="QPushButton" name="btnAdd">
-              <property name="minimumSize">
-               <size>
-                <width>60</width>
-                <height>32</height>
-               </size>
-              </property>
-              <property name="maximumSize">
-               <size>
-                <width>60</width>
-                <height>32</height>
-               </size>
-              </property>
-              <property name="text">
-               <string>新增</string>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <widget class="QPushButton" name="btnMod">
-              <property name="minimumSize">
-               <size>
-                <width>60</width>
-                <height>32</height>
-               </size>
-              </property>
-              <property name="maximumSize">
-               <size>
-                <width>60</width>
-                <height>32</height>
-               </size>
-              </property>
-              <property name="text">
-               <string>编辑</string>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <widget class="QPushButton" name="btnDel">
-              <property name="minimumSize">
-               <size>
-                <width>60</width>
-                <height>32</height>
-               </size>
-              </property>
-              <property name="maximumSize">
-               <size>
-                <width>60</width>
-                <height>32</height>
-               </size>
-              </property>
-              <property name="text">
-               <string>删除</string>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <spacer name="horizontalSpacer">
-              <property name="orientation">
-               <enum>Qt::Horizontal</enum>
-              </property>
-              <property name="sizeHint" stdset="0">
-               <size>
-                <width>40</width>
-                <height>20</height>
-               </size>
-              </property>
-             </spacer>
-            </item>
-           </layout>
-          </widget>
-         </item>
-         <item>
-          <widget class="QTableView" name="tableView"/>
-         </item>
-        </layout>
-       </widget>
-      </item>
-      <item>
-       <widget class="QWidget" name="widgetBottom" native="true">
-        <property name="minimumSize">
-         <size>
-          <width>0</width>
-          <height>64</height>
-         </size>
-        </property>
-        <property name="maximumSize">
-         <size>
-          <width>16777215</width>
-          <height>64</height>
-         </size>
-        </property>
-        <layout class="QHBoxLayout" name="horizontalLayout_3">
-         <property name="spacing">
-          <number>16</number>
-         </property>
-         <property name="leftMargin">
-          <number>32</number>
-         </property>
-         <property name="topMargin">
-          <number>0</number>
-         </property>
-         <property name="rightMargin">
-          <number>32</number>
-         </property>
-         <property name="bottomMargin">
-          <number>32</number>
-         </property>
-         <item>
-          <widget class="QPushButton" name="btnEnable">
-           <property name="minimumSize">
-            <size>
-             <width>102</width>
-             <height>32</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>102</width>
-             <height>32</height>
-            </size>
-           </property>
-           <property name="text">
-            <string>启用对比项</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QPushButton" name="btnDisable">
-           <property name="minimumSize">
-            <size>
-             <width>102</width>
-             <height>32</height>
-            </size>
-           </property>
-           <property name="maximumSize">
-            <size>
-             <width>102</width>
-             <height>32</height>
-            </size>
-           </property>
-           <property name="text">
-            <string>禁用对比项</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <spacer name="horizontalSpacer_2">
-           <property name="orientation">
-            <enum>Qt::Horizontal</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>40</width>
-             <height>20</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-        </layout>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>

+ 230 - 219
SettingLibrary/Modules/Basic/compareitemlistwidget.ui

@@ -6,243 +6,254 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>864</width>
-    <height>598</height>
+    <width>800</width>
+    <height>600</height>
    </rect>
   </property>
+  <property name="minimumSize">
+   <size>
+    <width>0</width>
+    <height>0</height>
+   </size>
+  </property>
   <property name="windowTitle">
    <string>Form</string>
   </property>
-  <widget class="QWidget" name="widgetBottom" native="true">
-   <property name="geometry">
-    <rect>
-     <x>11</x>
-     <y>405</y>
-     <width>581</width>
-     <height>64</height>
-    </rect>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="spacing">
+    <number>0</number>
    </property>
-   <property name="minimumSize">
-    <size>
-     <width>0</width>
-     <height>64</height>
-    </size>
+   <property name="leftMargin">
+    <number>0</number>
    </property>
-   <property name="maximumSize">
-    <size>
-     <width>16777215</width>
-     <height>64</height>
-    </size>
+   <property name="topMargin">
+    <number>0</number>
    </property>
-   <layout class="QHBoxLayout" name="horizontalLayout_3">
-    <property name="spacing">
-     <number>16</number>
-    </property>
-    <property name="leftMargin">
-     <number>32</number>
-    </property>
-    <property name="topMargin">
-     <number>0</number>
-    </property>
-    <property name="rightMargin">
-     <number>32</number>
-    </property>
-    <property name="bottomMargin">
-     <number>32</number>
-    </property>
-    <item>
-     <widget class="QPushButton" name="pBtn_enableCPItem">
-      <property name="minimumSize">
-       <size>
-        <width>102</width>
-        <height>32</height>
-       </size>
-      </property>
-      <property name="maximumSize">
-       <size>
-        <width>102</width>
-        <height>32</height>
-       </size>
-      </property>
-      <property name="text">
-       <string>启用对比项</string>
-      </property>
-     </widget>
-    </item>
-    <item>
-     <widget class="QPushButton" name="pBtn_disableCPItem">
-      <property name="minimumSize">
-       <size>
-        <width>102</width>
-        <height>32</height>
-       </size>
-      </property>
-      <property name="maximumSize">
-       <size>
-        <width>102</width>
-        <height>32</height>
-       </size>
-      </property>
-      <property name="text">
-       <string>禁用对比项</string>
-      </property>
-     </widget>
-    </item>
-    <item>
-     <spacer name="horizontalSpacer_2">
-      <property name="orientation">
-       <enum>Qt::Horizontal</enum>
+   <property name="rightMargin">
+    <number>0</number>
+   </property>
+   <property name="bottomMargin">
+    <number>0</number>
+   </property>
+   <item>
+    <widget class="QWidget" name="widgetContent" native="true">
+     <layout class="QVBoxLayout" name="verticalLayout_2">
+      <property name="spacing">
+       <number>25</number>
       </property>
-      <property name="sizeHint" stdset="0">
-       <size>
-        <width>40</width>
-        <height>20</height>
-       </size>
+      <property name="leftMargin">
+       <number>32</number>
       </property>
-     </spacer>
-    </item>
-    <item>
-     <widget class="QPushButton" name="pBtn_close">
-      <property name="minimumSize">
-       <size>
-        <width>60</width>
-        <height>32</height>
-       </size>
+      <property name="topMargin">
+       <number>32</number>
       </property>
-      <property name="maximumSize">
-       <size>
-        <width>102</width>
-        <height>32</height>
-       </size>
+      <property name="rightMargin">
+       <number>32</number>
       </property>
-      <property name="text">
-       <string>关闭</string>
+      <property name="bottomMargin">
+       <number>32</number>
       </property>
-     </widget>
-    </item>
-   </layout>
-  </widget>
-  <widget class="QWidget" name="widgetContent" native="true">
-   <property name="geometry">
-    <rect>
-     <x>11</x>
-     <y>11</y>
-     <width>671</width>
-     <height>361</height>
-    </rect>
-   </property>
-   <layout class="QVBoxLayout" name="verticalLayout_2">
-    <property name="spacing">
-     <number>25</number>
-    </property>
-    <property name="leftMargin">
-     <number>32</number>
-    </property>
-    <property name="topMargin">
-     <number>32</number>
-    </property>
-    <property name="rightMargin">
-     <number>32</number>
-    </property>
-    <property name="bottomMargin">
-     <number>32</number>
-    </property>
-    <item>
-     <widget class="QWidget" name="widget" native="true">
-      <layout class="QHBoxLayout" name="horizontalLayout">
-       <property name="spacing">
-        <number>16</number>
-       </property>
-       <property name="leftMargin">
-        <number>0</number>
-       </property>
-       <property name="topMargin">
-        <number>0</number>
-       </property>
-       <property name="rightMargin">
-        <number>0</number>
-       </property>
-       <property name="bottomMargin">
-        <number>0</number>
-       </property>
-       <item>
-        <widget class="QPushButton" name="pBtn_add">
-         <property name="minimumSize">
-          <size>
-           <width>82</width>
-           <height>32</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>60</width>
-           <height>32</height>
-          </size>
+      <item>
+       <widget class="QWidget" name="widget" native="true">
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <property name="spacing">
+          <number>16</number>
          </property>
-         <property name="text">
-          <string>+ 新增</string>
+         <property name="leftMargin">
+          <number>0</number>
          </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="QPushButton" name="pBtn_modify">
-         <property name="minimumSize">
-          <size>
-           <width>60</width>
-           <height>32</height>
-          </size>
+         <property name="topMargin">
+          <number>0</number>
          </property>
-         <property name="maximumSize">
-          <size>
-           <width>60</width>
-           <height>32</height>
-          </size>
+         <property name="rightMargin">
+          <number>0</number>
          </property>
-         <property name="text">
-          <string>编辑</string>
+         <property name="bottomMargin">
+          <number>0</number>
          </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="QPushButton" name="pBtn_delete">
-         <property name="minimumSize">
-          <size>
-           <width>60</width>
-           <height>32</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>60</width>
-           <height>32</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>删除</string>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <spacer name="horizontalSpacer">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>40</width>
-           <height>20</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-      </layout>
-     </widget>
-    </item>
-    <item>
-     <widget class="QTableView" name="tableView"/>
-    </item>
-   </layout>
-  </widget>
+         <item>
+          <widget class="QPushButton" name="pBtn_add">
+           <property name="minimumSize">
+            <size>
+             <width>82</width>
+             <height>32</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>60</width>
+             <height>32</height>
+            </size>
+           </property>
+           <property name="text">
+            <string>+ 新增</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="pBtn_modify">
+           <property name="minimumSize">
+            <size>
+             <width>60</width>
+             <height>32</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>60</width>
+             <height>32</height>
+            </size>
+           </property>
+           <property name="text">
+            <string>编辑</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="pBtn_delete">
+           <property name="minimumSize">
+            <size>
+             <width>60</width>
+             <height>32</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>60</width>
+             <height>32</height>
+            </size>
+           </property>
+           <property name="text">
+            <string>删除</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </widget>
+      </item>
+      <item>
+       <widget class="QTableView" name="tableView"/>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QWidget" name="widgetBottom" native="true">
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>64</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>16777215</width>
+       <height>64</height>
+      </size>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout_3">
+      <property name="spacing">
+       <number>16</number>
+      </property>
+      <property name="leftMargin">
+       <number>32</number>
+      </property>
+      <property name="topMargin">
+       <number>0</number>
+      </property>
+      <property name="rightMargin">
+       <number>32</number>
+      </property>
+      <property name="bottomMargin">
+       <number>32</number>
+      </property>
+      <item>
+       <widget class="QPushButton" name="pBtn_enableCPItem">
+        <property name="minimumSize">
+         <size>
+          <width>102</width>
+          <height>32</height>
+         </size>
+        </property>
+        <property name="maximumSize">
+         <size>
+          <width>102</width>
+          <height>32</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>启用对比项</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="pBtn_disableCPItem">
+        <property name="minimumSize">
+         <size>
+          <width>102</width>
+          <height>32</height>
+         </size>
+        </property>
+        <property name="maximumSize">
+         <size>
+          <width>102</width>
+          <height>32</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>禁用对比项</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <spacer name="horizontalSpacer_2">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>40</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item>
+       <widget class="QPushButton" name="pBtn_close">
+        <property name="minimumSize">
+         <size>
+          <width>60</width>
+          <height>32</height>
+         </size>
+        </property>
+        <property name="maximumSize">
+         <size>
+          <width>102</width>
+          <height>32</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>关闭</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
  </widget>
  <resources/>
  <connections/>

+ 34 - 4
SettingLibrary/Resources/qss/white/compareitemlistwidget.qss

@@ -102,9 +102,39 @@ QPushButton#pBtn_add:hover
  *  QTableView
  * ========================================================== */
 
+
 QTableView
 {
-	border: none;
-	background: transparent;
-	border-bottom: 1px solid #E6E9F4;
-}
+    background: transparent;
+    font-weight: 400;
+    font-size: 14px;
+    color: #3A3F63;
+    line-height: 22px;
+    text-align: left;
+    font-style: normal;
+    text-transform: none;
+
+    /* background: #4458FE; */
+    border: 0px solid rgba(255, 255, 255, 0.1);
+    outline: none;
+}
+
+QTableView::item
+{
+    font-weight: 400;
+    font-size: 14px;
+    color: #3A3F63;
+    background: transparent;
+
+    border: none;
+    padding-left: 12px;
+    outline: none;
+}
+
+QTableView::item:selected
+{
+    color: #FFFFFF;
+    background: #4458FE;
+    border-radius: 0px 0px 0px 0px;
+    outline: none;
+}

+ 10 - 8
show1/main.cpp

@@ -4,6 +4,7 @@
 #include <QFontDatabase>
 #include <qapplication.h>
 #include <qchar.h>
+#include <QDebug>
 
 
 #include "spdlog/spdlog.h"
@@ -15,6 +16,7 @@ int main(int argc, char *argv[])
 {
     QApplication a(argc, argv);
 
+
     /* 从文件加载字体 */
     addFont();
 
@@ -35,21 +37,21 @@ void addFont()
 {
     QString fontPath = QApplication::applicationDirPath() + "/font/SiYuanBlack_ttf";
     /* 加载字体 */
-    QFontDatabase::addApplicationFont(fontPath + "/SiYuanBlack_Bold.ttf)");
-    QFontDatabase::addApplicationFont(fontPath + "/SiYuanBlack_M.ttf)");
-    QFontDatabase::addApplicationFont(fontPath + "/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);
+       SPDLOG_INFO("{}", fontPath.toStdString());
+       qDebug() << "id1" << QFontDatabase::applicationFontFamilies(id1);
+       qDebug() << "id2" << QFontDatabase::applicationFontFamilies(id2);
+       qDebug() << "id3" << QFontDatabase::applicationFontFamilies(id3);
     QFont font_main;
-   font_main.setFamily("思源黑体R");
+    font_main.setFamily("思源黑体R");
     font_main.setPixelSize(14);
     QApplication::setFont(font_main);
 }