chenyuanjie 1 год назад
Родитель
Сommit
927b23b7be

BIN
Qt/Qt_Test_Pro_5inch/Output/Qt_Test


+ 1 - 1
Qt/Qt_Test_Pro_5inch/Qt_Test.pro.user

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.5.2, 2025-03-21T21:03:43. -->
+<!-- Written by QtCreator 4.5.2, 2025-03-23T00:37:09. -->
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>

+ 26 - 2
Qt/Qt_Test_Pro_5inch/ch_widget.cpp

@@ -1,6 +1,8 @@
 #include "ch_widget.h"
 #include "ui_ch_widget.h"
 
+#define RunStatus "#ch_Widget{border: 2px solid #00FF00;background-color: #FFFFFF;border-radius: 15px;}QLabel { color: #00FF00; }"
+#define StopStatus "#ch_Widget{border: 2px solid #0000FF;background-color: #FFFFFF;border-radius: 15px;}QLabel { color: #0000FF; }"
 ch_Widget::ch_Widget(QWidget *parent) :
     QWidget(parent),
     ui(new Ui::ch_Widget),
@@ -32,7 +34,29 @@ void ch_Widget::UpdateData()
        ui->label_CH->setText("CH"+QString::number(m_nIndex));
        ui->label_V->setText(QString::number(m_pCHData->voltage, 'f', 2));
        ui->label_I->setText(QString::number(m_pCHData->current, 'f', 2));
-       ui->label_P->setText(QString::number(0.00));
-       ui->label_W->setText(QString::number(m_pCHData->power, 'f', 2));
+       ui->label_P->setText(QString::number(m_pCHData->power,'f', 2));
+       ui->label_W->setText(QString::number(m_pCHData->consumption, 'f', 2));
+       if(m_pCHData->status!=nStatus)
+       {
+           nStatus=m_pCHData->status;
+          if(nStatus==1)
+          {
+                this->setStyleSheet(RunStatus);
+          }else
+          {
+                this->setStyleSheet(StopStatus);
+          }
+       }
    }
 }
+
+bool ch_Widget::event(QEvent *event)
+{
+    if (event->type() == QEvent::TouchBegin ||
+        event->type() == QEvent::TouchUpdate ||
+        event->type() == QEvent::TouchEnd) {
+        // 不处理触摸事件,交给父级(QScrollArea 的视口)处理
+        return false;
+    }
+    return QWidget::event(event);
+}

+ 4 - 0
Qt/Qt_Test_Pro_5inch/ch_widget.h

@@ -18,11 +18,15 @@ public:
     void setDataCHP(int nIndex,PowerInfo* pdata);
 
     void UpdateData();
+
+protected:
+    bool event(QEvent *event);
 private:
     Ui::ch_Widget *ui;
 
     int m_nIndex;
     PowerInfo* m_pCHData;
+    int nStatus=0;
 };
 
 #endif // CH_WIDGET_H

+ 5 - 2
Qt/Qt_Test_Pro_5inch/ch_widget.ui

@@ -13,6 +13,9 @@
   <property name="windowTitle">
    <string>Form</string>
   </property>
+  <property name="styleSheet">
+   <string notr="true">#ch_Widget{border: 2px solid #0000FF;background-color: #FFFFFF;border-radius: 15px;}QLabel { color: #0000FF; }</string>
+  </property>
   <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
    <item>
     <widget class="QLabel" name="label_CH">
@@ -36,7 +39,7 @@
      <item row="1" column="0">
       <widget class="QLabel" name="label_6">
        <property name="text">
-        <string>p:</string>
+        <string>P:</string>
        </property>
       </widget>
      </item>
@@ -78,7 +81,7 @@
      <item row="1" column="3">
       <widget class="QLabel" name="label_9">
        <property name="text">
-        <string>W:</string>
+        <string>Sum:</string>
        </property>
       </widget>
      </item>

+ 2 - 1
Qt/Qt_Test_Pro_5inch/dataupdatethread.cpp

@@ -107,6 +107,7 @@ void DataUpdateThread::run()
                     pwidget->setCH(nSubPag);
                     pwidget->SetT(strT);
                     pwidget->SetH(strH);
+
                     pwidget->update();
                     //qDebug() <<"V:"<<strV<<";A"<<strA<<";W:"<<strW;
                 }
