From 8e78e7c4efabbf041f768032a3cd0ecb96018155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E8=B6=85?= Date: Fri, 1 Nov 2024 17:40:37 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E6=B7=BB=E5=8A=A0=E6=8A=98?= =?UTF-8?q?=E7=BA=BF=E5=9B=BE=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HX_CoalFlowDetect.pro | 20 +- Resource/logo.ico | Bin 0 -> 4286 bytes .../ZDateEdit/Resources/ComboBoxArrow.png | Bin 0 -> 146 bytes component/ZDateEdit/Resources/DTNext.png | Bin 0 -> 223 bytes component/ZDateEdit/Resources/DTPrev.png | Bin 0 -> 211 bytes component/ZDateEdit/Resources/bk.png | Bin 0 -> 3363 bytes component/ZDateEdit/Resources/popupButton.png | Bin 0 -> 10236 bytes .../ZDateEdit/Resources/popupButton2.png | Bin 0 -> 429 bytes component/ZDateEdit/qss/zDateTimeEdit.qss | 16 + main.cpp | 8 + mainwindow.cpp | 143 +++++--- mainwindow.h | 55 ++- mainwindow.ui | 76 ++++- resource.qrc | 7 + view/beltspeedlinewidget.cpp | 66 ++++ view/beltspeedlinewidget.h | 26 ++ view/coaldistributbarchartwidget.cpp | 104 ++++++ view/coaldistributbarchartwidget.h | 50 +++ view/coalstatisticschartwidget.cpp | 77 +++++ view/coalstatisticschartwidget.h | 34 ++ view/coalstatisticschartwidget.ui | 316 ++++++++++++++++++ 21 files changed, 936 insertions(+), 62 deletions(-) create mode 100644 Resource/logo.ico create mode 100644 component/ZDateEdit/Resources/ComboBoxArrow.png create mode 100644 component/ZDateEdit/Resources/DTNext.png create mode 100644 component/ZDateEdit/Resources/DTPrev.png create mode 100644 component/ZDateEdit/Resources/bk.png create mode 100644 component/ZDateEdit/Resources/popupButton.png create mode 100644 component/ZDateEdit/Resources/popupButton2.png create mode 100644 component/ZDateEdit/qss/zDateTimeEdit.qss create mode 100644 view/beltspeedlinewidget.cpp create mode 100644 view/beltspeedlinewidget.h create mode 100644 view/coaldistributbarchartwidget.cpp create mode 100644 view/coaldistributbarchartwidget.h create mode 100644 view/coalstatisticschartwidget.cpp create mode 100644 view/coalstatisticschartwidget.h create mode 100644 view/coalstatisticschartwidget.ui diff --git a/HX_CoalFlowDetect.pro b/HX_CoalFlowDetect.pro index 1432645..de08f1d 100644 --- a/HX_CoalFlowDetect.pro +++ b/HX_CoalFlowDetect.pro @@ -27,15 +27,29 @@ CONFIG += c++11 SOURCES += \ main.cpp \ mainwindow.cpp \ - view/coaldistributchartwidget.cpp + view/beltspeedlinewidget.cpp \ + view/coaldistributbarchartwidget.cpp \ + view/coalstatisticschartwidget.cpp\ + component/ZDateEdit/dateCommonInfo.cpp\ + component/ZDateEdit/zdateedit.cpp\ + component/ZDateEdit/zdatetimeedit.cpp\ + component/ZDateEdit/ztimeedit.cpp\ HEADERS += \ mainwindow.h \ - view/coaldistributchartwidget.h + view/beltspeedlinewidget.h \ + view/coaldistributbarchartwidget.h \ + view/coalstatisticschartwidget.h\ + component/ZDateEdit/dateCommonInfo.h\ + component/ZDateEdit/zdateedit.h\ + component/ZDateEdit/zdatetimeedit.h\ + component/ZDateEdit/ztimeedit.h\ + FORMS += \ mainwindow.ui \ - view/coaldistributchartwidget.ui + view/coalstatisticschartwidget.ui + # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/Resource/logo.ico b/Resource/logo.ico new file mode 100644 index 0000000000000000000000000000000000000000..b17e78f98afc289f23729c23b2c0ac5dc30d331f GIT binary patch literal 4286 zcmeHL!EPEs3^h_!5QASY*}Gg91@T_Lt$~~{OiM=sAi!+Y!o3F0r zh}p3mrY~xRPisqcV=w&{oieYE&xz#9vu<_5=kQZZ#7yzQV!NykTYGD|COt~zPQ3`R z_VjGJ8IT;o<=Lv|0KetXx}Y`ADi6VmzZDxi>ltXk;xvvH18Q6UfSx>rX?$4S& zS_ht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~+JfGxyUVBx#?l7}41@7{x)WOOl6#>bY; zC>s^d}kC|w{%cNVLX0frP*Bhz@F$vsQL*4Z%Q>PhsqZXP@ZB2<;aq^s&YUY5 z7=y?*C*Y_b<;rz4Wlsyf0_Xe)ci*_HDQPzpusR62tL_c>!BqZL>h1FOQQ)ruw17Ah zcR(y|m_#9^*QT!=cQH~(D&b6YA6q}^r{ZS}B%1dHy2~#7CQUlEfA;muc;Ca?WTZ5{ z^OK)xTFY<-;0)WR0~5f*4(O{YS!LvPwxcOQef+L#)>Yd~M$(o$A(=8skV-2!Q;O7i zInoBz@Nehl9P2kDZjK?m#^($Xr8$UEw#7Qf9QKRQ^g!J`mKVy;c*?lXdPhF#ucnn} T?Zj+6KY%0QQDIGAe)Ii5l89~X literal 0 HcmV?d00001 diff --git a/component/ZDateEdit/Resources/popupButton.png b/component/ZDateEdit/Resources/popupButton.png new file mode 100644 index 0000000000000000000000000000000000000000..dfd60ef7e766038e38a1025b5264bae193989cf2 GIT binary patch literal 10236 zcmdsdc|6qZ`v1%rF_!H6nig9j6j?_|WtXC|MkH&5tTR$6WhqH^lI6)(h-8@|*%>N? z>}zA+$C%}J%kw#(!j*P zTo>r+=;*+mhK6R}zI`wl4BYAI>EUoVEiElD?aAQI&CUHM41quZ832I5$jAtVLjU9e z?hFhJfCp&61+0J>000t@0GWx2Y5)HHfFEd>nVDHwSO5=j0ZM@1%VAFdCg8Z29>4%4 zD=RA?0Rp%{2sSo0K(Ys5XJ-dWz_S+)SV0J&0gfPtJv@*BAtxs%$N?btV(l>lFEBws z4$|0T_%lO51uy^)NdCH3fC^lI3IITKaNi3jARqwd1!TYvNWcY5f6f9>fhfRnFQq-s zJ$?}PPZJP8+Q1h8z_o`506+yY0sNp8d;CBH^nWG>mffumuIRXH<0RP?)n1CQ=^aD)=hc1|w52+}6mzR#CSL7r{?Pl_^l{Dyyh9+xBy&;I3ULN8MhtnFHny>c?&E z4x72znr&pq+$_+{&Dyli0uZuwwx$sLU^)s~XE6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SjzCpTsYaYpE*b)SbBn~)=H8*Br3DVP~OXK zOmfrJzPNQS?MCF{`w-sOW|bRAi}w0H`A)eBf06GG4oD?l-3r#Husf#Ia}1@cyFl}x^>o>!tTBCfBD*(aQZB{jL!i)u>9-$3 zeaD`YLIc#A4LD9fa`&SMT&fl*=NBj@gH*ds|Dr`~tl&vioM+kRf*-Je)mUVz;LXkz zT==s`cQg7Jr>IHZQ;*fUhwp@5`BeNp4K?an8)g5LR& xxcVU=$aUkLfS%~eAHS5|{R>Px$XGugsR9HvtmrYKDKoEt$(u=tB8hQb*pqxNhx|;C>j0Z5{C0v=v!g~x?aPQdK zfY=QELz5vB6FOl*x~uBdqaIZ)9C=A7zRI})O3A1~XU+Ywc0B+p=M3uSZwV`)Lh&2} z0JmLbCer~>8{U30z1RyN98%ILv*mnU6+bI&s zC>j78wgc*aT`LlVYYRJmHo|s=q$FVgV@Z!cS4zs|0>H&Ug-|$IRkc+6st{`tH!hm< zT4AQdy`P})>0UC*o@{k+#fua0jt@?`+XFql1|&rW0KRxdc(;PsalQcfcMNz{p#S4@ z*MRPRiL0uuDp-neVc@_FOjE%LSJuM)}L<^a&U<^}JDb09E%E&#p( XBeMW7rIVA;00000NkvXXu0mjf*ZQ`{ literal 0 HcmV?d00001 diff --git a/component/ZDateEdit/qss/zDateTimeEdit.qss b/component/ZDateEdit/qss/zDateTimeEdit.qss new file mode 100644 index 0000000..d733656 --- /dev/null +++ b/component/ZDateEdit/qss/zDateTimeEdit.qss @@ -0,0 +1,16 @@ +QPushButton#popupButton{ + border-image: url(:/component/ZDateEdit/Resources/popupButton.png);min-height:20px;max-height:20px;min-width:20px;max-width:20px;background-color:#ffffff; +} + +QLabel{color:#cadfff; font-size:12px;} +QLabel#labelWeekend{color:#00caff;} +QLable#label_splite{font: bold 14px;} + +QWidget#widgetTitle{background-color:#061f65;} +QWidget#baseWidget{background-color:#EE013B6B;border-radius: 11px;} + +QComboBox{background-color: transparent; selection-background-color: transparent; color:#ffffff; font-size: 14px; min-height: 20px; selection-text-align: right;border:0px solid} +QComboBox::down-arrow{ image:url(:/component/ZDateEdit/Resources/ComboBoxArrow.png); } +QComboBox::down-arrow:on{ top: 1px; left: 1px; } QComboBox::drop-down{ width: 26px; border:none; } +QComboBox QAbstractItemView {border: none; outline:0px;} QComboBox QAbstractItemView::item{ height: 26px; min-height:26px;} +QComboBox QAbstractItemView::item:selected{ background-color: #0087f1; color: #e6ebf1;} QComboBox QAbstractItemView::item:!selected {background-color: #e6ebf1; color: #000000;} diff --git a/main.cpp b/main.cpp index acfb321..27a9d6d 100644 --- a/main.cpp +++ b/main.cpp @@ -1,5 +1,6 @@ #include "mainwindow.h" #include +#include int main(int argc, char* argv[]) { @@ -7,5 +8,12 @@ int main(int argc, char* argv[]) MainWindow w; w.showMaximized(); + QFile file(":/component/ZDateEdit/qss/zDateTimeEdit.qss"); + if (file.open(QFile::ReadOnly)) { + QString qss = file.readAll(); + a.setStyleSheet(qss); + file.close(); + } + return a.exec(); } diff --git a/mainwindow.cpp b/mainwindow.cpp index 7950030..ca71530 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,64 +1,121 @@ #include "mainwindow.h" #include "ui_mainwindow.h" -#include "view/coaldistributchartwidget.h" +#include "view/beltspeedlinewidget.h" +#include "view/coaldistributbarchartwidget.h" +#include "view/coalstatisticschartwidget.h" #include #include -MainWindow::MainWindow(QWidget *parent) - : QMainWindow(parent), ui(new Ui::MainWindow) { - ui->setupUi(this); - this->setWindowFlag(Qt::FramelessWindowHint); - this->setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint | - Qt::WindowMinimizeButtonHint); +MainWindow::MainWindow(QWidget* parent) + : QMainWindow(parent) + , ui(new Ui::MainWindow) +{ + ui->setupUi(this); + this->setWindowFlag(Qt::FramelessWindowHint); + this->setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint); - calendarLoopPlay(); + calendarLoopPlay(); - addcoalDistributChart(); + setBeltWarnInfoTextEditStyle(); + + addcoalDistributChart(); + + addbeltSpeedChat(); + + addCoalStatisticsChart(); } MainWindow::~MainWindow() { delete ui; } +void MainWindow::addBeltWarnInfoToTextEdit(const QString& consoleInfo) +{ + m_textEditConsoleInfo.append(consoleInfo); + QDateTime startDateTime = QDateTime::currentDateTime(); + QString formattedTime = startDateTime.toString("yyyy-MM-dd hh:mm:ss"); + + if (m_textEditConsoleInfo.isEmpty()) + return; + QString lastConsoleInfo = m_textEditConsoleInfo.last(); + + qint64 timeDifferenceInMilliseconds = m_previousConsleInfoDateTime.secsTo(startDateTime); + + if ((lastConsoleInfo == consoleInfo) && timeDifferenceInMilliseconds < 2) + return; + + QString consoleInfoResult = QStringLiteral("[%1]%2").arg(formattedTime).arg(consoleInfo); + ui->textEdit_beltWarnInfo->append(consoleInfoResult); + + m_previousConsleInfoDateTime = QDateTime::currentDateTime(); +} + void MainWindow::on_pushButton_close_clicked() { this->close(); } -void MainWindow::on_pushButton_max_clicked() { - if (isFullScreen()) { - this->showMaximized(); - } else { - this->showFullScreen(); - } +void MainWindow::on_pushButton_max_clicked() +{ + if (isFullScreen()) { + this->showMaximized(); + } else { + this->showFullScreen(); + } } void MainWindow::on_pushButton_min_clicked() { this->showMinimized(); } -void MainWindow::calendarLoopPlay() { - ui->label_calendar->clear(); - QTimer *timer_calendar = new QTimer(this); - connect(timer_calendar, &QTimer::timeout, this, [this]() { - QDateTime time = QDateTime::currentDateTime(); - QString str = time.toString("yyyy-MM-dd hh:mm:ss dddd"); - ui->label_calendar->setText(str); - }); - timer_calendar->start(1000); //每一秒溢出一次进入槽函数 +void MainWindow::calendarLoopPlay() +{ + ui->label_calendar->clear(); + QTimer* timer_calendar = new QTimer(this); + connect(timer_calendar, &QTimer::timeout, this, [this]() { + QDateTime time = QDateTime::currentDateTime(); + QString str = time.toString("yyyy-MM-dd hh:mm:ss dddd"); + ui->label_calendar->setText(str); + }); + timer_calendar->start(1000); //每一秒溢出一次进入槽函数 } -void MainWindow::addcoalDistributChart() { - - CoalDistributChartWidget *coalDistributChartWidget = - new CoalDistributChartWidget(ui->widget_coalDistributChart); - - // 可选:设置大小 - coalDistributChartWidget->setMinimumSize(400, 300); // 设置最小大小以确保可见 - - // 确保将部件添加到布局中 - QVBoxLayout *layout = - qobject_cast(ui->widget_coalDistributChart->layout()); - if (layout) { - layout->addWidget(coalDistributChartWidget); - } else { - // 如果没有布局,可以手动添加部件 - ui->widget_coalDistributChart->setLayout(new QVBoxLayout()); - ui->widget_coalDistributChart->layout()->addWidget( - coalDistributChartWidget); - } +void MainWindow::setBeltWarnInfoTextEditStyle() +{ + ui->textEdit_beltWarnInfo->document()->setMaximumBlockCount(100); + ui->textEdit_beltWarnInfo->setReadOnly(true); + ui->textEdit_beltWarnInfo->setTextInteractionFlags(Qt::NoTextInteraction); +} + +void MainWindow::addcoalDistributChart() +{ + // addBeltWarnInfoToTextEdit("添加煤流分布窗口成功!"); + ui->textEdit_beltWarnInfo->append("添加煤流分布窗口成功!"); + + CoalDistributBarChartWidget* coalDistributBarChartWidget = new CoalDistributBarChartWidget(this); + + // 检查布局是否已设置 + if (!ui->widget_coalDistributChart->layout()) { + ui->widget_coalDistributChart->setLayout(new QVBoxLayout); + } + coalDistributBarChartWidget->setContentsMargins(0, 0, 0, 0); + ui->widget_coalDistributChart->layout()->addWidget(coalDistributBarChartWidget); +} + +void MainWindow::addbeltSpeedChat() +{ + ui->textEdit_beltWarnInfo->append("添加皮带机速度曲线窗口成功!"); + BeltSpeedLineWidget* beltSpeedLineWidget = new BeltSpeedLineWidget(this); + // 检查布局是否已设置 + if (!ui->widget_beltSpeedChart->layout()) { + ui->widget_beltSpeedChart->setLayout(new QVBoxLayout); + } + beltSpeedLineWidget->setContentsMargins(0, 0, 0, 0); + ui->widget_beltSpeedChart->layout()->addWidget(beltSpeedLineWidget); +} + +void MainWindow::addCoalStatisticsChart() +{ + ui->textEdit_beltWarnInfo->append("添加煤量统计窗口成功!"); + CoalStatisticsChartWidget* coalStatisticsChartWidget = new CoalStatisticsChartWidget(this); + // 检查布局是否已设置 + if (!ui->widget_beltSpeedChart->layout()) { + ui->widget_beltSpeedChart->setLayout(new QVBoxLayout); + } + coalStatisticsChartWidget->setContentsMargins(0, 0, 0, 0); + ui->widget_coalStatisticsChart->layout()->addWidget(coalStatisticsChartWidget); } diff --git a/mainwindow.h b/mainwindow.h index 7587b52..dd121b9 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -1,6 +1,7 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H +#include #include namespace Ui { @@ -8,32 +9,64 @@ class MainWindow; } class MainWindow : public QMainWindow { - Q_OBJECT + Q_OBJECT public: - explicit MainWindow(QWidget *parent = nullptr); - ~MainWindow(); + explicit MainWindow(QWidget* parent = nullptr); + ~MainWindow(); + +public slots: + /** + * @brief 皮带报警信息 + * @param consoleInfo + */ + void addBeltWarnInfoToTextEdit(const QString& consoleInfo); private slots: - void on_pushButton_close_clicked(); + void on_pushButton_close_clicked(); - void on_pushButton_max_clicked(); + void on_pushButton_max_clicked(); - void on_pushButton_min_clicked(); + void on_pushButton_min_clicked(); private: - /** + /** * @brief calendarLoopPlay 时间轮播 */ - void calendarLoopPlay(); + void calendarLoopPlay(); - /** + /** + * @brief setBeltWarnInfoTextEditStyle 调整皮带报警信息编辑框样式 + */ + void setBeltWarnInfoTextEditStyle(); + + /** * @brief addcoalDistributChart 添加煤流分布柱状图 */ - void addcoalDistributChart(); + void addcoalDistributChart(); + + /** + * @brief addbeltSpeedChat 添加皮带机速度曲线图 + */ + void addbeltSpeedChat(); + + /** + * @brief addCoalStatisticsChart 添加煤量统计图表 + */ + void addCoalStatisticsChart(); private: - Ui::MainWindow *ui; + Ui::MainWindow* ui; + + /** + * @brief m_textEditConsoleInfo 控制台命令列表信息 + */ + QList m_textEditConsoleInfo; + + /** + * @brief m_previousConsleInfoDateTime 上一条控制台命令发送时间 + */ + QDateTime m_previousConsleInfoDateTime; }; #endif // MAINWINDOW_H diff --git a/mainwindow.ui b/mainwindow.ui index 83332f3..a0b2eb7 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -205,7 +205,7 @@ QPushButton:pressed{ - + 6 @@ -1040,6 +1040,9 @@ QToolButton:pressed{ + + 20 + @@ -3026,7 +3029,7 @@ QPushButton:pressed{ - + @@ -3038,7 +3041,7 @@ QPushButton:pressed{ - + 6 @@ -3092,7 +3095,37 @@ QPushButton:pressed{ - + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + #textEdit_beltWarnInfo{ + background-color:transparent; + color: #FFFFFF; + font: 12pt "Albertus Extra Bold"; + border:no; +} + + + + + @@ -3153,6 +3186,21 @@ QPushButton:pressed{ } + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + @@ -3192,7 +3240,25 @@ QPushButton:pressed{ - + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + diff --git a/resource.qrc b/resource.qrc index 42f1898..5d129f6 100644 --- a/resource.qrc +++ b/resource.qrc @@ -58,5 +58,12 @@ Resource/image/startPress.png Resource/image/stopHover.png Resource/image/stopPress.png + component/ZDateEdit/qss/zDateTimeEdit.qss + component/ZDateEdit/Resources/bk.png + component/ZDateEdit/Resources/ComboBoxArrow.png + component/ZDateEdit/Resources/DTNext.png + component/ZDateEdit/Resources/DTPrev.png + component/ZDateEdit/Resources/popupButton.png + component/ZDateEdit/Resources/popupButton2.png diff --git a/view/beltspeedlinewidget.cpp b/view/beltspeedlinewidget.cpp new file mode 100644 index 0000000..d430e4d --- /dev/null +++ b/view/beltspeedlinewidget.cpp @@ -0,0 +1,66 @@ +#include "beltspeedlinewidget.h" + +#include +#include + +BeltSpeedLineWidget::BeltSpeedLineWidget(QWidget* parent) + : QWidget(parent) +{ + initLineChart(); +} + +void BeltSpeedLineWidget::initLineChart() +{ + // 创建图表视图 + m_chartView = new QChartView(this); + + m_chartView->setBackgroundBrush(Qt::transparent); + m_chartView->setStyleSheet("background: transparent;"); // 使用样式表确保透明 + m_chartView->setRenderHint(QPainter::Antialiasing); + m_chartView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + + m_chart = new QChart(); + m_chart->setBackgroundBrush(Qt::transparent); + m_chart->setMargins(QMargins(0, 0, 0, 0)); + + // 创建折线系列 + m_series = new QLineSeries(); + m_series->setPointsVisible(false); // 隐藏数据点的标记 + // m_series->setMarkerShape(QLineSeries::MarkerShapeNone); // 隐藏标记形状 + + // 将系列添加到图表 + m_chart->addSeries(m_series); + m_chart->createDefaultAxes(); + + // 假设数据点,替换为你的实时数据 + QDateTime currentTime = QDateTime::currentDateTime(); + for (int i = 0; i < 120; ++i) { // 120个数据点,代表最近两个小时 + double speed = qrand() % 21; // 生成0到20之间的随机速度 + m_series->append(currentTime.addSecs(-i * 60).toMSecsSinceEpoch(), speed); + } + + // 创建并设置X轴为日期时间轴 + QDateTimeAxis* xAxis = new QDateTimeAxis(); + xAxis->setFormat("hh:mm:ss"); + xAxis->setRange(currentTime.addSecs(-7200), currentTime); // 设置范围为最近两个小时 + xAxis->setLinePen(QPen(Qt::gray)); + xAxis->setLabelsColor(Qt::gray); + m_chart->setAxisX(xAxis, m_series); // 将X轴应用到数据系列 + + // 设置Y轴范围 + m_chart->axisY()->setRange(0, 20); + m_chart->axisY()->setTitleText("速度 (m/s)"); + + m_chart->axisY()->setTitleBrush(QBrush(Qt::gray)); + m_chart->axisY()->setLinePen(QPen(Qt::gray)); + m_chart->axisY()->setLabelsColor(Qt::gray); + + // 设置图表到视图并将视图设置为中心部件 + m_chartView->setChart(m_chart); + + QVBoxLayout* layout = new QVBoxLayout(this); + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(0); // 设置间距为0 + layout->addWidget(m_chartView); + setLayout(layout); +} diff --git a/view/beltspeedlinewidget.h b/view/beltspeedlinewidget.h new file mode 100644 index 0000000..45e67ba --- /dev/null +++ b/view/beltspeedlinewidget.h @@ -0,0 +1,26 @@ +#ifndef BELTSPEEDLINEWIDGET_H +#define BELTSPEEDLINEWIDGET_H + +#include +#include +#include + +QT_CHARTS_USE_NAMESPACE + +class BeltSpeedLineWidget : public QWidget { + Q_OBJECT +public: + explicit BeltSpeedLineWidget(QWidget* parent = nullptr); + +public slots: + +private: + void initLineChart(); + +private: + QChartView* m_chartView; // 图表视图 + QChart* m_chart; // 图表 + QLineSeries* m_series; // 数据系列 +}; + +#endif // BELTSPEEDLINEWIDGET_H diff --git a/view/coaldistributbarchartwidget.cpp b/view/coaldistributbarchartwidget.cpp new file mode 100644 index 0000000..c5e9d63 --- /dev/null +++ b/view/coaldistributbarchartwidget.cpp @@ -0,0 +1,104 @@ +#include "coaldistributbarchartwidget.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +CoalDistributBarChartWidget::CoalDistributBarChartWidget(QWidget* parent) + : QWidget(parent) +{ + initializeChart(); + + // setupTimer(); +} + +void CoalDistributBarChartWidget::updateChart() +{ + double newValue = QRandomGenerator::global()->bounded(0, 99); // 随机生成0-900的Y值 + + // 更新当前柱子的值 + QBarSet* currentBarSet = static_cast(m_series->barSets().at(currentIndex)); + currentBarSet->replace(0, newValue); // 更新当前柱子的值 + + // 循环更新下一个柱子的索引 + currentIndex = (currentIndex + 1) % m_series->count(); // 循环到下一个柱子 +} + +void CoalDistributBarChartWidget::initializeChart() +{ + // 创建图标 + m_chart = new QChart(); + + m_chart->setBackgroundBrush(Qt::transparent); + m_chart->setMargins(QMargins(0, 0, 0, 0)); + + // 创建窗口并设置图表 + m_chartView = new QChartView(m_chart); + m_chartView->setBackgroundBrush(Qt::transparent); + m_chartView->setStyleSheet("background: transparent;"); // 使用样式表确保透明 + m_chartView->setRenderHint(QPainter::Antialiasing); + m_chartView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + + // 创建柱状图 + m_series = new QBarSeries(); + m_chart->addSeries(m_series); + + // 创建300个柱状集 + // for (int i = 0; i < 300; ++i) { + // QBarSet* barSet = new QBarSet(QString::number(i)); // 使用柱子编号作为名称 + // barSet->append(0); // 初始化值为0 + // m_series->append(barSet); + // } + + // 设置X轴为时间 + QValueAxis* axisX = new QValueAxis; + axisX->setRange(1, 300); + axisX->setTickCount(10); + axisX->setLabelFormat("%d"); + axisX->setLinePen(QPen(Qt::gray)); + axisX->setLabelsColor(Qt::gray); + axisX->setMinorTickCount(0); // 隐藏X轴刻度线 + m_chart->addAxis(axisX, Qt::AlignBottom); + m_series->attachAxis(axisX); + + // 设置Y轴为百分比 + QValueAxis* axisY = new QValueAxis; + axisY->setTitleText("占比(%)"); + axisY->setTitleBrush(QBrush(Qt::gray)); + axisY->setLinePen(QPen(Qt::gray)); + axisY->setLabelsColor(Qt::gray); // 设置标签字体颜色为灰色 + axisY->setRange(0, 100); + m_chart->addAxis(axisY, Qt::AlignLeft); + m_series->attachAxis(axisY); + + // 设置Y轴标题位置 + axisY->setTitleFont(QFont("Arial", 10)); // 设置标题字体 + axisY->setTitleVisible(true); // 确保标题可见 + + QVBoxLayout* layout = new QVBoxLayout(this); + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(0); // 设置间距为0 + layout->addWidget(m_chartView); + setLayout(layout); +} + +void CoalDistributBarChartWidget::setupTimer() +{ + // 定时器设置 + m_timer = new QTimer(this); + connect(m_timer, &QTimer::timeout, this, &CoalDistributBarChartWidget::updateChart); + m_timer->start(1000); // 每秒更新一次 +} diff --git a/view/coaldistributbarchartwidget.h b/view/coaldistributbarchartwidget.h new file mode 100644 index 0000000..72e468a --- /dev/null +++ b/view/coaldistributbarchartwidget.h @@ -0,0 +1,50 @@ +#ifndef COALDISTRIBUTBARCHARTWIDGET_H +#define COALDISTRIBUTBARCHARTWIDGET_H + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +QT_CHARTS_USE_NAMESPACE + +class CoalDistributBarChartWidget : public QWidget { + Q_OBJECT +public: + explicit CoalDistributBarChartWidget(QWidget* parent = nullptr); + +private slots: + void updateChart(); + +private: + void initializeChart(); + + void setupTimer(); + +private: + QChart* m_chart; + QChartView* m_chartView; + QBarSeries* m_series; + QTimer* m_timer; + + QDateTimeAxis* m_axisX; + + int currentIndex; // 当前更新的柱子的索引 + + static const int MaxDataPoints = 300; // 最大数据点数(5分钟,每秒1条) + QBarSet* m_set; + // QList m_timeLabels; + QList m_timeLabels; // 存储时间标签 + QList m_values; // 存储比例值 + + // QList timestamps; // 存储时间戳 +}; + +#endif // COALDISTRIBUTBARCHARTWIDGET_H diff --git a/view/coalstatisticschartwidget.cpp b/view/coalstatisticschartwidget.cpp new file mode 100644 index 0000000..0cb8af4 --- /dev/null +++ b/view/coalstatisticschartwidget.cpp @@ -0,0 +1,77 @@ +#include "coalstatisticschartwidget.h" +#include "ui_coalstatisticschartwidget.h" + +CoalStatisticsChartWidget::CoalStatisticsChartWidget(QWidget* parent) + : QWidget(parent) + , ui(new Ui::CoalStatisticsChartWidget) +{ + ui->setupUi(this); + + initCoalStatisticsBarChart(); +} + +CoalStatisticsChartWidget::~CoalStatisticsChartWidget() +{ + delete ui; +} + +void CoalStatisticsChartWidget::initCoalStatisticsBarChart() +{ + // 创建图表 + m_chart = new QChart(); + m_chart->setBackgroundBrush(Qt::transparent); + m_chart->setMargins(QMargins(0, 0, 0, 0)); + + // 创建图表视图并设置 + m_chartView = new QChartView(m_chart); + m_chartView->setBackgroundBrush(Qt::transparent); + m_chartView->setStyleSheet("background: transparent;"); + m_chartView->setRenderHint(QPainter::Antialiasing); + m_chartView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + + // 创建柱状图 + m_series = new QBarSeries(); + m_chart->addSeries(m_series); + + // 设置X轴为时间 + QValueAxis* axisX = new QValueAxis; + axisX->setRange(1, 300); + axisX->setTickCount(10); + axisX->setLabelFormat("%d"); + axisX->setLinePen(QPen(Qt::gray)); + axisX->setLabelsColor(Qt::gray); + axisX->setMinorTickCount(0); + m_chart->addAxis(axisX, Qt::AlignBottom); + m_series->attachAxis(axisX); + + // 设置Y轴为百分比 + QValueAxis* axisY = new QValueAxis; + axisY->setTitleText("吨"); + axisY->setTitleBrush(QBrush(Qt::gray)); + axisY->setLinePen(QPen(Qt::gray)); + axisY->setLabelsColor(Qt::gray); + axisY->setRange(0, 100); + m_chart->addAxis(axisY, Qt::AlignLeft); + m_series->attachAxis(axisY); + + // 设置Y轴标题位置 + axisY->setTitleFont(QFont("Arial", 10)); + axisY->setTitleVisible(true); + + // 获取 widget_coalChart 的布局 + QVBoxLayout* layout = static_cast(ui->widget_coalChart->layout()); + if (!layout) { + // 如果没有布局,创建一个新的布局并设置 + layout = new QVBoxLayout(ui->widget_coalChart); + ui->widget_coalChart->setLayout(layout); + } + + // 设置布局参数 + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(0); + + // 确保视图只添加一次 + if (!layout->indexOf(m_chartView) != -1) { + layout->addWidget(m_chartView); + } +} diff --git a/view/coalstatisticschartwidget.h b/view/coalstatisticschartwidget.h new file mode 100644 index 0000000..e80aa51 --- /dev/null +++ b/view/coalstatisticschartwidget.h @@ -0,0 +1,34 @@ +#ifndef COALSTATISTICSCHARTWIDGET_H +#define COALSTATISTICSCHARTWIDGET_H + +#include +#include + +QT_CHARTS_USE_NAMESPACE +namespace Ui { +class CoalStatisticsChartWidget; +} + +class CoalStatisticsChartWidget : public QWidget { + Q_OBJECT + +public: + explicit CoalStatisticsChartWidget(QWidget* parent = nullptr); + ~CoalStatisticsChartWidget(); + +private: + /** + * @brief initCoalStatisticsBarChart 初始化煤量统计柱状图 + */ + void initCoalStatisticsBarChart(); + +private: + Ui::CoalStatisticsChartWidget* ui; + + QChart* m_chart; + QChartView* m_chartView; + QBarSeries* m_series; + QTimer* m_timer; +}; + +#endif // COALSTATISTICSCHARTWIDGET_H diff --git a/view/coalstatisticschartwidget.ui b/view/coalstatisticschartwidget.ui new file mode 100644 index 0000000..f1a14da --- /dev/null +++ b/view/coalstatisticschartwidget.ui @@ -0,0 +1,316 @@ + + + CoalStatisticsChartWidget + + + + 0 + 0 + 630 + 350 + + + + Form + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 15 + + + 10 + + + 10 + + + + + Qt::LeftToRight + + + QLabel{ + color: rgb(255, 255, 255); + font: 10pt "黑体"; +} + + + 开始时间 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 25 + + + + QDateTimeEdit { + background-color: rgb(51, 52, 56); + color: white; /* 字体颜色 */ + border: 1px solid rgb(180, 186, 188); /* 边框颜色和宽度 */ + border-radius: 0px; /* 圆角 */ + padding: 5px; /* 内边距 */ + font-size: 14px; /* 字体大小 */ + font-family: "Arial", sans-serif; /* 字体样式 */ +} + +QDateTimeEdit::up-button { + subcontrol-origin: padding; + subcontrol-position: top right; +} + +QDateTimeEdit::down-button { + subcontrol-origin: padding; + subcontrol-position: bottom right; +} +QDateTimeEdit::up-button, QDateTimeEdit::down-button { + width: 0px; + height: 0px; +} + + + + + + + + QLabel{ + color: rgb(255, 255, 255); + font: 10pt "黑体"; +} + + + 结束时间 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 25 + + + + QDateTimeEdit { + background-color: rgb(51, 52, 56); + color: white; /* 字体颜色 */ + border: 1px solid rgb(180, 186, 188); /* 边框颜色和宽度 */ + border-radius: 0px; /* 圆角 */ + padding: 5px; /* 内边距 */ + font-size: 14px; /* 字体大小 */ + font-family: "Arial", sans-serif; /* 字体样式 */ +} + +QDateTimeEdit::up-button { + subcontrol-origin: padding; + subcontrol-position: top right; +} + +QDateTimeEdit::down-button { + subcontrol-origin: padding; + subcontrol-position: bottom right; +} +QDateTimeEdit::up-button, QDateTimeEdit::down-button { + width: 0px; + height: 0px; +} + + + + + + + + QLabel{ + color: rgb(255, 255, 255); + font: 10pt "黑体"; +} + + + 统计单位 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 25 + + + + QComboBox{ + background-color: rgb(51, 52, 56); + color: white; /* 字体颜色 */ + border: 1px solid rgb(180, 186, 188); /* 边框颜色和宽度 */ + border-radius: 0px; /* 圆角 */ + padding: 5px; /* 内边距 */ + font-size: 14px; /* 字体大小 */ + font-family: "Arial", sans-serif; /* 字体样式 */ +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 + + + 10 + + + + + QLabel{ + color: rgb(255, 255, 255); + font: 10pt "黑体"; +} + + + 煤量总计:000吨 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + QRadioButton{ + + color: rgb(255, 255, 255); +} + + + + + + true + + + + + + + QRadioButton{ + + color: rgb(255, 255, 255); +} + + + + + + + + + + QRadioButton{ + + color: rgb(255, 255, 255); +} + + + + + + + + + + QRadioButton{ + + color: rgb(255, 255, 255); +} + + + + + + + + + + + + + + + + + + ZDateTimeEdit + QDateTimeEdit +
component/ZDateEdit/zdatetimeedit.h
+
+
+ + +