Browse Source

修正背景色造成LCD不能正常显示问题

fujiankuan 4 years ago
parent
commit
d2891da564
2 changed files with 117 additions and 77 deletions
  1. 8 5
      src/ui/ui_ads_hmi/ADCIntelligentVehicle.cpp
  2. 109 72
      src/ui/ui_ads_hmi/ADCIntelligentVehicle.ui

+ 8 - 5
src/ui/ui_ads_hmi/ADCIntelligentVehicle.cpp

@@ -341,6 +341,7 @@ ADCIntelligentVehicle::ADCIntelligentVehicle(QWidget *parent)
     ModuleFun funvbox = std::bind(&ADCIntelligentVehicle::UpdateVbox,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
     mpaplantrace = iv::modulecomm::RegisterRecvPlus("vbox",funvbox);
 
+#if 1
     ui->lcdNumber->setDigitCount(3); //设置显示几个数字
     ui->lcdNumber->setMode(QLCDNumber::Dec);
     ui->lcdNumber->setSegmentStyle(QLCDNumber::Flat);//设置数字字体:Outline,轮廓突出,颜色为背景色;Filled,内部填充型,颜色为黑色;Flat,平面型
@@ -353,7 +354,7 @@ ADCIntelligentVehicle::ADCIntelligentVehicle(QWidget *parent)
     //设置当前窗口的调色板
     ui->lcdNumber->setPalette(lcdpat);
     //设置背景色
-    ui->lcdNumber->setStyleSheet("background-color: black");
+    //ui->lcdNumber->setStyleSheet("background-color: black");
     //ui->lcdNumber->display(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"));
     ui->lcdNumber->display(0);
 
@@ -361,23 +362,23 @@ ADCIntelligentVehicle::ADCIntelligentVehicle(QWidget *parent)
     ui->lcdNumber_2->setMode(QLCDNumber::Dec);
     ui->lcdNumber_2->setSegmentStyle(QLCDNumber::Flat);
     ui->lcdNumber_2->setPalette(lcdpat);
-    ui->lcdNumber_2->setStyleSheet("background-color: black");
+    //ui->lcdNumber_2->setStyleSheet("background-color: black");
     ui->lcdNumber_2->display(0);
 
     ui->lcdNumber_3->setDigitCount(3);
     ui->lcdNumber_3->setMode(QLCDNumber::Dec);
     ui->lcdNumber_3->setSegmentStyle(QLCDNumber::Flat);
     ui->lcdNumber_3->setPalette(lcdpat);
-    ui->lcdNumber_3->setStyleSheet("background-color: black");
+    //ui->lcdNumber_3->setStyleSheet("background-color: black");
     ui->lcdNumber_3->display(0);
 
     ui->lcdNumber_4->setDigitCount(3);
     ui->lcdNumber_4->setMode(QLCDNumber::Dec);
     ui->lcdNumber_4->setSegmentStyle(QLCDNumber::Flat);
     ui->lcdNumber_4->setPalette(lcdpat);
-    ui->lcdNumber_4->setStyleSheet("background-color: black");
+    //ui->lcdNumber_4->setStyleSheet("background-color: black");
     ui->lcdNumber_4->display(0);
-
+#endif
     // 新建qimage
     // QImage img,img2,img3,img4;
     // 加载图片
@@ -394,9 +395,11 @@ ADCIntelligentVehicle::ADCIntelligentVehicle(QWidget *parent)
     img4 = img4.scaled(66,66,Qt::IgnoreAspectRatio);
     ui->label_32->setPixmap(QPixmap::fromImage(img4));
 
+    #if 1
     mTimerState1.setTimerType(Qt::PreciseTimer);    //设置计时器的精确程度    Qt::PreciseTimer值为0,含义:精确定时器试图保持毫秒精度
     connect(&mTimerState1,SIGNAL(timeout()),this,SLOT(onStateTimer1()));//广播发送UDP数据报
     mTimerState1.start(100);   //定时100ms
+    #endif
 
 }
 