@@ -127,7 +128,7 @@ void DataUpdateThread::run()
             nTimeindex++;
         }else
         {
-            if(pMainWidget)
+            if(pMainWidget&&m_shmData)
             {
                 strT = QString::number(m_shmData->fT,'f',2);
                 strH = QString::number(m_shmData->fH,'f',2);

+ 20 - 8
Qt/Qt_Test_Pro_5inch/homewidget.cpp

@@ -21,12 +21,22 @@ void HomeWidget::InitUI()
     connect(ui->pushButton_3,SIGNAL(clicked()),this,SLOT(slot_Setting()));
     connect(ui->pushButton_4,SIGNAL(clicked()),this,SLOT(slot_RunLog()));
     //connect(ui->pushButton_5,SIGNAL(clicked()),this,SLOT(slot_Info()));
-    QString strPath=QCoreApplication::applicationDirPath() + QDir::separator()+"image" + QDir::separator();
-    ui->pushButton->setIcon(QIcon(QPixmap(strPath+"RunMSG.png")));
-    ui->pushButton_2->setIcon(QIcon(QPixmap(strPath+"WarningMSG.png")));
-    ui->pushButton_3->setIcon(QIcon(QPixmap(strPath+"Setting.png")));
-    ui->pushButton_4->setIcon(QIcon(QPixmap(strPath+"RunLog.png")));
-    ui->label_2->setPixmap(QPixmap(strPath+"EqpmtLogo.png"));
+    QString strPath=QCoreApplication::applicationDirPath() + QDir::separator()+"image_qt" + QDir::separator();
+    QImage rgbImage=QImage(strPath+"RunMSG.png");
+    QImage bgrImage = rgbImage.rgbSwapped();
+    ui->pushButton->setIcon(QIcon(QPixmap::fromImage(bgrImage)));
+    rgbImage=QImage(strPath+"WarningMSG.png");
+    bgrImage = rgbImage.rgbSwapped();
+    ui->pushButton_2->setIcon(QIcon(QPixmap::fromImage(bgrImage)));
+    rgbImage=QImage(strPath+"Setting.png");
+    bgrImage = rgbImage.rgbSwapped();
+    ui->pushButton_3->setIcon(QIcon(QPixmap::fromImage(bgrImage)));
+    rgbImage=QImage(strPath+"RunLog.png");
+    bgrImage = rgbImage.rgbSwapped();
+    ui->pushButton_4->setIcon(QIcon(QPixmap::fromImage(bgrImage)));
+    rgbImage=QImage(strPath+"EqpmtLogo.png");
+    bgrImage = rgbImage.rgbSwapped();
+    ui->label_2->setPixmap(QPixmap::fromImage(bgrImage));
 
 
 }
@@ -44,10 +54,12 @@ void HomeWidget::UpdateCHData()
         QString strP=QString::number(pAllChData[0]._globalPowerInManger._PowerInfo[0].voltage,'f',2);
         //if(pAllChData[0].product_type>=0&&pAllChData[0].product_type<)
         //QString strType= pAllChData->product_type==?
+        //qDebug()<<"V="<<strV<<"A="<<strA<<"W="<<strW;
+
         ui->label_8->setText(strV+"V");
-        ui->label_9->setText(strA="A");
+        ui->label_9->setText(strA+"A");
         ui->label_10->setText(strW+"kW");
-        //ui->label_7->setText(strP+"KW/h");
+        ui->label_7->setText("");
     }
 }
 

+ 4 - 4
Qt/Qt_Test_Pro_5inch/homewidget.ui

@@ -89,7 +89,7 @@
           </font>
          </property>
          <property name="text">
-          <string>TextLabel</string>
+          <string/>
          </property>
         </widget>
        </item>
@@ -113,7 +113,7 @@
           </font>
          </property>
          <property name="text">
-          <string>TextLabel</string>
+          <string/>
          </property>
         </widget>
        </item>
@@ -125,7 +125,7 @@
           </font>
          </property>
          <property name="text">
-          <string>TextLabel</string>
+          <string/>
          </property>
         </widget>
        </item>
@@ -150,7 +150,7 @@
           </font>
          </property>
          <property name="text">
-          <string>TextLabel</string>
+          <string/>
          </property>
         </widget>
        </item>

