调整英文键盘大小
authorqibin <2534086736@qq.com>
Wed, 20 Sep 2023 02:27:28 +0000 (10:27 +0800)
committerqibin <2534086736@qq.com>
Wed, 20 Sep 2023 02:27:28 +0000 (10:27 +0800)
修复了键盘在切换到主界面有时不会正常关闭的BUG
对新加的协议传输增加了一些延时等待

ZDBYQ/canshupeizhi.cpp
ZDBYQ/jiemian.pro.user
ZDBYQ/keyboard_ABC.ui
ZDBYQ/mainpage_rxy.cpp
ZDBYQ/mainwindow.cpp
ZDBYQ/mcu_arm1.cpp
ZDBYQ/mcu_arm1.h
ZDBYQ/wangluo.cpp
ZDBYQ/xitongshezhi.cpp
ZDBYQ/xitongshezhi.h

index 3c60343f2d86b57f2af92706dca31f13f06dd4dc..54cea75718511d5e640ff4c91261a651331cbaf0 100644 (file)
@@ -11,6 +11,7 @@
 #include <qdebug.h>
 
 mcu_arm1 *ARM3;//调用串口通信
+
 bool cspz_flag=false;
 
 void Delay_MSec1(unsigned int msec)
@@ -913,7 +914,8 @@ void canshupeizhi::cspz_rxyset_page()
     label_cspz_3_31->setGeometry(360,406,20,30);
     label_cspz_3_31->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(255, 255, 255)");
     label_cspz_3_31->setText("分");
-    label_cspz_3_15->setGeometry(700,354,80,30);
+    //label_cspz_3_15->setGeometry(700,354,80,30);
+    label_cspz_3_15->setGeometry(310,270,80,30);
     label_cspz_3_15->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(255, 255, 255)");
 
     label_cspz_3_18->setGeometry(450,231,100,30);
@@ -2786,6 +2788,10 @@ void canshupeizhi::mimaButtonClicked()
 
 void canshupeizhi::callKeyBoard(QLineEdit *a)
 {
+    if(keyBoard_flag==true)
+    {
+        keyBoard1->close();
+    }
     if(KeyBoard_Code==false)
     {
         keyBoard1 = new KeyBoard(0, a);
@@ -2795,18 +2801,19 @@ void canshupeizhi::callKeyBoard(QLineEdit *a)
     }
     else
     {
-        if(keyBoard_flag==true)
-        {
-            keyBoard1->close();
-        }
         keyBoard1 = new KeyBoard(0, a);
         keyBoard1->setGeometry(490, 200, 321, 182);
         keyBoard1->show();
     }
+    keyBoard1->setAttribute(Qt::WA_DeleteOnClose);
 }
 
 void canshupeizhi::callKeyBoard_ABC_Can(QLineEdit *a)
 {
+    if(keyBoard_ABC_flag==true)
+    {
+        keyBoard_ABC1->close();
+    }
     if(KeyBoard_ABC_Code==false)
     {
         keyBoard_ABC1 = new KeyBoard_ABC(0, a);
@@ -2816,14 +2823,11 @@ void canshupeizhi::callKeyBoard_ABC_Can(QLineEdit *a)
     }
     else
     {
-        if(keyBoard_ABC_flag==true)
-        {
-            keyBoard_ABC1->close();
-        }
         keyBoard_ABC1 = new KeyBoard_ABC(0, a);
         keyBoard_ABC1->setGeometry(5, 326, 790, 143);
         keyBoard_ABC1->show();
     }
+    keyBoard_ABC1->setAttribute(Qt::WA_DeleteOnClose);
 }
 
 void canshupeizhi::button_cspz_1_1_Clicked()
@@ -3100,6 +3104,7 @@ void canshupeizhi::button_cspz_rxy1_start_Clicked()//开启热像仪1
     }
 
     ARM3->rxy_state();   //下发热像仪状态   23.8.30
+    Delay_MSec1(500);
 }
 
 void canshupeizhi::button_cspz_rxy2_start_Clicked()//开启热像仪2
@@ -3129,16 +3134,19 @@ void canshupeizhi::button_cspz_rxy2_start_Clicked()//开启热像仪2
         button_cspz_rxy2_start->setText("关闭热像仪2");
     }
     ARM3->rxy_state();    //下发热像仪状态    23.8.30
