优化界面

This commit is contained in:
lxbpxylps@126.com 2021-10-24 13:50:39 +08:00
parent 7ade530466
commit 832a5b7cf8
2 changed files with 100 additions and 101 deletions

View File

@ -45,29 +45,44 @@ void MainWindow::dispNodeData(int seq, float humi, float temp, float light)
{
QString line_str;
line_str = "节点" +
QString::number(seq) +
" 湿度:" +
QString::number((double)humi) +
"% 温度:" +
QString::number((double)temp) +
"°C\n 光照度:" +
QString::number((double)light) +
"lx";
if (temp >= temp_max)
{
line_str = "节点<font color=\"#FF00FF\">" +
QString::number(seq) +
"</font>&nbsp;湿度:<font color=\"#0000FF\">" +
QString::number((double)humi) +
"%</font>&nbsp;温度:<font color=\"#FF0000\">" +
QString::number((double)temp) +
"°C</font><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;光照度:<font color=\"#0000FF\">" +
QString::number((double)light) +
"lx</font>";
}
else
{
line_str = "节点<font color=\"#FF00FF\">" +
QString::number(seq) +
"</font>&nbsp;湿度:<font color=\"#0000FF\">" +
QString::number((double)humi) +
"%</font>&nbsp;温度:<font color=\"#0000FF\">" +
QString::number((double)temp) +
"°C</font><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;光照度:<font color=\"#0000FF\">" +
QString::number((double)light) +
"lx</font>";
}
switch (seq)
{
case 2:
ui->label_node2->setText(line_str);
ui->textBrowser_node2->setHtml("<b><font size=\"60\">" + line_str + "</font></b>");
break;
case 3:
ui->label_node3->setText(line_str);
ui->textBrowser_node3->setHtml("<b><font size=\"60\">" + line_str + "</font></b>");
break;
case 4:
ui->label_node4->setText(line_str);
ui->textBrowser_node4->setHtml("<b><font size=\"60\">" + line_str + "</font></b>");
break;
case 5:
ui->label_node5->setText(line_str);
ui->textBrowser_node5->setHtml("<b><font size=\"60\">" + line_str + "</font></b>");
}
}
@ -95,7 +110,7 @@ void MainWindow::sendNodeWarn(int seq, float humi, float temp, float light)
is_first_run = false;
}
if (temp > temp_max)
if (temp >= temp_max)
{
QString warn_str = "节点" +
QString::number(seq) +

View File

@ -127,95 +127,11 @@
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLabel" name="label_node2">
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<width>1071</width>
<height>101</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>25</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>等待中</string>
</property>
</widget>
<widget class="QLabel" name="label_node3">
<property name="geometry">
<rect>
<x>10</x>
<y>160</y>
<width>1071</width>
<height>101</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>25</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>等待中</string>
</property>
</widget>
<widget class="QLabel" name="label_node4">
<property name="geometry">
<rect>
<x>10</x>
<y>260</y>
<width>1071</width>
<height>101</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>25</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>等待中</string>
</property>
</widget>
<widget class="QLabel" name="label_node5">
<property name="geometry">
<rect>
<x>10</x>
<y>360</y>
<width>1071</width>
<height>101</height>
</rect>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>25</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>等待中</string>
</property>
</widget>
<widget class="QLabel" name="label_time">
<property name="geometry">
<rect>
<x>10</x>
<y>460</y>
<y>500</y>
<width>1071</width>
<height>41</height>
</rect>
@ -235,8 +151,8 @@
<widget class="QDoubleSpinBox" name="doubleSpinBox">
<property name="geometry">
<rect>
<x>90</x>
<y>550</y>
<x>70</x>
<y>570</y>
<width>231</width>
<height>71</height>
</rect>
@ -257,6 +173,74 @@
<double>27.000000000000000</double>
</property>
</widget>
<widget class="QTextBrowser" name="textBrowser_node2">
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<width>371</width>
<height>101</height>
</rect>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Arial'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:25pt;&quot;&gt;等待获取数据&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QTextBrowser" name="textBrowser_node3">
<property name="geometry">
<rect>
<x>10</x>
<y>170</y>
<width>371</width>
<height>101</height>
</rect>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Arial'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:25pt;&quot;&gt;等待获取数据&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QTextBrowser" name="textBrowser_node4">
<property name="geometry">
<rect>
<x>10</x>
<y>280</y>
<width>371</width>
<height>101</height>
</rect>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Arial'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:25pt;&quot;&gt;等待获取数据&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QTextBrowser" name="textBrowser_node5">
<property name="geometry">
<rect>
<x>10</x>
<y>390</y>
<width>371</width>
<height>101</height>
</rect>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Arial'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:25pt;&quot;&gt;等待获取数据&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">