+ 3 - 0
Qt/Qt_Test_Pro_5inch/main.cpp

@@ -10,6 +10,8 @@
 int main(int argc, char *argv[])
 {
     QApplication a(argc, argv);
+    QApplication::setOverrideCursor(Qt::BlankCursor);
+
     //窗口初始化
     pdu_Ctrl::instance();
     Widget w;
@@ -51,6 +53,7 @@ int main(int argc, char *argv[])
     //数据更新线程
     DataUpdateThread thread_Update(nullptr);
     thread_Update.pwidget=&w;
+    thread_Update.pMainWidget=&ShowW;
     //QString appDirPath = QCoreApplication::applicationDirPath();
     //thread_Update.strSqliteAddress=appDirPath+"/pdu_dat.db";
     thread_Update.initShm();

+ 27 - 11
Qt/Qt_Test_Pro_5inch/mainwidget.cpp

@@ -23,13 +23,25 @@ MainWidget::~MainWidget()
 void MainWidget::InitWidget()
 {
     //图片设置
-    QString strPath=QCoreApplication::applicationDirPath() + QDir::separator()+"image" + QDir::separator();
-    ui->toolButton->setIcon(QIcon(QPixmap(strPath+"Home.png")));
-    ui->label_5->setPixmap(QPixmap(strPath+"T.png"));
-    ui->label_6->setPixmap(QPixmap(strPath+"humidity.png"));
-    ui->label_12->setPixmap(QPixmap(strPath+"error.png"));
-    ui->label_10->setPixmap(QPixmap(strPath+"warning-fill.png"));
-    ui->label_14->setPixmap(QPixmap(strPath+"log.png"));
+    QString strPath=QCoreApplication::applicationDirPath() + QDir::separator()+"image_qt" + QDir::separator();
+    QImage rgbImage=QImage(strPath+"Home.png");
+    QImage bgrImage = rgbImage.rgbSwapped();
+    ui->toolButton->setIcon(QIcon(QPixmap::fromImage(bgrImage)));
+    rgbImage=QImage(strPath+"T.png");
+    bgrImage = rgbImage.rgbSwapped();
+    ui->label_5->setPixmap(QPixmap::fromImage(bgrImage));
+    rgbImage=QImage(strPath+"humidity.png");
+    bgrImage = rgbImage.rgbSwapped();
+    ui->label_6->setPixmap(QPixmap::fromImage(bgrImage));
+    rgbImage=QImage(strPath+"error.png");
+    bgrImage = rgbImage.rgbSwapped();
+    ui->label_12->setPixmap(QPixmap::fromImage(bgrImage));
+    rgbImage=QImage(strPath+"warning-fill.png");
+    bgrImage = rgbImage.rgbSwapped();
+    ui->label_10->setPixmap(QPixmap::fromImage(bgrImage));
+    rgbImage=QImage(strPath+"log.png");
+    bgrImage = rgbImage.rgbSwapped();
+    ui->label_14->setPixmap(QPixmap::fromImage(bgrImage));
 
     m_pTimer=new QTimer(this);
     connect(m_pTimer,SIGNAL(timeout()),this,SLOT(slot_TimerUpdate()));
@@ -108,6 +120,13 @@ void MainWidget::slot_BtnDown()
 void MainWidget::slot_SwitchWnd(int nIndex)
 {
     ui->stackedWidget->setCurrentIndex(nIndex);
+    if(m_pThreshold&&ui->stackedWidget->currentWidget()==m_pThreshold)
+    {
+        m_pThreshold->ReadSqlData();
+    }else if(m_pLogWidget&&ui->stackedWidget->currentWidget()==m_pLogWidget)
+    {
+        m_pLogWidget->UpdateLog();
+    }
     slot_UpdateData();
 }
 
@@ -125,8 +144,5 @@ void MainWidget::slot_UpdateData()
     {
         m_pThreshold->UpdateTreshold();
     }
-    else if(m_pLogWidget&&ui->stackedWidget->currentWidget()==m_pLogWidget)
-    {
-        m_pLogWidget->UpdateLog();
-    }
+
 }

+ 51 - 8
Qt/Qt_Test_Pro_5inch/mainwidget.ui

@@ -31,7 +31,7 @@
    </property>
    <item>
     <widget class="QWidget" name="widget_2" native="true">
-     <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,5,2">
+     <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1,5,2">
       <property name="spacing">
        <number>5</number>
       </property>
@@ -49,6 +49,18 @@
       </property>
       <item>
        <widget class="QToolButton" name="toolButton">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>50</width>
+          <height>50</height>
+         </size>
+        </property>
         <property name="text">
          <string/>
         </property>
@@ -58,8 +70,8 @@
         </property>
         <property name="iconSize">
          <size>
-          <width>32</width>
-          <height>32</height>
+          <width>40</width>
+          <height>40</height>
          </size>
         </property>
         <property name="autoRaise">
@@ -106,6 +118,8 @@
            <font>
             <family>微软雅黑</family>
             <pointsize>10</pointsize>
+            <weight>75</weight>
+            <bold>true</bold>
            </font>
           </property>
           <property name="text">
@@ -119,6 +133,8 @@
            <font>
             <family>微软雅黑</family>
             <pointsize>10</pointsize>
+            <weight>75</weight>
+            <bold>true</bold>
            </font>
           </property>
           <property name="text">
@@ -167,15 +183,21 @@
         <property name="font">
          <font>
           <family>微软雅黑</family>
+          <pointsize>14</pointsize>
          </font>
         </property>
         <property name="text">
-         <string>25</string>
+         <string>--</string>
         </property>
        </widget>
       </item>
       <item>
        <widget class="QLabel" name="label_8">
+        <property name="font">
+         <font>
+          <pointsize>14</pointsize>
+         </font>
+        </property>
         <property name="text">
          <string>C°</string>
         </property>
@@ -183,6 +205,18 @@
       </item>
       <item>
        <widget class="QLabel" name="label_6">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>0</height>
+         </size>
+        </property>
         <property name="text">
          <string/>
         </property>
@@ -196,15 +230,21 @@
         <property name="font">
          <font>
           <family>微软雅黑</family>
+          <pointsize>14</pointsize>
          </font>
         </property>
         <property name="text">
-         <string>50</string>
+         <string>--</string>
         </property>
        </widget>
       </item>
       <item>
        <widget class="QLabel" name="label_9">
+        <property name="font">
+         <font>
+          <pointsize>14</pointsize>
+         </font>
+        </property>
         <property name="text">
          <string>%</string>
         </property>
@@ -238,10 +278,11 @@
         <property name="font">
          <font>
           <family>微软雅黑</family>
+          <pointsize>14</pointsize>
          </font>
         </property>
         <property name="text">
-         <string>001</string>
+         <string>000</string>
         </property>
        </widget>
       </item>
@@ -260,10 +301,11 @@
         <property name="font">
          <font>
           <family>微软雅黑</family>
+          <pointsize>14</pointsize>
          </font>
         </property>
         <property name="text">
-         <string>001</string>
+         <string>000</string>
         </property>
        </widget>
       </item>
@@ -282,10 +324,11 @@
         <property name="font">
          <font>
           <family>微软雅黑</family>
+          <pointsize>14</pointsize>
          </font>
         </property>
         <property name="text">
-         <string>001</string>
+         <string>000</string>
         </property>
        </widget>
       </item>

+ 26 - 1
Qt/Qt_Test_Pro_5inch/runchwiget.cpp

@@ -1,6 +1,7 @@
 #include "runchwiget.h"
 #include "ui_runchwiget.h"
 #include "pdu_ctrl.h"
+#include <QScroller>
 RunChWiget::RunChWiget(QWidget *parent) :
     QWidget(parent),
     ui(new Ui::RunChWiget),
@@ -49,8 +50,8 @@ void RunChWiget::UpdateAllCh()
         {
             var->UpdateData();
         }
-
     }
