调整滤波可以小数,主视图界面优化,波形频域负数问题

This commit is contained in:
zhangsheng 2024-12-05 14:51:03 +08:00
parent 540fa39190
commit e67a50b489
6 changed files with 28 additions and 16 deletions

View File

@ -238,7 +238,7 @@ color: rgb(27, 30, 35);</string>
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Available Logic Tags</string>
<string>可用逻辑元素</string>
</property>
</widget>
</item>
@ -279,7 +279,7 @@ color: rgb(27, 30, 35);</string>
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>Relay Logic Editor</string>
<string>继电器逻辑编辑器</string>
</property>
</widget>
</item>

View File

@ -73,10 +73,10 @@ void CustomFilter::on_pushButton_Submit_clicked()
for(int i = 0; i < rowCount;i++){
QModelIndex index = model->index(i,0);
QString strData = model->data(index).toString();
range.append(strData.toInt());
range.append(strData.toFloat());
index = model->index(i,1);
strData = model->data(index).toString();
range.append(strData.toInt());
range.append(strData.toFloat());
}
sendData["range"] = range;
QNetworkRequest req;
@ -163,7 +163,7 @@ void CustomFilter::slotNetMgr(QString sAddr, const QVariant &msg)
model->setRowCount(num);
QJsonArray range = objec["range"].toArray();
for (int i = 0; i < num; i++) {
model->setData(model->index(i,0,QModelIndex()),range[j].toInt());
model->setData(model->index(i,0,QModelIndex()),range[j].toDouble());
j++;
model->setData(model->index(i,1,QModelIndex()),range[j].toInt());
j++;

View File

@ -87,6 +87,7 @@ HEADERS += \
CopyChannelSetting.h \
CopyDatFile.h \
CustomFilter.h \
CustomGraphicsItemGroup.h \
DIO_Board.h \
DataGraphView.h \
FileServerConfig.h \
@ -181,9 +182,7 @@ DISTFILES += \
INCLUDEPATH += $$PWD/include/mqtt
INCLUDEPATH += $$PWD/include/fftw
INCLUDEPATH += $$PWD/include/ftp
LIBS += -L$$PWD/lib/ftp/ -lQt5Ftp
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/lib/fftw/ -llibfftw3-3 -llibfftw3f-3 -llibfftw3l-3
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/lib/fftw/ -llibfftw3-3 -llibfftw3f-3 -llibfftw3l-3

View File

@ -319,7 +319,7 @@ void CWaveDisPlay::ParseDataFsWave(QJsonObject & objContent)
float gap = 0;
for(int i = 0; i < m_ListWaveData.size();i++){
x.push_back(gap);
y.push_back(m_ListWaveData[i].toDouble());
y.push_back(qAbs(m_ListWaveData[i].toDouble()));
if(g_strFre == "1")
gap += 1;
else if(g_strFre == "0.25")

View File

@ -566,12 +566,16 @@ color:#ffffff;
background:#245d9b;
}
QTableView::item,QListView::item,QTreeView::item{
QTableView::item,QListView::item{
padding:1px;
margin:0px;
border:0px;
}
QTreeView::item{
padding:1px;
margin:3px;
border:0px;
}
QHeaderView::verticalHeader{
background:#ffffff;
}

View File

@ -17,6 +17,7 @@
#include <algorithm>
#include "customrectitem.h"
#include "mygraphicrectitem.h"
#include "CustomGraphicsItemGroup.h"
CRealTimeForm::CRealTimeForm(QWidget *parent) :
@ -27,10 +28,16 @@ CRealTimeForm::CRealTimeForm(QWidget *parent) :
QObject::connect(ui->graphicsView, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(on_graphView_customContextMenuRequested(const QPoint &)));
ui->graphicsView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
m_pGraphicsScene = new QGraphicsScene();
m_pGraphicsScene->setBackgroundBrush(Qt::transparent); // 设置场景背景透明
m_pGraphicsScene->setSceneRect(0, 0, 600, 550);
ui->graphicsView->setScene(m_pGraphicsScene);
ui->graphicsView->setDragMode(QGraphicsView::RubberBandDrag);
ui->graphicsView->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ui->graphicsView->setRenderHint(QPainter::Antialiasing, true); // 启用视图抗锯齿
ui->graphicsView->setBackgroundBrush(Qt::gray); // 设置视图背景为灰色
ui->graphicsView->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
ui->graphicsView_2->setContextMenuPolicy(Qt::CustomContextMenu);
QObject::connect(ui->graphicsView_2, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(on_graphView_customContextMenuRequested(const QPoint &)));
ui->graphicsView_2->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
@ -308,9 +315,9 @@ void CRealTimeForm::on_addchannel(channelBaseInfo channelbaseInfo, QString str)
QPen pen; // 定义一个画笔,设置画笔颜色和宽度
pen.setColor(QColor(0, 0, 0, 0));
pen.setWidth(1);
CMyCustomGraphicsItem *pItemGroup = new CMyCustomGraphicsItem();
RoundedGraphicsItemGroup *pItemGroup = new RoundedGraphicsItemGroup();
pItemGroup->setCornerRadius(15); // 设置圆角半径
QGraphicsRectItem *pRect = new QGraphicsRectItem(0, 0, 290, 30);
pRect->setBrush(QBrush(QColor(255, 255, 255)));
pRect->setPen(pen);
pRect->setPos(0, 0);
pRect->setData(1, "Rect");
@ -387,7 +394,7 @@ void CRealTimeForm::on_addchannel(channelBaseInfo channelbaseInfo, QString str)
pTextValue->setFont(font2);
pTextValue->setPos(160, -2);
pTextValue->setDefaultTextColor(QColor(31, 81, 136));
pTextChannel->setPos(0, 2);
pTextChannel->setPos(0, 5);
pTextChannel->setDefaultTextColor(QColor(27, 30, 35));
pTextUnits->setPos(240, 5);
// 设置可移动、可选择
@ -939,11 +946,13 @@ void CRealTimeForm::LoadGraphicsConfig(int type) {
QJsonArray array = arrayValue.toArray();
for (int i = 0; i < array.size(); i++) {
channelBaseInfo temp;
CMyCustomGraphicsItem *pItemGroup = new CMyCustomGraphicsItem();
RoundedGraphicsItemGroup *pItemGroup = new RoundedGraphicsItemGroup();
pItemGroup->setCornerRadius(15); // 设置圆角半径
if (type == 1) {
pItemGroup->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
pItemGroup->setFlag(QGraphicsItem::ItemIsSelectable, true);
}
connect(pItemGroup, SIGNAL(doubleclick(QGraphicsSceneMouseEvent *)), this, SLOT(slotDoubleClick(QGraphicsSceneMouseEvent *)));
//connect(pItemGroup, SIGNAL(doubleclick(QGraphicsSceneMouseEvent *)), this, SLOT(slotDoubleClick(QGraphicsSceneMouseEvent *)));
//qDebug() << array.at(i)["x"].toDouble() << array.at(i)["y"].toDouble() << endl;
QJsonObject jsonObject = array.at(i).toObject();
if (jsonObject.contains(QStringLiteral("Rect"))) {
@ -961,7 +970,7 @@ void CRealTimeForm::LoadGraphicsConfig(int type) {
if (type == 1) {
pRect->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
}
pRect->setBrush(QBrush(QColor(255, 255, 255)));
//pRect->setBrush(QBrush(QColor(255, 255, 255)));
pRect->setPen(pen);
pItemGroup->addToGroup(pRect);
}