+    Delay_MSec1(500);
 }
 
 void canshupeizhi::button_cspz_5_1_Clicked()//开启风机
 {
     ARM3->setFanState(1);
+    Delay_MSec1(500);
 }
 
 void canshupeizhi::button_cspz_5_2_Clicked()//关闭风机
 {
     ARM3->setFanState(0);
+    Delay_MSec1(500);
 }
 
 bool fengji_flag=true;
@@ -3202,7 +3210,7 @@ void canshupeizhi::button_cspz_5_3_Clicked()
         file_write2.close();
         Delay_MSec1(50);
         ARM3->setoverheat();
-        Delay_MSec1(10);
+        Delay_MSec1(500);
         if(label_cspz_5_19->text()=="风机定时运行已开启!")
         {
             ARM3->setFanTiming(0x01);//串口发送启动风机定时
@@ -3211,9 +3219,9 @@ void canshupeizhi::button_cspz_5_3_Clicked()
         {
             ARM3->setFanTiming(0x00);//串口发送关闭风机定时
         }
-        Delay_MSec1(10);
+        Delay_MSec1(500);
         ARM3->setFanStartT();
-        Delay_MSec1(10);
+        Delay_MSec1(500);
         label_cspz_5_18->setText("保存成功!");
         Delay_MSec1(500);
         label_cspz_5_18->clear();
index fd3a7509927d3448cfd09f267c15b5d3bd22142f..a805230e2b3a4ac57e6f4ed9e9133e6ad77c8460 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.11.1, 2023-06-07T17:42:52. -->
+<!-- Written by QtCreator 4.11.1, 2023-08-15T17:34:46. -->
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>
index 024ce009b99788a8de37a910309e7d770279c73d..2acf8b0509ea6a8f3552c0826c38d3ba04fd6784 100644 (file)
@@ -9,8 +9,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>1039</width>
-    <height>190</height>
+    <width>919</width>
+    <height>242</height>
    </rect>
   </property>
   <property name="cursor">
@@ -27,8 +27,8 @@
     <rect>
      <x>1</x>
      <y>1</y>
-     <width>1021</width>
-     <height>161</height>
+     <width>791</width>
+     <height>141</height>
     </rect>
    </property>
    <property name="styleSheet">
@@ -43,8 +43,8 @@
     <rect>
      <x>0</x>
      <y>0</y>
-     <width>1013</width>
-     <height>161</height>
+     <width>791</width>
+     <height>141</height>
     </rect>
    </property>
    <layout class="QGridLayout" name="gridLayout">
index 0ad77806e1b9b20b0471789c1b06c9a28a45c196..e8a7932507f5442468dc40cdc798a7141a983efb 100644 (file)
@@ -133,7 +133,6 @@ void mainpage_Rxy::button9_1_clicked()//热像仪1按钮槽函数
         Thermal_imager_Alarm_file_rxy1=in.readLine();
     }
     file_read.close();
-
     label_9_1->clear();
     button9_1->show();
     button9_1->raise();
index aadb406ebf4c4e10fe9cd05c99beec8386841e6f..732a190ffb995ca675f490be7c180ada202c907b 100644 (file)
@@ -14,6 +14,10 @@ bool lowpower_mode_flag1=true;
 
 bool kaiji_flag_ok=false;
 
+int rxy_state_flag = 0;
+bool powerlost_flag = true;
+int powerlost_times = 0;
+
 wangluo *wangluo_thread=nullptr;
 canshupeizhi *canshupeizhi_thread=nullptr;
 xitongshezhi *xitongshezhi_thread=nullptr;
@@ -27,6 +31,14 @@ QNetworkConfigurationManager mgr;//网络检测
 
 int main_back_color;
 int where_page;
+
+void Delay_MSec3(unsigned int msec)
+{
+    QEventLoop eventloop;
+    QTimer::singleShot((int)msec, &eventloop, SLOT(quit()));
+    eventloop.exec();
+}
+
 MainWindow::MainWindow(QWidget *parent)
     : QMainWindow(parent)
     , ui(new Ui::MainWindow)
@@ -1370,8 +1382,25 @@ void MainWindow::dispPopWindwows()
                 Pop_alarm_rxy_disconnect->show();
                 Pop_alarm_rxy_disconnect->raise();
                 Pop_alarm_rxy_disconnect->setText("热像仪掉线");