+    update();
 }
 
 void RunChWiget::ClearCH()
@@ -74,3 +75,27 @@ void RunChWiget::AddWidget(ch_Widget *pCHWidget)
     m_vecChWidget.push_back(pCHWidget);
 
 }
+
+void RunChWiget::initScrollArea()
+{
+    // 启用触控手势
+    QScroller::grabGesture(ui->scrollArea->viewport(), QScroller::TouchGesture);
+
+    // 获取滚动控制器
+    QScroller* scroller = QScroller::scroller(ui->scrollArea);
+
+    // 配置滚动参数
+    QScrollerProperties prop = scroller->scrollerProperties();
+
+    // 设置滚动摩擦系数(值越小惯性越长)
+    prop.setScrollMetric(QScrollerProperties::DragVelocitySmoothingFactor, 0.6);
+    prop.setScrollMetric(QScrollerProperties::MinimumVelocity, 0.0);
+    prop.setScrollMetric(QScrollerProperties::MaximumVelocity, 0.5);
+    prop.setScrollMetric(QScrollerProperties::SnapPositionRatio, 0.2);
+    prop.setScrollMetric(QScrollerProperties::DragStartDistance, 0.001);
+
+    scroller->setScrollerProperties(prop);
+
+    // 设置视口必须接受触摸事件
+    ui->scrollArea->viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
+}

