feat:删除无用操作提示

This commit is contained in:
徐超 2024-11-25 08:32:50 +08:00
parent 1b8ec50f22
commit 777f67341d
4 changed files with 36 additions and 434 deletions

View File

@ -7,7 +7,6 @@ class CoalDistributModbusThread {
public:
CoalDistributModbusThread(const QString& host, quint16 port);
private:
private:
QString m_hostIP;
quint16 m_port;

View File

@ -225,7 +225,7 @@ QPushButton:pressed{
<widget class="QWidget" name="widget_body" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="3">
<item>
<layout class="QVBoxLayout" name="verticalLayout" stretch="2,2,3">
<layout class="QVBoxLayout" name="verticalLayout" stretch="2,2,2">
<property name="spacing">
<number>6</number>
</property>
@ -233,7 +233,7 @@ QPushButton:pressed{
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="4,2,2">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="6,3">
<property name="leftMargin">
<number>0</number>
</property>
@ -348,396 +348,6 @@ QPushButton:pressed{
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_beltOperate" native="true">
<property name="styleSheet">
<string notr="true">#widget_beltOperate{
border-image: url(:/Resource/image/beltOperate.png);
}</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="0">
<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>
<layout class="QVBoxLayout" name="verticalLayout_13" stretch="1,0,3,0,3,0">
<property name="spacing">
<number>9</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="spacing">
<number>0</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QWidget" name="widget_beltOperateLogo" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>35</width>
<height>35</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">#widget_beltOperateLogo{
border-image: url(:/Resource/image/icon1.png);
}</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_beltTitle">
<property name="styleSheet">
<string notr="true">#label_beltTitle{
color:white;
font: 12pt &quot;黑体&quot;;
}</string>
</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>
<item>
<widget class="QLabel" name="label_beltOperateState">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>48</width>
<height>17</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">#label_beltState{
background-image: url(:/Resource/image/beltOffline.png);
background-repeat:no-repeat;
background-position:center;
}</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<property name="spacing">
<number>5</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QToolButton" name="toolButton_centralControl">
<property name="minimumSize">
<size>
<width>90</width>
<height>24</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QToolButton{
border-image: url(:/Resource/image/labelunSelect.png);
color:white;
margin-left:-30px;
padding-left:60px;
background:url(:/Resource/image/jikong.png) center no-repeat;
font-size: 14px;
border: none;
}
QToolButton:hover{
border-image: url(:/Resource/image/labelhover.png);
}
QToolButton:pressed{
border-image: url(:/Resource/image/labelSelect.png);
}
</string>
</property>
<property name="text">
<string>集控</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_overhaul">
<property name="minimumSize">
<size>
<width>90</width>
<height>25</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QToolButton{
border-image: url(:/Resource/image/labelunSelect.png);
color:white;
margin-left:-30px;
padding-left:60px;
background:url(:/Resource/image/jiudi.png) center no-repeat;
font-size: 14px;
border: none;
}
QToolButton:hover{
border-image:url(:/Resource/image/labelhover.png);
}
QToolButton:pressed{
border-image: url(:/Resource/image/labelSelect.png);
}</string>
</property>
<property name="text">
<string>检修</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_inching">
<property name="minimumSize">
<size>
<width>90</width>
<height>25</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QToolButton{
border-image: url(:/Resource/image/labelunSelect.png);
color:white;
margin-left:-30px;
padding-left:60px;
background:url(:/Resource/image/jiudi.png) center no-repeat;
font-size: 14px;
border: none;
}
QToolButton:hover{
border-image: url(:/Resource/image/labelhover.png);
}
QToolButton:pressed{
border-image: url(:/Resource/image/labelSelect.png);
}</string>
</property>
<property name="text">
<string>点动</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_local">
<property name="minimumSize">
<size>
<width>90</width>
<height>25</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QToolButton{
border-image: url(:/Resource/image/labelunSelect.png);
color:white;
margin-left:-30px;
padding-left:60px;
background:url(:/Resource/image/jiudi.png) center no-repeat;
font-size: 14px;
border: none;
}
QToolButton:hover{
border-image: url(:/Resource/image/labelhover.png);
}
QToolButton:pressed{
border-image: url(:/Resource/image/labelSelect.png);
}</string>
</property>
<property name="text">
<string>就地</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<spacer name="horizontalSpacer_3">
<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="pushButton_onClickStart">
<property name="minimumSize">
<size>
<width>100</width>
<height>45</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QPushButton{
border-image: url(:/Resource/image/oneClickStart.png);
}
QPushButton:hover{
border-image: url(:/Resource/image/oneClickStartHover.png);
}
QPushButton:pressed{
border-image: url(:/Resource/image/oneClickStartPress.png);
}
</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_oneKeyStop">
<property name="minimumSize">
<size>
<width>100</width>
<height>45</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QPushButton{
background-color: transparent;
border-image: url(:/Resource/image/oneClickStop.png);
}
QPushButton:hover{
border-image: url(:/Resource/image/oneClickStopHover.png);
}
QPushButton:pressed{
border-image: url(:/Resource/image/oneClickStopPress.png);
}</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<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>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_warnInfo" native="true">
<property name="styleSheet">
@ -778,7 +388,7 @@ QPushButton:pressed{
}</string>
</property>
<property name="text">
<string>皮带报警信息</string>
<string>操作信息</string>
</property>
</widget>
</item>
@ -823,7 +433,7 @@ QPushButton:pressed{
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="6,2">
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="6,3">
<property name="spacing">
<number>6</number>
</property>
@ -1009,7 +619,7 @@ QPushButton:pressed{
border-image: url(:/Resource/image/coalStatisbg.png);
}</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_9" stretch="">
<layout class="QVBoxLayout" name="verticalLayout_9">
<property name="spacing">
<number>0</number>
</property>

View File

@ -49,18 +49,11 @@ void CoalStaticWidget::initCoalStatisticsBarChart()
// 设置X轴为时间
m_axisX = new QBarCategoryAxis();
// m_axisX->setFormat("yyyy/MM/d H"); // 设置日期时间格式
// m_axisX->setTitleText("时间");
m_axisX->setTitleBrush(QBrush(Qt::gray));
m_axisX->setLinePen(QPen(Qt::gray));
m_axisX->setLabelsColor(Qt::gray);
m_axisX->setGridLineVisible(false);
m_axisX->setTitleBrush(QBrush(QColor(151, 151, 151)));
m_axisX->setLinePen(QPen(QColor(40, 46, 48)));
m_axisX->setLabelsColor(QColor(151, 151, 151));
// 获取当前时间并设置时间范围为最近六个小时
// QDateTime currentTime = QDateTime::currentDateTime();
// QDateTime startTime = currentTime.addSecs(-6 * 3600); // 当前时间减去六个小时
// m_axisX->setLabelsAngle(45);
// m_axisX->setRange(startTime, currentTime); // 设置X轴时间范围
m_axisX->setGridLineVisible(false);
QDateTime currentTime = QDateTime::currentDateTime();
QList<QString> timeList = getLastSixFullHours(currentTime);
@ -72,9 +65,10 @@ void CoalStaticWidget::initCoalStatisticsBarChart()
// 设置Y轴为百分比
m_axisY = new QValueAxis;
m_axisY->setTitleText("");
m_axisY->setTitleBrush(QBrush(Qt::gray));
m_axisY->setLinePen(QPen(Qt::gray));
m_axisY->setLabelsColor(Qt::gray);
m_axisY->setTitleBrush(QBrush(QColor(151, 151, 151)));
m_axisY->setLinePen(QPen(QColor(40, 46, 48)));
m_axisY->setLabelsColor(QColor(151, 151, 151));
m_axisY->setGridLineColor(QColor(40, 46, 48));
m_axisY->setRange(0, 100);
m_axisY->setTitleFont(QFont("Arial", 10));
m_axisY->setTitleVisible(true);
@ -151,7 +145,7 @@ void CoalStaticWidget::updateCoalStatisticsChart(const QMap<QString, double>& vo
*set << it.value(); // 将数据量加入到数据集
emit querySuccessInfo(QString::number(it.value()));
// emit querySuccessInfo(QString::number(it.value()));
categories.append(label); // 将时间标签添加到列表
}
@ -221,12 +215,11 @@ void CoalStaticWidget::getCoalStatisInfoByHttpRequest(const QString& beginTime,
m_toalValue = data["total_volum"].toDouble();
QJsonObject statisticUnitVolum = data["statistic_unit_volum"].toObject();
int statisticUnitVolumSize = statisticUnitVolum.count();
QString statisticUnitVolumSizeString = "查询结果数" + QString::number(statisticUnitVolumSize);
emit querySuccessInfo(statisticUnitVolumSizeString);
QString totalVolumeString = "总吨数" + QString::number(m_toalValue);
emit querySuccessInfo(totalVolumeString);
// int statisticUnitVolumSize = statisticUnitVolum.count();
// QString statisticUnitVolumSizeString = "查询结果数" + QString::number(statisticUnitVolumSize);
// emit querySuccessInfo(statisticUnitVolumSizeString);
// QString totalVolumeString = "总吨数" + QString::number(m_toalValue);
// emit querySuccessInfo(totalVolumeString);
ui->label_totalVolume->clear();
ui->label_totalVolume->setText(QString("煤量总计:%1吨").arg(m_toalValue * m_systemSetting->value("system/different").toDouble()));
@ -237,25 +230,19 @@ void CoalStaticWidget::getCoalStatisInfoByHttpRequest(const QString& beginTime,
double reduction = m_toalValue * m_systemSetting->value("system/different").toDouble(); // 减去50%
// 计算每个值应该减少的比例
// double currentReduction = 0;
// double currentReduction = 0;
// 遍历 statistic_unit_volum 中的键值对并存入 volumeDataMap
for (const QString& key : statisticUnitVolum.keys()) {
double value = statisticUnitVolum.value(key).toDouble();
// // 计算每个值所减少的比例
// double proportionalReduction = (value / m_toalValue) * reduction;
// 计算每个值所减少的比例
// double proportionalReduction = (value / m_toalValue) * reduction;
m_volumeDataMap.insert(key, value /*- proportionalReduction*/);
// currentReduction += proportionalReduction;
// currentReduction += proportionalReduction;
}
emit
// 更新查询的数据至图表
if (!m_volumeDataMap.isEmpty())
{
// 更新查询的数据至图表
if (!m_volumeDataMap.isEmpty()) {
updateCoalStatisticsChart(m_volumeDataMap);
}
@ -290,8 +277,8 @@ void CoalStaticWidget::on_pushButton_clicked()
// 统计单位
QString statisticUnit = ui->comboBox_unit->currentText();
emit querySuccessInfo("查询起始时间:" + formattedBeginTime);
emit querySuccessInfo("查询终止时间:" + formattedEndTime);
// emit querySuccessInfo("查询起始时间:" + formattedBeginTime);
// emit querySuccessInfo("查询终止时间:" + formattedEndTime);
getCoalStatisInfoByHttpRequest(formattedBeginTime, formattedEndTime, statisticUnit);
}

View File

@ -20,6 +20,10 @@ signals:
void querySuccessInfo(QString queryInfo);
private slots:
/**
* @brief on_pushButton_clicked
*/
void on_pushButton_clicked();
private:
@ -56,7 +60,6 @@ private:
QChart* m_chart;
QChartView* m_chartView;
QBarSeries* m_series;
// QDateTimeAxis* m_axisX;
QBarCategoryAxis* m_axisX;
QValueAxis* m_axisY;
@ -65,11 +68,14 @@ private:
*/
QSettings* m_systemSetting;
/**
* @brief m_toalValue
*/
double m_toalValue = 0.0;
/**
* @brief m_volumeDataMap
*/
* @brief m_volumeDataMap
*/
QMap<QString, double> m_volumeDataMap;
};