+ 109 - 72
src/ui/ui_ads_hmi/ADCIntelligentVehicle.ui

@@ -401,10 +401,10 @@
      <widget class="QGroupBox" name="groupBox_11">
       <property name="geometry">
        <rect>
-        <x>100</x>
-        <y>520</y>
-        <width>591</width>
-        <height>311</height>
+        <x>110</x>
+        <y>530</y>
+        <width>581</width>
+        <height>261</height>
        </rect>
       </property>
       <property name="font">
@@ -418,89 +418,84 @@
       <property name="title">
        <string>V2X红绿灯</string>
       </property>
-      <widget class="QLabel" name="label_31">
+      <widget class="QLabel" name="label_37">
        <property name="geometry">
         <rect>
-         <x>320</x>
-         <y>220</y>
+         <x>430</x>
+         <y>190</y>
          <width>54</width>
          <height>26</height>
         </rect>
        </property>
-       <property name="text">
-        <string>直行</string>
-       </property>
-      </widget>
-      <widget class="QLabel" name="label_32">
-       <property name="geometry">
-        <rect>
-         <x>420</x>
-         <y>90</y>
-         <width>66</width>
-         <height>66</height>
-        </rect>
+       <property name="styleSheet">
+        <string notr="true">color: rgb(238, 238, 236);</string>
        </property>
        <property name="text">
-        <string>TextLabel</string>
+        <string>右转</string>
        </property>
       </widget>
-      <widget class="QLabel" name="label_33">
+      <widget class="QLCDNumber" name="lcdNumber_4">
        <property name="geometry">
         <rect>
-         <x>190</x>
-         <y>90</y>
-         <width>66</width>
-         <height>66</height>
+         <x>420</x>
+         <y>140</y>
+         <width>64</width>
+         <height>33</height>
         </rect>
        </property>
-       <property name="text">
-        <string>TextLabel</string>
+       <property name="styleSheet">
+        <string notr="true"/>
        </property>
-      </widget>
-      <widget class="QLabel" name="label_34">
-       <property name="geometry">
-        <rect>
-         <x>90</x>
-         <y>220</y>
-         <width>54</width>
-         <height>26</height>
-        </rect>
+       <property name="digitCount">
+        <number>3</number>
        </property>
-       <property name="text">
-        <string>掉头</string>
+       <property name="segmentStyle">
+        <enum>QLCDNumber::Flat</enum>
        </property>
       </widget>
-      <widget class="QLCDNumber" name="lcdNumber_2">
+      <widget class="QLCDNumber" name="lcdNumber_3">
        <property name="geometry">
         <rect>
-         <x>190</x>
-         <y>170</y>
+         <x>310</x>
+         <y>140</y>
          <width>64</width>
          <height>33</height>
         </rect>
        </property>
        <property name="styleSheet">
-        <string notr="true">color: rgb(204, 0, 0);</string>
+        <string notr="true"/>
+       </property>
+       <property name="digitCount">
+        <number>3</number>
+       </property>
+       <property name="segmentStyle">
+        <enum>QLCDNumber::Flat</enum>
        </property>
       </widget>
-      <widget class="QLCDNumber" name="lcdNumber_3">
+      <widget class="QLCDNumber" name="lcdNumber">
        <property name="geometry">
         <rect>
-         <x>310</x>
-         <y>170</y>
+         <x>80</x>
+         <y>140</y>
          <width>64</width>
          <height>33</height>
         </rect>
        </property>
        <property name="styleSheet">
-        <string notr="true">color: rgb(204, 0, 0);</string>
+        <string notr="true"/>
+       </property>
+       <property name="digitCount">
+        <number>3</number>
+       </property>
+       <property name="segmentStyle">
+        <enum>QLCDNumber::Flat</enum>
        </property>
       </widget>
-      <widget class="QLabel" name="label_35">
+      <widget class="QLabel" name="label_38">
        <property name="geometry">
         <rect>
-         <x>310</x>
-         <y>90</y>
+         <x>80</x>
+         <y>60</y>
          <width>66</width>
          <height>66</height>
         </rect>