-
+                int flag_rxy = 0;
+                if(file_alarm6_1.exists() == true && file_alarm6_2.exists() == false)
+                {
+                    flag_rxy = 1;
+                }
+                else if(file_alarm6_2.exists() == true && file_alarm6_1.exists() == false)
+                {
+                    flag_rxy = 2;
+                }
+                else
+                {
+                    flag_rxy = 3;
+                }
+                if(rxy_state_flag != flag_rxy)
+                {
+                    rxy_state_flag = flag_rxy;
                 ARM_1->rxy_state();  //向下位机发送警报  23.8.16
+                    Delay_MSec3(100);
+                }
 
             }
             else
@@ -1379,6 +1408,7 @@ void MainWindow::dispPopWindwows()
                 DIG.alarm_rxy = 0;
                 alarm_flag4=false;
                 Pop_alarm_rxy_disconnect->hide();
+                rxy_state_flag = 0;
             }
         }
 
@@ -2421,12 +2451,6 @@ void MainWindow::timerTimeout3(void)//开机进度条
     }
 }
 
-void Delay_MSec3(unsigned int msec)
-{
-    QEventLoop eventloop;
-    QTimer::singleShot((int)msec, &eventloop, SLOT(quit()));
-    eventloop.exec();
-}
 
 void MainWindow::usb_file_selcet()
 {
@@ -2723,6 +2747,7 @@ void MainWindow::onRtcUpdate(bool flag)
     }else {
         ARM_1->GetRtcTime();
     }
+      Delay_MSec3(50);
 
     QDateTime date_time=QDateTime::currentDateTimeUtc();
     long nowtime = date_time.toTime_t() + 28800;
@@ -2883,7 +2908,18 @@ void MainWindow::onAlarmCheck(uint32_t data_alarm)
     //23.8.24  增加断电
     if(data_alarm & BIT(4))
     {
+        if(powerlost_flag || powerlost_times == 20)
+        {
+            powerlost_times = 0;
+            powerlost_flag = false;
         postDataMod->powerlost();
+            Delay_MSec3(100);
+        }
+        powerlost_times++;
+    }
+    else
+    {
+        powerlost_flag = true;
     }
 }
 
@@ -2896,6 +2932,7 @@ void MainWindow::onSelfTestCheck(uint32_t data_alarm)
     alarm_flag13 = (data_alarm & BIT(4)) ? false: true;
 
     alarm_flag12 = (data_alarm & BIT(3)) ? false: true;
+
 }
 
 void MainWindow::onLanTuBiaoStateUpdate(bool state)
index 65c1bb62db2571a5ae53e535319d7592a3f4d191..7fea8e2e39c559c84933d101dba6fe1037d2fadf 100644 (file)
@@ -4,6 +4,7 @@
 #include "net_thread.h"
 #include "QTime"
 #include <QFileDialog>
+#include <qthread.h>
 extern QSerialPort SerialPort1;
 UART1 *uart_mcu1;
 extern uint16_t CRC1;
