From 263b1a83b3aa57caee733ad85670bf5e16f7cb9e Mon Sep 17 00:00:00 2001 From: hm Date: Fri, 25 Feb 2022 15:50:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B2=E7=BA=BF=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/ComponentUI/Scope/Chart.cpp | 86 ++-- App/ComponentUI/Scope/Chart.h | 35 +- App/GCS_zh_CN.qm | Bin 17114 -> 16867 bytes App/GCS_zh_CN.ts | 499 ++++++++++++------------ App/ToolsUI/PowerSystem/PowerSystem.cpp | 8 + App/ToolsUI/Senser/Senser.cpp | 232 +++++++---- App/ToolsUI/Senser/Senser.h | 7 + App/ToolsUI/Senser/Senser.ui | 8 +- 8 files changed, 520 insertions(+), 355 deletions(-) diff --git a/App/ComponentUI/Scope/Chart.cpp b/App/ComponentUI/Scope/Chart.cpp index 1f9770d..0f6773b 100644 --- a/App/ComponentUI/Scope/Chart.cpp +++ b/App/ComponentUI/Scope/Chart.cpp @@ -20,7 +20,12 @@ Chart::Chart(QChart *chart, QWidget *parent) chart->setAnimationOptions(QChart::SeriesAnimations); + QFont font; + font.setFamily("微软雅黑"); + font.setPointSize(9); + QValueAxis *axisX = new QValueAxis(); + axisX->setLabelsFont(font); axisX->setRange(0, 60); axisX->setTickCount(11); axisX->setLabelFormat("%.0f"); @@ -28,6 +33,7 @@ Chart::Chart(QChart *chart, QWidget *parent) QValueAxis *axisY = new QValueAxis(); + axisY->setLabelsFont(font); axisY->setRange(-3, 3); axisY->setTickCount(7); axisY->setLabelFormat("%.2f"); @@ -45,6 +51,11 @@ Chart::Chart(QChart *chart, QWidget *parent) //默认不使用,因为使用显卡加速图形会闪 setUseOpenGL(true); + chart->layout()->setContentsMargins(2, 2, 2, 2); + //chart->setContentsMargins(0, 0, 0, 0); //设置外边界全部为0 + chart->setMargins(QMargins(0, 0, 0, 0));//设置内边界全部为0 + chart->setBackgroundRoundness(0); //设置背景区域无圆角 + if(!updateTimer) { updateTimer = new QTimer(this); @@ -65,8 +76,12 @@ Chart::Chart(QWidget *parent) //chart()->setPlotArea(this->geometry()); chart()->setAnimationOptions(QChart::SeriesAnimations); + QFont font; + font.setFamily("微软雅黑"); + font.setPointSize(9); QValueAxis *axisX = new QValueAxis(); + axisX->setLabelsFont(font); axisX->setRange(0, 60); axisX->setTickCount(11); axisX->setLabelFormat("%.0f"); @@ -74,6 +89,7 @@ Chart::Chart(QWidget *parent) QValueAxis *axisY = new QValueAxis(); + axisY->setLabelsFont(font); axisY->setRange(-1, 1); axisY->setTickCount(7); axisY->setLabelFormat("%.2f"); @@ -87,6 +103,11 @@ Chart::Chart(QWidget *parent) //默认不使用,因为使用显卡加速图形会闪 setUseOpenGL(true); + chart()->layout()->setContentsMargins(2, 2, 2, 2); + //chart()->setContentsMargins(0, 0, 0, 0); //设置外边界全部为0 + chart()->setMargins(QMargins(0, 0, 0, 0));//设置内边界全部为0 + chart()->setBackgroundRoundness(0); //设置背景区域无圆角 + if(!updateTimer) { updateTimer = new QTimer(this); @@ -110,32 +131,38 @@ Chart::~Chart() } } -void Chart::leaveEvent(QEvent *e) +void Chart::enterEvent(QEvent *event) +{ + //setCursor(Qt::SizeVerCursor); + QChartView::leaveEvent(event); +} + +void Chart::leaveEvent(QEvent *event) { isPress = false; setCursor(Qt::ArrowCursor); - QChartView::leaveEvent(e); + QChartView::leaveEvent(event); } -void Chart::hideEvent(QHideEvent *e) +void Chart::hideEvent(QHideEvent *event) { - qDebug() << e; + qDebug() << event; } -void Chart::showEvent(QShowEvent *e) +void Chart::showEvent(QShowEvent *event) { - qDebug() << e; + qDebug() << event; } -void Chart::mouseMoveEvent(QMouseEvent *e) +void Chart::mouseMoveEvent(QMouseEvent *event) { if(isoperation) { - const QPoint curPos = e->pos(); + const QPoint curPos = event->pos(); if (isPress) { QPoint offset = curPos - lastPoint; @@ -146,7 +173,7 @@ void Chart::mouseMoveEvent(QMouseEvent *e) //QChartView::mouseMoveEvent(e); } -void Chart::mouseReleaseEvent(QMouseEvent *e) +void Chart::mouseReleaseEvent(QMouseEvent *event) { if(isoperation) { @@ -156,38 +183,52 @@ void Chart::mouseReleaseEvent(QMouseEvent *e) //QChartView::mouseReleaseEvent(e); } -void Chart::mousePressEvent(QMouseEvent *e) +void Chart::mousePressEvent(QMouseEvent *event) { + + if(isoperation) { - if (e->button() == Qt::RightButton) + if (event->button() == Qt::RightButton) { - lastPoint = e->pos(); + lastPoint = event->pos(); isPress = true; setCursor(Qt::ClosedHandCursor); } } //QChartView::mousePressEvent(e); + + if(Select()) + { + setSelect(false); + } + else + { + setSelect(true); + } + + emit select(Select());//被选中 + } -void Chart::mouseDoubleClickEvent(QMouseEvent *e) +void Chart::mouseDoubleClickEvent(QMouseEvent *event) { - qDebug() << "Chart double clicked" << e; + qDebug() << "Chart double clicked" << event; //双击生成一个标 //QChartView::mouseDoubleClickEvent(e); } -void Chart::wheelEvent(QWheelEvent *e) +void Chart::wheelEvent(QWheelEvent *event) { if(isoperation) { //以鼠标坐标为中心进行缩放 - QPointF curVal = chart()->mapToValue(QPointF(e->pos())); + QPointF curVal = chart()->mapToValue(QPointF(event->pos())); //缩放比例 const double factor = 1.5; - switch(e->modifiers()) + switch(event->modifiers()) { case Qt::ControlModifier://垂直缩放 { @@ -198,7 +239,7 @@ void Chart::wheelEvent(QWheelEvent *e) double bottomOffset; double topOffset; - if (e->delta() > 0) + if (event->delta() > 0) {//放大 bottomOffset = 1.0 / factor * (Central - Min); topOffset = 1.0 / factor * (Max - Central); @@ -213,6 +254,7 @@ void Chart::wheelEvent(QWheelEvent *e) }break; case Qt::ShiftModifier://水平缩放 { + //setCursor(Qt::SizeVerCursor); QValueAxis *axis = dynamic_cast(chart()->axisX()); const double Min = axis->min(); const double Max = axis->max(); @@ -220,7 +262,7 @@ void Chart::wheelEvent(QWheelEvent *e) double bottomOffset; double topOffset; - if (e->delta() > 0) + if (event->delta() > 0) {//放大 bottomOffset = 1.0 / factor * (Central - Min); topOffset = 1.0 / factor * (Max - Central); @@ -236,11 +278,11 @@ void Chart::wheelEvent(QWheelEvent *e) { QValueAxis *axis = dynamic_cast(chart()->axisX()); qreal dwidth = chart()->plotArea().width()/(axis->tickCount()*2); - if(e->delta() > 0) + if(event->delta() > 0) { chart()->scroll(-dwidth,0); } - else if(e->delta() < 0) + else if(event->delta() < 0) { chart()->scroll(dwidth,0); } @@ -250,7 +292,7 @@ void Chart::wheelEvent(QWheelEvent *e) //QChartView::wheelEvent(e); } -void Chart::resizeEvent(QResizeEvent *e) +void Chart::resizeEvent(QResizeEvent *event) { chart()->setPos(0,0); chart()->setGeometry(this->geometry()); diff --git a/App/ComponentUI/Scope/Chart.h b/App/ComponentUI/Scope/Chart.h index 2a7659e..f17ebac 100644 --- a/App/ComponentUI/Scope/Chart.h +++ b/App/ComponentUI/Scope/Chart.h @@ -13,6 +13,7 @@ #include #include +#include #include "QChart" #include @@ -74,19 +75,31 @@ public: } + bool Select() + { + return isSelected; + } + + void setSelect(bool flag) + { + isSelected = flag; + } + + protected: - void hideEvent(QHideEvent *e); - void showEvent(QShowEvent *e); - void leaveEvent(QEvent *e); - void mouseMoveEvent(QMouseEvent *e); - void mouseReleaseEvent(QMouseEvent *e); - void mousePressEvent(QMouseEvent *e); - void mouseDoubleClickEvent(QMouseEvent *e); - void wheelEvent(QWheelEvent *e); - void resizeEvent(QResizeEvent *e); + void hideEvent(QHideEvent *event); + void showEvent(QShowEvent *event); + void enterEvent(QEvent *event); + void leaveEvent(QEvent *event); + void mouseMoveEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + void mousePressEvent(QMouseEvent *event); + void mouseDoubleClickEvent(QMouseEvent *event); + void wheelEvent(QWheelEvent *event); + void resizeEvent(QResizeEvent *event); signals: - + void select(bool); public slots: void timeout(void); @@ -130,6 +143,8 @@ private: QMap DataSeries; + bool isSelected = false; + }; #endif // CHART_H diff --git a/App/GCS_zh_CN.qm b/App/GCS_zh_C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J zjRdrduUaBFccGef(>DP;!StdfU4PmtAgUHyckkPsc6l1-e(b@<~ zux??rc7hz%FBs#zoR~;)-?$CRz!}`k%9AKQ9k=Qcdbsx=T=__3;Jt{^zlke%7oo|- z)l{K7^yysfgl4QWxw<sY+@*pc1x=LQrc-bk4t2tv~vd7uSn)|HxmYj$f~B}<~2`~H6KXA#tV#w z53*KwJK7HLvQ`wE@gqOzECR43@ZX-OAPODEm+osI^7)=$Ylwio?fiy2cG#=t_eXaT zIkj*2lV?%IJ_f$^=0!NZ#$OiKqi;(X<2Lh;ic8@jQJ$HQhYXVBnMrG)Oocq#eS^w^ zE%O$4kJR_?2U^sU0S;g1oxL)h(i1@~@+aKMrYKTm|Fl%42*-5udgJ3c3# ze+q9`3`QVYPuYtn$f$(T{J?W^-emN1uIFDD_agHw&v!gB2zsHA)Qmv89#sq$DAKE6B9K^x{{71J zU40?hYvuaqr@?bdR}&luu2!~Nkg0quV??>iLkFco%T#BPpDCYP>YDFa0K{0B@O(f9Qr7jixP}D!FOD*n+f2aDu$y{vM#Tb~( z7-mzyPi{cOuNV#bLKMPP*OVa5aY5Tl!)Ff|_hCbmb1uHH*o`4h%biy*3u+K%`B5Sj z(p)OQ?}5cMorjK=VtG=AgLscZh* zGCVhLragE}u4CqBTUW_tKWXs)$&f0;KHHw>=(c1snLaa?mEyW) Q)7D>(NR`zmnD=@83*^5#M*si- diff --git a/App/GCS_zh_CN.ts b/App/GCS_zh_CN.ts index 57c7815..202c9bb 100644 --- a/App/GCS_zh_CN.ts +++ b/App/GCS_zh_CN.ts @@ -2066,31 +2066,31 @@ 参数 - - + + Communication Lost 通讯丢失 - - + + Communication Regain 通讯已恢复 - - - + + + 未定位 - + %1D[%2颗] %1D[%2颗] - + fix[%1颗] %1D Fix 差分[%1颗] @@ -2108,370 +2108,370 @@ GPS错误 - + float[%1颗] 浮点[%1颗] - + err[%1颗] 错误[%1颗] - + ARM 解锁 - + DISARM 上锁 - + MANUAL 手动 - + ALTCTL 定高 - + POSCTL 定点 - + AUTO 自主 - + ACRO - + OFFBOARD - + STABILIZED 增稳 - + RATTITUDE 速率 - + STANDBY 待机 - + BIT 测试 - + AUTO_READY 就绪 - + AUTO_TAKEOFF 起飞 - + AUTO_LOITER 盘旋 - + AUTO_MISSION 任务 - + AUTO_RTL 返航 - + AUTO_LAND 着陆 - + AUTO_RTGS RTGS - + AUTO_FOLLOW_TARGET 目标跟随 - + 开加力 - + 半加力 - + 全加力 - - + + 关加力 - + 伞舱开 - + 伞舱关 - + INS解算正常 - + INS星数不足 - + INS内部错误 - + INS速度超限 - + SBG解算正常 - + SBG星数不足 - + SBG内部错误 - + SBG速度超限 - - + + - + GPS Unlocated 未定位 - + %1D - + fixed - + float - + %1 - - + + 未初始化 - - + + 垂直陀螺 - - + + AHRS - - + + 速度导航 - - + + 位置导航 - - - - - - - - + + + + + + + + 正常 - - - - - - - - - - + + + + + + + + + + 无效 - - + + 解算正常 - - + + 卫星数不足 - - + + 内部错误 - - + + 速度超限 - - - - + + + + 未知 - - + + 多普勒 - - + + 微分 - - + + 单点 - - + + 伪距差分 - - + + SBAS广域差分 - - + + 广域差分 - - + + RTK_FLOAT - - + + RTK_INT - - + + PPP_FLOAT - - + + PPP_INT - - + + FIXED @@ -2480,17 +2480,17 @@ 未支持 - + flight mode 飞行模式 - + 连接内置惯导 - + 连接SBG @@ -2725,18 +2725,23 @@ 无人机 %1 - + + 修改参数 %1 %2 + + + + Save Parameter File... 保存参数... - - + + parameters file (*.params) 参数文件 (*.params) - + Selete Parameter File... 选择参数... @@ -3210,125 +3215,125 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 0 - + 海拔[m] - + GPS - + BIT 测试 - + 纬度[°] - + 速度状态 - + p[°/s] - + 航向状态 - + 姿态状态 - + 外部大气机 - + 位置状态 - + 气压高度[m] - + 表速[m/s] - + 真空速[m/s] @@ -3338,119 +3343,119 @@ - + 动压[hPa] - + 静压[hPa] - + 内部大气机 - + 惯导状态 - + COM - + 卫星数 - + r[°/s] - + 外部惯导 - + System - + 滚转角[°] - + 内部惯导 - + q[°/s] - + 俯仰角[°] - + 马赫数 - + ax[m/s2] - + 经度[°] - + 地速[m/s] - + ay[m/s2] - + 航向角[°] - + 大气机状态 - + 航迹角[°] - + az[m/s2] sensor - + 传感器 @@ -4020,65 +4025,65 @@ - - - - - - - - + + + + + + + + 警告 - - + + 请选择测试项和测试点 - + 请设定给定转速 - - - - + + + + 请设定目标 - + 设定舵机 %1 %2 - + 请设定 - + 设定舵机归零 %1 - + %1 %2kg - - - - - - - + + + + + + + 设定 %1 @@ -4428,33 +4433,23 @@ 日志 - - welcome - - - - - uav ground control system - - - - + [%1] %2 >> %3 - + [%1] %2 >> %3 - + Selete Path of File... 选择文件路径... - + log file (*.log) diff --git a/App/ToolsUI/PowerSystem/PowerSystem.cpp b/App/ToolsUI/PowerSystem/PowerSystem.cpp index a9f50b3..2b6f1f9 100644 --- a/App/ToolsUI/PowerSystem/PowerSystem.cpp +++ b/App/ToolsUI/PowerSystem/PowerSystem.cpp @@ -102,6 +102,12 @@ PowerSystem::PowerSystem(QWidget *parent) : cmdList.insert(0xea,"加力点火快速阀"); + ui->frame_RPM->resize(590,176); + ui->frame_Temp->resize(590,176); + ui->frame_Alt->resize(590,176); + ui->frame_Ma->resize(590,176); + + ScopeRPM = new Chart(ui->frame_RPM); ScopeTemp = new Chart(ui->frame_Temp); ScopeAlt = new Chart(ui->frame_Alt); @@ -148,6 +154,8 @@ void PowerSystem::resizeEvent(QResizeEvent *event) ScopeTemp->setGeometry(0,0,ui->frame_Temp->width(),ui->frame_Temp->height()); ScopeAlt->setGeometry(0,0,ui->frame_Alt->width(),ui->frame_Alt->height()); ScopeMa->setGeometry(0,0,ui->frame_Ma->width(),ui->frame_Ma->height()); + + //qDebug() << ui->frame_Ma->size(); } void PowerSystem::mousePressEvent(QMouseEvent *event) diff --git a/App/ToolsUI/Senser/Senser.cpp b/App/ToolsUI/Senser/Senser.cpp index 031e86e..2ff6928 100644 --- a/App/ToolsUI/Senser/Senser.cpp +++ b/App/ToolsUI/Senser/Senser.cpp @@ -17,12 +17,14 @@ Senser::Senser(QWidget *parent) : this->setWindowTitle(tr("sensor")); - //ui->frame_Attitude->resize(400,300); - //ui->frame_Gyro->resize(400,300); - //ui->frame_Accelerate->resize(400,300); - //ui->frame_Servo->resize(400,300); - //ui->frame_Altitude->resize(400,300); - //ui->frame_Speed->resize(400,300); + ui->frame_Attitude->resize(490,235); + ui->frame_Gyro->resize(490,235); + ui->frame_Accelerate->resize(490,235); + ui->frame_Servo->resize(490,235); + ui->frame_Altitude->resize(490,235); + ui->frame_Speed->resize(490,235); + + attChart = new Chart(ui->frame_Attitude); @@ -84,75 +86,24 @@ Senser::Senser(QWidget *parent) : altChart->setRubberBand(QChartView::RectangleRubberBand); speedChart->setRubberBand(QChartView::RectangleRubberBand); - //======================================================= - /* - connect(ui->checkBox_ins_ax,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_acc_stateChanged); - connect(ui->checkBox_ins_ay,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_acc_stateChanged); + connect(attChart,&Chart::select, + this,&Senser::chartSelect); - connect(ui->checkBox_ins_az,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_acc_stateChanged); - //======================================================= - connect(ui->checkBox_ins_p,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_gyro_stateChanged); + connect(gyroChart,&Chart::select, + this,&Senser::chartSelect); - connect(ui->checkBox_ins_q,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_gyro_stateChanged); + connect(accChart,&Chart::select, + this,&Senser::chartSelect); - connect(ui->checkBox_ins_r,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_gyro_stateChanged); - //======================================================= - connect(ui->checkBox_ins_rol,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_att_stateChanged); + connect(servoChart,&Chart::select, + this,&Senser::chartSelect); - connect(ui->checkBox_ins_pit,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_att_stateChanged); + connect(altChart,&Chart::select, + this,&Senser::chartSelect); - - //======================================================= - connect(ui->checkBox_sbg_ax,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_acc_stateChanged); - - connect(ui->checkBox_sbg_ay,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_acc_stateChanged); - - connect(ui->checkBox_sbg_az,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_acc_stateChanged); - //======================================================= - connect(ui->checkBox_sbg_p,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_gyro_stateChanged); - - connect(ui->checkBox_sbg_q,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_gyro_stateChanged); - - connect(ui->checkBox_sbg_r,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_gyro_stateChanged); - //======================================================= - connect(ui->checkBox_sbg_rol,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_att_stateChanged); - - connect(ui->checkBox_sbg_pit,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_att_stateChanged); - - - //======================================================= - connect(ui->checkBox_use_p,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_gyro_stateChanged); - - connect(ui->checkBox_use_q,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_gyro_stateChanged); - - connect(ui->checkBox_use_r,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_gyro_stateChanged); - //======================================================= - connect(ui->checkBox_use_rol,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_att_stateChanged); - - connect(ui->checkBox_use_pit,&QCheckBox::stateChanged, - this,&Senser::on_checkBox_att_stateChanged); -*/ + connect(speedChart,&Chart::select, + this,&Senser::chartSelect); } @@ -162,6 +113,149 @@ Senser::~Senser() delete ui; } +void Senser::chartSelect(bool flag) +{ + if(flag) + { + QObject *obj = sender(); + + if(obj) + { + Chart *chart = qobject_cast(obj); + if(chart) + { + + if(chart == attChart) + { + setColor(ui->frame_Attitude,QColor("#00FF00")); + setColor(ui->frame_Gyro,QColor("#FFFFFF")); + setColor(ui->frame_Accelerate,QColor("#FFFFFF")); + setColor(ui->frame_Servo,QColor("#FFFFFF")); + setColor(ui->frame_Altitude,QColor("#FFFFFF")); + setColor(ui->frame_Speed,QColor("#FFFFFF")); + + attChart->setSelect(true); + gyroChart->setSelect(false); + accChart->setSelect(false); + servoChart->setSelect(false); + altChart->setSelect(false); + speedChart->setSelect(false); + + } + else if(chart == gyroChart) + { + setColor(ui->frame_Attitude,QColor("#FFFFFF")); + setColor(ui->frame_Gyro,QColor("#00FF00")); + setColor(ui->frame_Accelerate,QColor("#FFFFFF")); + setColor(ui->frame_Servo,QColor("#FFFFFF")); + setColor(ui->frame_Altitude,QColor("#FFFFFF")); + setColor(ui->frame_Speed,QColor("#FFFFFF")); + + attChart->setSelect(false); + gyroChart->setSelect(true); + accChart->setSelect(false); + servoChart->setSelect(false); + altChart->setSelect(false); + speedChart->setSelect(false); + } + else if(chart == accChart) + { + setColor(ui->frame_Attitude,QColor("#FFFFFF")); + setColor(ui->frame_Gyro,QColor("#FFFFFF")); + setColor(ui->frame_Accelerate,QColor("#00FF00")); + setColor(ui->frame_Servo,QColor("#FFFFFF")); + setColor(ui->frame_Altitude,QColor("#FFFFFF")); + setColor(ui->frame_Speed,QColor("#FFFFFF")); + + attChart->setSelect(false); + gyroChart->setSelect(false); + accChart->setSelect(true); + servoChart->setSelect(false); + altChart->setSelect(false); + speedChart->setSelect(false); + } + else if(chart == servoChart) + { + setColor(ui->frame_Attitude,QColor("#FFFFFF")); + setColor(ui->frame_Gyro,QColor("#FFFFFF")); + setColor(ui->frame_Accelerate,QColor("#FFFFFF")); + setColor(ui->frame_Servo,QColor("#00FF00")); + setColor(ui->frame_Altitude,QColor("#FFFFFF")); + setColor(ui->frame_Speed,QColor("#FFFFFF")); + + attChart->setSelect(false); + gyroChart->setSelect(false); + accChart->setSelect(false); + servoChart->setSelect(true); + altChart->setSelect(false); + speedChart->setSelect(false); + } + else if(chart == altChart) + { + setColor(ui->frame_Attitude,QColor("#FFFFFF")); + setColor(ui->frame_Gyro,QColor("#FFFFFF")); + setColor(ui->frame_Accelerate,QColor("#FFFFFF")); + setColor(ui->frame_Servo,QColor("#FFFFFF")); + setColor(ui->frame_Altitude,QColor("#00FF00")); + setColor(ui->frame_Speed,QColor("#FFFFFF")); + + attChart->setSelect(false); + gyroChart->setSelect(false); + accChart->setSelect(false); + servoChart->setSelect(false); + altChart->setSelect(true); + speedChart->setSelect(false); + } + else if(chart == speedChart) + { + setColor(ui->frame_Attitude,QColor("#FFFFFF")); + setColor(ui->frame_Gyro,QColor("#FFFFFF")); + setColor(ui->frame_Accelerate,QColor("#FFFFFF")); + setColor(ui->frame_Servo,QColor("#FFFFFF")); + setColor(ui->frame_Altitude,QColor("#FFFFFF")); + setColor(ui->frame_Speed,QColor("#00FF00")); + + attChart->setSelect(false); + gyroChart->setSelect(false); + accChart->setSelect(false); + servoChart->setSelect(false); + altChart->setSelect(false); + speedChart->setSelect(true); + } + } + } + } + else + { + setColor(ui->frame_Attitude,QColor("#FFFFFF")); + setColor(ui->frame_Gyro,QColor("#FFFFFF")); + setColor(ui->frame_Accelerate,QColor("#FFFFFF")); + setColor(ui->frame_Servo,QColor("#FFFFFF")); + setColor(ui->frame_Altitude,QColor("#FFFFFF")); + setColor(ui->frame_Speed,QColor("#FFFFFF")); + + attChart->setSelect(false); + gyroChart->setSelect(false); + accChart->setSelect(false); + servoChart->setSelect(false); + altChart->setSelect(false); + speedChart->setSelect(false); + } +} + +void Senser::setColor(QWidget *w,QColor s) +{ + QString stype = "background-color: "; + stype.append(s.name()); + stype.append(";"); + + if(w) + { + w->setStyleSheet(stype); + w->style()->unpolish(w); + w->style()->polish(w); + } +} void Senser::setColor(QWidget *w,state s) { diff --git a/App/ToolsUI/Senser/Senser.h b/App/ToolsUI/Senser/Senser.h index b7758eb..923a9b8 100644 --- a/App/ToolsUI/Senser/Senser.h +++ b/App/ToolsUI/Senser/Senser.h @@ -40,6 +40,7 @@ public: explicit Senser(QWidget *parent = nullptr); ~Senser(); + void setColor(QWidget *w, QColor s); void setColor(QWidget *w,state s); void setValue(QLabel *w,QString s); void setFloat(void); @@ -58,8 +59,14 @@ public: Chart *servoChart = nullptr; Chart *altChart = nullptr; + + + private slots: + void chartSelect(bool flag); + + void on_checkBox_att_stateChanged(int arg1); void on_checkBox_gyro_stateChanged(int arg1); void on_checkBox_acc_stateChanged(int arg1); diff --git a/App/ToolsUI/Senser/Senser.ui b/App/ToolsUI/Senser/Senser.ui index 1a27574..18d513b 100644 --- a/App/ToolsUI/Senser/Senser.ui +++ b/App/ToolsUI/Senser/Senser.ui @@ -6,8 +6,8 @@ 0 0 - 1282 - 912 + 1920 + 1080 @@ -126,12 +126,16 @@ + + background-color: rgb(0, 255, 0); + QFrame::StyledPanel QFrame::Raised +