@@ -509,63 +504,88 @@
         <string>TextLabel</string>
        </property>
       </widget>
-      <widget class="QLCDNumber" name="lcdNumber">
+      <widget class="QLabel" name="label_31">
        <property name="geometry">
         <rect>
-         <x>80</x>
-         <y>170</y>
+         <x>320</x>
+         <y>190</y>
+         <width>54</width>
+         <height>26</height>
+        </rect>
+       </property>
+       <property name="styleSheet">
+        <string notr="true">color: rgb(238, 238, 236);</string>
+       </property>
+       <property name="text">
+        <string>直行</string>
+       </property>
+      </widget>
+      <widget class="QLCDNumber" name="lcdNumber_2">
+       <property name="geometry">
+        <rect>
+         <x>190</x>
+         <y>140</y>
          <width>64</width>
          <height>33</height>
         </rect>
        </property>
        <property name="styleSheet">
-        <string notr="true">color: rgb(204, 0, 0);</string>
+        <string notr="true"/>
+       </property>
+       <property name="digitCount">
+        <number>3</number>
+       </property>
+       <property name="segmentStyle">
+        <enum>QLCDNumber::Flat</enum>
        </property>
       </widget>
-      <widget class="QLabel" name="label_36">
+      <widget class="QLabel" name="label_34">
        <property name="geometry">
         <rect>
-         <x>200</x>
-         <y>220</y>
+         <x>90</x>
+         <y>190</y>
          <width>54</width>
          <height>26</height>
         </rect>
        </property>
+       <property name="styleSheet">
+        <string notr="true">color: rgb(238, 238, 236);</string>
+       </property>
        <property name="text">
-        <string>左转</string>
+        <string>掉头</string>
        </property>
       </widget>
-      <widget class="QLCDNumber" name="lcdNumber_4">
+      <widget class="QLabel" name="label_32">
        <property name="geometry">
         <rect>
          <x>420</x>
-         <y>170</y>
-         <width>64</width>
-         <height>33</height>
+         <y>60</y>
+         <width>66</width>
+         <height>66</height>
         </rect>
        </property>
-       <property name="styleSheet">
-        <string notr="true">color: rgb(204, 0, 0);</string>
+       <property name="text">
+        <string>TextLabel</string>
        </property>
       </widget>
-      <widget class="QLabel" name="label_37">
+      <widget class="QLabel" name="label_33">
        <property name="geometry">
         <rect>
-         <x>430</x>
-         <y>220</y>
-         <width>54</width>
-         <height>26</height>
+         <x>190</x>
+         <y>60</y>
+         <width>66</width>
+         <height>66</height>
         </rect>
        </property>
        <property name="text">
-        <string>右转</string>
+        <string>TextLabel</string>
        </property>
       </widget>
-      <widget class="QLabel" name="label_38">
+      <widget class="QLabel" name="label_35">
        <property name="geometry">
         <rect>
-         <x>80</x>
-         <y>90</y>
+         <x>310</x>
+         <y>60</y>
          <width>66</width>
          <height>66</height>
         </rect>
@@ -574,6 +594,22 @@
         <string>TextLabel</string>
        </property>
       </widget>
+      <widget class="QLabel" name="label_36">
+       <property name="geometry">
+        <rect>
+         <x>200</x>
+         <y>190</y>
+         <width>54</width>
+         <height>26</height>
+        </rect>
+       </property>
+       <property name="styleSheet">
+        <string notr="true">color: rgb(238, 238, 236);</string>
+       </property>
+       <property name="text">
+        <string>左转</string>
+       </property>
+      </widget>
      </widget>
     </widget>
     <widget class="QWidget" name="page_1">
@@ -2239,6 +2275,7 @@ p, li { white-space: pre-wrap; }
  <resources>
   <include location="ADCIntelligentVehicle.qrc"/>
   <include location="ADCIntelligentVehicle.qrc"/>
+  <include location="ADCIntelligentVehicle.qrc"/>
  </resources>
  <connections>
   <connection>