+ 2 - 0
Qt/Qt_Test_Pro_5inch/runchwiget.h

@@ -22,6 +22,8 @@ public:
     void ClearCH();
 
     void AddWidget(ch_Widget* pCHWidget);
+
+    void initScrollArea();
 private:
     Ui::RunChWiget *ui;
     int SaveIndex=0;

+ 7 - 3
Qt/Qt_Test_Pro_5inch/runchwiget.ui

@@ -24,11 +24,15 @@
        <rect>
         <x>0</x>
         <y>0</y>
-        <width>460</width>
-        <height>252</height>
+        <width>456</width>
+        <height>248</height>
        </rect>
       </property>
-      <layout class="QGridLayout" name="gridLayout"/>
+      <layout class="QGridLayout" name="gridLayout">
+       <property name="horizontalSpacing">
+        <number>7</number>
+       </property>
+      </layout>
      </widget>
     </widget>
    </item>

+ 6 - 0
Qt/Qt_Test_Pro_5inch/runlogwidget.cpp

@@ -1,6 +1,7 @@
 #include "runlogwidget.h"
 #include "ui_runlogwidget.h"
 #include "pdu_ctrl.h"
+#include <QScroller>
 RunLogWidget::RunLogWidget(QWidget *parent) :
     QWidget(parent),
     ui(new Ui::RunLogWidget)
@@ -33,6 +34,11 @@ void RunLogWidget::InitUI()
     //ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
     ui->tableWidget->verticalHeader()->setVisible(false);
     ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
+    QScroller::grabGesture(ui->tableWidget->viewport(), QScroller::TouchGesture);
+    QScrollerProperties properties = QScroller::scroller(ui->tableWidget)->scrollerProperties();
+    properties.setScrollMetric(QScrollerProperties::DragVelocitySmoothingFactor, 0.6); // 惯性系数
+    properties.setScrollMetric(QScrollerProperties::SnapPositionRatio, 0.2); // 弹性效果
+    ui->tableWidget->viewport()->setAttribute(Qt::WA_AcceptTouchEvents); // 启用触控事件
 }
 
 void RunLogWidget::AddRowData(int nIndex, int nType, QString nTime, QString strMSG)

+ 19 - 9
Qt/Qt_Test_Pro_5inch/thresholdlistwidget.cpp

@@ -1,6 +1,7 @@
 #include "thresholdlistwidget.h"
 #include "ui_thresholdlistwidget.h"
 #include "pdu_ctrl.h"
+#include <QScroller>
 ThresholdListWidget::ThresholdListWidget(QWidget *parent) :
     QWidget(parent),
     ui(new Ui::ThresholdListWidget)
@@ -16,7 +17,7 @@ ThresholdListWidget::~ThresholdListWidget()
 
 void ThresholdListWidget::UpdateTreshold()
 {
-    ReadSqlData();
+    //ReadSqlData();
     updateTablewidget();
 }
 
@@ -63,6 +64,7 @@ void ThresholdListWidget::updateTablewidget()
     // 初始化表格内容
     auto overMG=pdu_Ctrl::instance()->getOverMG();
     for(auto iters= overMG.begin(); iters!= overMG.end(); iters++) {
+        if(iters== overMG.begin()) continue;
         for(auto iter=iters.value().begin();iter!=iters.value().end();iter++)
         {
             // 初始化阈值列(带两位小数格式)
@@ -70,11 +72,9 @@ void ThresholdListWidget::updateTablewidget()
             auto pWarningData=pdu_Ctrl::instance()->getWarningData(iter.value().nAddrID,iter.value().nAddrCHID);
             if (pWarningData)
             {
-               checkThresholds(nRow,pWarningData);
+               checkThresholds(nRow+1,pWarningData);
             }
-
         }
-
     }
 }
 