@@ -15,9 +16,10 @@ mcu_arm1::mcu_arm1():m_serialPort()
 
 void mcu_delay(unsigned int msec)
 {
-    QTime _Timer = QTime::currentTime().addMSecs(msec);
-    while( QTime::currentTime() < _Timer )
-        QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
+    QThread::msleep(msec);
+//    QTime _Timer = QTime::currentTime().addMSecs(msec);
+//    while( QTime::currentTime() < _Timer )
+//        QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
 }
 
 void mcu_arm1::GetRtcTime(){
index 78846edea402effbd1a35aae412396d104bcfacc..afcd1c18d694f70846097efbbda8276943f0bf9c 100644 (file)
@@ -23,10 +23,10 @@ public:
     void setFanTiming(uint8_t state);
     void setBuzzerState(uint8_t state);
 
-    void rxy_state();    // ÈÈÏñÒÇ״̬   23.8.16
-    void Realtime_temperature(int max,int min,int average);   //ÈÈÏñÒÇ1ʵʱζȠ 23.8.16
-    void Realtime_temperature1(int max,int min,int average);   //ÈÈÏñÒÇ2ʵʱζȠ 23.8.16
-    void Powerlost_datapost(bool isok);           //¶ÏµçÊý¾ÝÉÏ´«³É¹¦ÐźÅ
+    void rxy_state();    // 热像仪状态   23.8.16
+    void Realtime_temperature(int max,int min,int average);   //热像仪1实时温度  23.8.16
+    void Realtime_temperature1(int max,int min,int average);   //热像仪2实时温度  23.8.16
+    void Powerlost_datapost(bool isok);           //断电数据上传成功信号
 private:
         QSerialPort *m_serialPort;
 
index 1dff54b0f4ed5850afd36fb20809dd1afe52f26a..6b3e8aa73da378f1c8c0dd86880166799809f340 100644 (file)
@@ -861,6 +861,10 @@ void wangluo::mimaButtonClicked()
 
 void wangluo::callKeyBoard(QLineEdit *a)
 {
+    if(keyBoard_flag==true)
+    {
+        keyBoard->close();
+    }
     if(KeyBoard_Code==false)
     {
         keyBoard = new KeyBoard(0, a);
@@ -878,10 +882,15 @@ void wangluo::callKeyBoard(QLineEdit *a)
         keyBoard->setGeometry(490, 200, 321, 182);
         keyBoard->show();
     }
+    keyBoard->setAttribute(Qt::WA_DeleteOnClose);
 }
 
 void wangluo::callKeyBoard_ABC(QLineEdit *a)
 {
+    if(keyBoard_ABC_flag==true)
+    {
+        keyBoard_ABC->close();
+    }
     if(KeyBoard_ABC_Code==false)
     {
         keyBoard_ABC = new KeyBoard_ABC(0, a);
@@ -899,6 +908,7 @@ void wangluo::callKeyBoard_ABC(QLineEdit *a)
         keyBoard_ABC->setGeometry(5, 326, 790, 143);
         keyBoard_ABC->show();
     }
+    keyBoard_ABC->setAttribute(Qt::WA_DeleteOnClose);
 }
 
 void wangluo::button_wlxx_1_1_Clicked()//4G配置页面保存参数槽函数
index c5b821ee972eedbe60c85e3baa3bf46e35a54f0c..bbac366d433cbca37ee16471878f8cefc0d3d40d 100644 (file)
@@ -43,6 +43,7 @@ xitongshezhi::xitongshezhi(QWidget *parent) :
     label_xtsz_0_3->setAlignment(Qt::AlignCenter);
     label_xtsz_0_3->setText("故障记录");
 
+
     xtsz_page(1);
 
     xtsz_shebei_page();
@@ -98,6 +99,7 @@ void xitongshezhi::label_xtsz_2_show(int a)
 
 void xitongshezhi::label_xtsz_3_show(int a)
 {
+    label_xtsz_0_3_1->show();
     if(a==1)
     {
         label_xtsz_3_1->show();
@@ -289,12 +291,16 @@ void xitongshezhi::label_xtsz_3_show(int a)
         count=0;
         model_error->sort(0,Qt::DescendingOrder);
         tableView_error->show();
+        label_xtsz_0_3_1->hide();
+
     }
     else
     {
         tableView_error->hide();
         label_xtsz_3_1->hide();
+        label_xtsz_0_3_1->hide();
     }
+
 }
 
 void xitongshezhi::xtsz_page(int a)
@@ -410,10 +416,14 @@ void xitongshezhi::xtsz_xianshi_page()
 void xitongshezhi::xtsz_error_record_page()
 {
     label_xtsz_3_1=new QLabel(this);
+    label_xtsz_0_3_1=new QLabel(this);
 
     label_xtsz_3_1->setGeometry(240,190,400,30);
     label_xtsz_3_1->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(255, 255, 255)");
     label_xtsz_3_1->setText("发生时间                     故障类型");
+    label_xtsz_0_3_1->setGeometry(650,190,120,39);
+    label_xtsz_0_3_1->setAlignment(Qt::AlignCenter);
+    label_xtsz_0_3_1->setText("记录读取中...");
 
     tableView_error = new QTableView;
     /* 设置表格视图大小 */
index e3c76fdf36aa3aa64c1cf1fb9bfdd478a30ae631..bdf1b4456b4219e51f67f473ca4b094f7c5528ac 100644 (file)
@@ -18,7 +18,7 @@
 
 extern bool lowpower_mode_flag1;
 extern bool cspz_flag,wlpz_flag;
-static QString version="软件版本号:A20230831test";
+static QString version="软件版本号:A20230914test";
 
 namespace Ui {
 class xitongshezhi;
@@ -73,6 +73,7 @@ private:
     QLabel *label_xtsz_0_1;//左右滑动切换页面label(4G配置)
     QLabel *label_xtsz_0_2;//左右滑动切换页面label(LORA配置)
     QLabel *label_xtsz_0_3;
+    QLabel *label_xtsz_0_3_1; //读取进度
 
     QLabel *label_xtsz_1_1;
     QLabel *label_xtsz_1_2;