@@ -84,6 +84,11 @@ void ThresholdListWidget::InitUI()
                                   "电流上限(A)", "功率上限(W)", "电量上限(Wh)"};
     ui->tableWidget->setColumnCount(6);
     ui->tableWidget->setHorizontalHeaderLabels(headers);
+    QScroller::grabGesture(ui->tableWidget->viewport(), QScroller::TouchGesture);
+    QScrollerProperties properties = QScroller::scroller(ui->tableWidget)->scrollerProperties();
+    properties.setScrollMetric(QScrollerProperties::DragVelocitySmoothingFactor, 0.6); // 惯性系数
+    properties.setScrollMetric(QScrollerProperties::SnapPositionRatio, 0.2); // 弹性效果
+    ui->tableWidget->viewport()->setAttribute(Qt::WA_AcceptTouchEvents); // 启用触控事件
     // 设置自动调整列宽
     ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
     ui->tableWidget->verticalHeader()->setVisible(false);
@@ -100,6 +105,11 @@ int ThresholdListWidget::AddRowData(int nChID,QString strName,GlobalOverManager*
     ui->tableWidget->setItem(nMaxRow, 0, channelItem);
 
     // 初始化阈值列
+    /*if(pData->product_vol_upper_threshold!=0
+            ||pData->product_vol_lower_threshold!=0
+            ||pData->product_cur_upper_threshold!=0
+            ||pData->product_pwr_upper_threshold!=0
+            ||pData->product_pwrcon_upper_threshold!=0){qDebug()<<"HaveData "<< nMaxRow;   }*/
     ui->tableWidget->setItem(nMaxRow, 1, new QTableWidgetItem(QString::number(pData->product_vol_upper_threshold,'f',2)));
     ui->tableWidget->setItem(nMaxRow, 2, new QTableWidgetItem(QString::number(pData->product_vol_lower_threshold,'f',2)));
     ui->tableWidget->setItem(nMaxRow, 3, new QTableWidgetItem(QString::number(pData->product_cur_upper_threshold,'f',2)));
@@ -126,10 +136,10 @@ void ThresholdListWidget::checkThresholds(int nRow,PowerWarningInfo* pWarning) {
     }
     // 电压检测
     if(pWarning->w_voltage_up) {
-        color = Qt::red;
+        color = Qt::blue;//
         ui->tableWidget->item(nRow,1)->setForeground(color);
     } else if(pWarning->w_voltage_down) {
-        color = Qt::red;
+        color = Qt::blue;
         ui->tableWidget->item(nRow,2)->setForeground(color);
     }else
     {
@@ -140,7 +150,7 @@ void ThresholdListWidget::checkThresholds(int nRow,PowerWarningInfo* pWarning) {
 
     // 电流检测
     if(pWarning->w_current) {
-        color = Qt::red;
+        color = Qt::blue;
     }else
     {
         color = Qt::green;
@@ -149,7 +159,7 @@ void ThresholdListWidget::checkThresholds(int nRow,PowerWarningInfo* pWarning) {
 
     // 功率检测
     if(pWarning->w_power) {
-        color = Qt::red;
+        color = Qt::blue;
     }else
     {
         color = Qt::green;
@@ -157,7 +167,7 @@ void ThresholdListWidget::checkThresholds(int nRow,PowerWarningInfo* pWarning) {
     ui->tableWidget->item(nRow,4)->setForeground(color);
     // 电量检测
     if(pWarning->w_consumption) {
-        color = Qt::red;
+        color = Qt::blue;
     }else
     {
         color = Qt::green;

+ 1 - 1
Qt/Qt_Test_Pro_5inch/widget.ui

@@ -100,7 +100,7 @@ QLabel
              </font>
             </property>
             <property name="currentIndex">
-             <number>0</number>
+             <number>1</number>
             </property>
             <widget class="QWidget" name="page_4">
              <layout class="QVBoxLayout" name="verticalLayout_6">