diff --git a/ChannelItem.cpp b/ChannelItem.cpp index 6a77a0b..aa8ae8b 100644 --- a/ChannelItem.cpp +++ b/ChannelItem.cpp @@ -30,7 +30,7 @@ { int size = phaseVector.at(index).size(); double ps = phaseData->channelData.at(index) * 1e12; // 显示ps数据 - ui->rawValue->setText(QString::number(ps, 'f', 3) + "ps"); // 原始数据显示单位为ps +// ui->rawValue->setText(QString::number(ps, 'f', 3) + "ps"); // 原始数据显示单位为ps ui->samplingOne->setText(QString::number(size)); ui->samplingTen->setText(QString::number((int)size/10)); ui->samplingHund->setText(QString::number((int)size/100)); diff --git a/ChannelItem.cpp b/ChannelItem.cpp index 6a77a0b..aa8ae8b 100644 --- a/ChannelItem.cpp +++ b/ChannelItem.cpp @@ -30,7 +30,7 @@ { int size = phaseVector.at(index).size(); double ps = phaseData->channelData.at(index) * 1e12; // 显示ps数据 - ui->rawValue->setText(QString::number(ps, 'f', 3) + "ps"); // 原始数据显示单位为ps +// ui->rawValue->setText(QString::number(ps, 'f', 3) + "ps"); // 原始数据显示单位为ps ui->samplingOne->setText(QString::number(size)); ui->samplingTen->setText(QString::number((int)size/10)); ui->samplingHund->setText(QString::number((int)size/100)); diff --git a/ChannelItem.ui b/ChannelItem.ui index 482666d..2818586 100644 --- a/ChannelItem.ui +++ b/ChannelItem.ui @@ -7,13 +7,13 @@ 0 0 1300 - 160 + 125 0 - 160 + 125 @@ -22,9 +22,9 @@ - 430 + 30 0 - 81 + 80 20 @@ -60,9 +60,9 @@ - 430 + 30 50 - 681 + 1050 35 @@ -137,12 +137,12 @@ - 1000 + 100 - + 微软雅黑 @@ -158,7 +158,7 @@ - + 微软雅黑 @@ -173,14 +173,75 @@ + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 80 + 20 + + + + + + + + + 微软雅黑 + 12 + + + + 10000 + + + + + + + + 微软雅黑 + 12 + + + + 0 + + + Qt::AlignCenter + + + + + + + + 微软雅黑 + 12 + + + + 0.00 + + + Qt::AlignCenter + + + - 430 + 30 85 - 681 + 1050 35 @@ -255,12 +316,12 @@ - 10000 + 1000 - + 微软雅黑 @@ -276,64 +337,7 @@ - - - - 微软雅黑 - 12 - - - - 0 - - - Qt::AlignCenter - - - - - - - - - 430 - 120 - 681 - 35 - - - - - - - - 微软雅黑 - 12 - - - - 100 - - - - - - - - 微软雅黑 - 12 - - - - 0.00 - - - Qt::AlignCenter - - - - - + 微软雅黑 @@ -365,6 +369,19 @@ + + + + 微软雅黑 + 12 + + + + + + + + @@ -378,7 +395,7 @@ - + 微软雅黑 @@ -388,25 +405,6 @@ - - Qt::AlignCenter - - - - - - - - 微软雅黑 - 12 - - - - - - - Qt::AlignCenter - @@ -473,88 +471,12 @@ - - - - 60 - 10 - 101 - 160 - - - - - - - - 微软雅黑 - 12 - - - - 测量数据: - - - - - - - - 微软雅黑 - 12 - - - - 准确度: - - - - - - - - - 190 - 10 - 200 - 160 - - - - - - - - 微软雅黑 - 12 - - - - 0 ps - - - - - - - - 微软雅黑 - 12 - - - - 0.00 - - - - - - 430 + 30 20 - 681 + 1050 41 @@ -665,6 +587,67 @@ + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 80 + 20 + + + + + + + + + 微软雅黑 + 12 + + + + Tau(s) + + + + + + + + 微软雅黑 + 12 + + + + Allen方差 + + + Qt::AlignCenter + + + + + + + + 微软雅黑 + 12 + + + + 采样数 + + + Qt::AlignCenter + + + diff --git a/ChannelItem.cpp b/ChannelItem.cpp index 6a77a0b..aa8ae8b 100644 --- a/ChannelItem.cpp +++ b/ChannelItem.cpp @@ -30,7 +30,7 @@ { int size = phaseVector.at(index).size(); double ps = phaseData->channelData.at(index) * 1e12; // 显示ps数据 - ui->rawValue->setText(QString::number(ps, 'f', 3) + "ps"); // 原始数据显示单位为ps +// ui->rawValue->setText(QString::number(ps, 'f', 3) + "ps"); // 原始数据显示单位为ps ui->samplingOne->setText(QString::number(size)); ui->samplingTen->setText(QString::number((int)size/10)); ui->samplingHund->setText(QString::number((int)size/100)); diff --git a/ChannelItem.ui b/ChannelItem.ui index 482666d..2818586 100644 --- a/ChannelItem.ui +++ b/ChannelItem.ui @@ -7,13 +7,13 @@ 0 0 1300 - 160 + 125 0 - 160 + 125 @@ -22,9 +22,9 @@ - 430 + 30 0 - 81 + 80 20 @@ -60,9 +60,9 @@ - 430 + 30 50 - 681 + 1050 35 @@ -137,12 +137,12 @@ - 1000 + 100 - + 微软雅黑 @@ -158,7 +158,7 @@ - + 微软雅黑 @@ -173,14 +173,75 @@ + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 80 + 20 + + + + + + + + + 微软雅黑 + 12 + + + + 10000 + + + + + + + + 微软雅黑 + 12 + + + + 0 + + + Qt::AlignCenter + + + + + + + + 微软雅黑 + 12 + + + + 0.00 + + + Qt::AlignCenter + + + - 430 + 30 85 - 681 + 1050 35 @@ -255,12 +316,12 @@ - 10000 + 1000 - + 微软雅黑 @@ -276,64 +337,7 @@ - - - - 微软雅黑 - 12 - - - - 0 - - - Qt::AlignCenter - - - - - - - - - 430 - 120 - 681 - 35 - - - - - - - - 微软雅黑 - 12 - - - - 100 - - - - - - - - 微软雅黑 - 12 - - - - 0.00 - - - Qt::AlignCenter - - - - - + 微软雅黑 @@ -365,6 +369,19 @@ + + + + 微软雅黑 + 12 + + + + + + + + @@ -378,7 +395,7 @@ - + 微软雅黑 @@ -388,25 +405,6 @@ - - Qt::AlignCenter - - - - - - - - 微软雅黑 - 12 - - - - - - - Qt::AlignCenter - @@ -473,88 +471,12 @@ - - - - 60 - 10 - 101 - 160 - - - - - - - - 微软雅黑 - 12 - - - - 测量数据: - - - - - - - - 微软雅黑 - 12 - - - - 准确度: - - - - - - - - - 190 - 10 - 200 - 160 - - - - - - - - 微软雅黑 - 12 - - - - 0 ps - - - - - - - - 微软雅黑 - 12 - - - - 0.00 - - - - - - 430 + 30 20 - 681 + 1050 41 @@ -665,6 +587,67 @@ + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 80 + 20 + + + + + + + + + 微软雅黑 + 12 + + + + Tau(s) + + + + + + + + 微软雅黑 + 12 + + + + Allen方差 + + + Qt::AlignCenter + + + + + + + + 微软雅黑 + 12 + + + + 采样数 + + + Qt::AlignCenter + + + diff --git a/PhaseWindow.cpp b/PhaseWindow.cpp index 495def0..0c9134a 100644 --- a/PhaseWindow.cpp +++ b/PhaseWindow.cpp @@ -39,6 +39,29 @@ delete ui; } +void PhaseWindow::mouseMoveEvent(QMouseEvent *event) +{ + QWidget::mouseMoveEvent(event); + QPoint y = event->globalPos();//鼠标相对于桌面左上角的位置,鼠标全局位置 + QPoint x = y - this->last; + + this->move(x); +} + +void PhaseWindow::mousePressEvent(QMouseEvent *event) +{ + QWidget::mousePressEvent(event); + QPoint y = event->globalPos();//鼠标相对于桌面左上角的位置,鼠标全局位置 + QPoint x = this->geometry().topLeft();//窗口左上角相对于桌面左上角的位置,窗口位置 + this->last = y - x;//定值,不变的 +} + +void PhaseWindow::mouseReleaseEvent(QMouseEvent *event) +{ + QWidget::mouseReleaseEvent(event); + this->last = QPoint();//鼠标松开的时候,将z值初始化 +} + void PhaseWindow::initForm() { this->setProperty("form", true); @@ -52,8 +75,9 @@ qint16 screenHeight = screenRect.height(); // 设置窗口位置和大小 - move(0, 0); - resize(screenWidth, screenHeight); + move(screenWidth / 2 - 688, 50); +// resize(screenWidth, screenHeight); + resize(1366, screenHeight - 100); // 设置最小和关闭按钮的样式 IconHelper::Instance()->setIcon(ui->btnMenuMin, QChar(0xf068)); @@ -122,6 +146,9 @@ { ChannelItem * channel = channelItemList.at(i); channel->updatePhaseMeasureData(phaseData); + + QString valueStr = QString::number(phaseData->channelData.at(i) * 1E12, 'f', 3); + ((QGroupBox *) ui->scrollContents->children().at(i + 1))->setTitle(QString("通道 - %1 测量结果:%2 ps").arg(i + 1).arg(valueStr)); } } } diff --git a/ChannelItem.cpp b/ChannelItem.cpp index 6a77a0b..aa8ae8b 100644 --- a/ChannelItem.cpp +++ b/ChannelItem.cpp @@ -30,7 +30,7 @@ { int size = phaseVector.at(index).size(); double ps = phaseData->channelData.at(index) * 1e12; // 显示ps数据 - ui->rawValue->setText(QString::number(ps, 'f', 3) + "ps"); // 原始数据显示单位为ps +// ui->rawValue->setText(QString::number(ps, 'f', 3) + "ps"); // 原始数据显示单位为ps ui->samplingOne->setText(QString::number(size)); ui->samplingTen->setText(QString::number((int)size/10)); ui->samplingHund->setText(QString::number((int)size/100)); diff --git a/ChannelItem.ui b/ChannelItem.ui index 482666d..2818586 100644 --- a/ChannelItem.ui +++ b/ChannelItem.ui @@ -7,13 +7,13 @@ 0 0 1300 - 160 + 125 0 - 160 + 125 @@ -22,9 +22,9 @@ - 430 + 30 0 - 81 + 80 20 @@ -60,9 +60,9 @@ - 430 + 30 50 - 681 + 1050 35 @@ -137,12 +137,12 @@ - 1000 + 100 - + 微软雅黑 @@ -158,7 +158,7 @@ - + 微软雅黑 @@ -173,14 +173,75 @@ + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 80 + 20 + + + + + + + + + 微软雅黑 + 12 + + + + 10000 + + + + + + + + 微软雅黑 + 12 + + + + 0 + + + Qt::AlignCenter + + + + + + + + 微软雅黑 + 12 + + + + 0.00 + + + Qt::AlignCenter + + + - 430 + 30 85 - 681 + 1050 35 @@ -255,12 +316,12 @@ - 10000 + 1000 - + 微软雅黑 @@ -276,64 +337,7 @@ - - - - 微软雅黑 - 12 - - - - 0 - - - Qt::AlignCenter - - - - - - - - - 430 - 120 - 681 - 35 - - - - - - - - 微软雅黑 - 12 - - - - 100 - - - - - - - - 微软雅黑 - 12 - - - - 0.00 - - - Qt::AlignCenter - - - - - + 微软雅黑 @@ -365,6 +369,19 @@ + + + + 微软雅黑 + 12 + + + + + + + + @@ -378,7 +395,7 @@ - + 微软雅黑 @@ -388,25 +405,6 @@ - - Qt::AlignCenter - - - - - - - - 微软雅黑 - 12 - - - - - - - Qt::AlignCenter - @@ -473,88 +471,12 @@ - - - - 60 - 10 - 101 - 160 - - - - - - - - 微软雅黑 - 12 - - - - 测量数据: - - - - - - - - 微软雅黑 - 12 - - - - 准确度: - - - - - - - - - 190 - 10 - 200 - 160 - - - - - - - - 微软雅黑 - 12 - - - - 0 ps - - - - - - - - 微软雅黑 - 12 - - - - 0.00 - - - - - - 430 + 30 20 - 681 + 1050 41 @@ -665,6 +587,67 @@ + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 80 + 20 + + + + + + + + + 微软雅黑 + 12 + + + + Tau(s) + + + + + + + + 微软雅黑 + 12 + + + + Allen方差 + + + Qt::AlignCenter + + + + + + + + 微软雅黑 + 12 + + + + 采样数 + + + Qt::AlignCenter + + + diff --git a/PhaseWindow.cpp b/PhaseWindow.cpp index 495def0..0c9134a 100644 --- a/PhaseWindow.cpp +++ b/PhaseWindow.cpp @@ -39,6 +39,29 @@ delete ui; } +void PhaseWindow::mouseMoveEvent(QMouseEvent *event) +{ + QWidget::mouseMoveEvent(event); + QPoint y = event->globalPos();//鼠标相对于桌面左上角的位置,鼠标全局位置 + QPoint x = y - this->last; + + this->move(x); +} + +void PhaseWindow::mousePressEvent(QMouseEvent *event) +{ + QWidget::mousePressEvent(event); + QPoint y = event->globalPos();//鼠标相对于桌面左上角的位置,鼠标全局位置 + QPoint x = this->geometry().topLeft();//窗口左上角相对于桌面左上角的位置,窗口位置 + this->last = y - x;//定值,不变的 +} + +void PhaseWindow::mouseReleaseEvent(QMouseEvent *event) +{ + QWidget::mouseReleaseEvent(event); + this->last = QPoint();//鼠标松开的时候,将z值初始化 +} + void PhaseWindow::initForm() { this->setProperty("form", true); @@ -52,8 +75,9 @@ qint16 screenHeight = screenRect.height(); // 设置窗口位置和大小 - move(0, 0); - resize(screenWidth, screenHeight); + move(screenWidth / 2 - 688, 50); +// resize(screenWidth, screenHeight); + resize(1366, screenHeight - 100); // 设置最小和关闭按钮的样式 IconHelper::Instance()->setIcon(ui->btnMenuMin, QChar(0xf068)); @@ -122,6 +146,9 @@ { ChannelItem * channel = channelItemList.at(i); channel->updatePhaseMeasureData(phaseData); + + QString valueStr = QString::number(phaseData->channelData.at(i) * 1E12, 'f', 3); + ((QGroupBox *) ui->scrollContents->children().at(i + 1))->setTitle(QString("通道 - %1 测量结果:%2 ps").arg(i + 1).arg(valueStr)); } } } diff --git a/PhaseWindow.h b/PhaseWindow.h index 1fcfeef..b4c33b1 100644 --- a/PhaseWindow.h +++ b/PhaseWindow.h @@ -21,6 +21,10 @@ explicit PhaseWindow(QWidget *parent = nullptr); ~PhaseWindow(); + void mouseMoveEvent(QMouseEvent *event); + void mousePressEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + public slots: void drawPhaseDataOnPage(PhaseDataDto * phaseData); @@ -35,6 +39,8 @@ private: Ui::PhaseWindow *ui; + QPoint last; + QList channelGroupList; QList channelItemList; diff --git a/ChannelItem.cpp b/ChannelItem.cpp index 6a77a0b..aa8ae8b 100644 --- a/ChannelItem.cpp +++ b/ChannelItem.cpp @@ -30,7 +30,7 @@ { int size = phaseVector.at(index).size(); double ps = phaseData->channelData.at(index) * 1e12; // 显示ps数据 - ui->rawValue->setText(QString::number(ps, 'f', 3) + "ps"); // 原始数据显示单位为ps +// ui->rawValue->setText(QString::number(ps, 'f', 3) + "ps"); // 原始数据显示单位为ps ui->samplingOne->setText(QString::number(size)); ui->samplingTen->setText(QString::number((int)size/10)); ui->samplingHund->setText(QString::number((int)size/100)); diff --git a/ChannelItem.ui b/ChannelItem.ui index 482666d..2818586 100644 --- a/ChannelItem.ui +++ b/ChannelItem.ui @@ -7,13 +7,13 @@ 0 0 1300 - 160 + 125 0 - 160 + 125 @@ -22,9 +22,9 @@ - 430 + 30 0 - 81 + 80 20 @@ -60,9 +60,9 @@ - 430 + 30 50 - 681 + 1050 35 @@ -137,12 +137,12 @@ - 1000 + 100 - + 微软雅黑 @@ -158,7 +158,7 @@ - + 微软雅黑 @@ -173,14 +173,75 @@ + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 80 + 20 + + + + + + + + + 微软雅黑 + 12 + + + + 10000 + + + + + + + + 微软雅黑 + 12 + + + + 0 + + + Qt::AlignCenter + + + + + + + + 微软雅黑 + 12 + + + + 0.00 + + + Qt::AlignCenter + + + - 430 + 30 85 - 681 + 1050 35 @@ -255,12 +316,12 @@ - 10000 + 1000 - + 微软雅黑 @@ -276,64 +337,7 @@ - - - - 微软雅黑 - 12 - - - - 0 - - - Qt::AlignCenter - - - - - - - - - 430 - 120 - 681 - 35 - - - - - - - - 微软雅黑 - 12 - - - - 100 - - - - - - - - 微软雅黑 - 12 - - - - 0.00 - - - Qt::AlignCenter - - - - - + 微软雅黑 @@ -365,6 +369,19 @@ + + + + 微软雅黑 + 12 + + + + + + + + @@ -378,7 +395,7 @@ - + 微软雅黑 @@ -388,25 +405,6 @@ - - Qt::AlignCenter - - - - - - - - 微软雅黑 - 12 - - - - - - - Qt::AlignCenter - @@ -473,88 +471,12 @@ - - - - 60 - 10 - 101 - 160 - - - - - - - - 微软雅黑 - 12 - - - - 测量数据: - - - - - - - - 微软雅黑 - 12 - - - - 准确度: - - - - - - - - - 190 - 10 - 200 - 160 - - - - - - - - 微软雅黑 - 12 - - - - 0 ps - - - - - - - - 微软雅黑 - 12 - - - - 0.00 - - - - - - 430 + 30 20 - 681 + 1050 41 @@ -665,6 +587,67 @@ + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 80 + 20 + + + + + + + + + 微软雅黑 + 12 + + + + Tau(s) + + + + + + + + 微软雅黑 + 12 + + + + Allen方差 + + + Qt::AlignCenter + + + + + + + + 微软雅黑 + 12 + + + + 采样数 + + + Qt::AlignCenter + + + diff --git a/PhaseWindow.cpp b/PhaseWindow.cpp index 495def0..0c9134a 100644 --- a/PhaseWindow.cpp +++ b/PhaseWindow.cpp @@ -39,6 +39,29 @@ delete ui; } +void PhaseWindow::mouseMoveEvent(QMouseEvent *event) +{ + QWidget::mouseMoveEvent(event); + QPoint y = event->globalPos();//鼠标相对于桌面左上角的位置,鼠标全局位置 + QPoint x = y - this->last; + + this->move(x); +} + +void PhaseWindow::mousePressEvent(QMouseEvent *event) +{ + QWidget::mousePressEvent(event); + QPoint y = event->globalPos();//鼠标相对于桌面左上角的位置,鼠标全局位置 + QPoint x = this->geometry().topLeft();//窗口左上角相对于桌面左上角的位置,窗口位置 + this->last = y - x;//定值,不变的 +} + +void PhaseWindow::mouseReleaseEvent(QMouseEvent *event) +{ + QWidget::mouseReleaseEvent(event); + this->last = QPoint();//鼠标松开的时候,将z值初始化 +} + void PhaseWindow::initForm() { this->setProperty("form", true); @@ -52,8 +75,9 @@ qint16 screenHeight = screenRect.height(); // 设置窗口位置和大小 - move(0, 0); - resize(screenWidth, screenHeight); + move(screenWidth / 2 - 688, 50); +// resize(screenWidth, screenHeight); + resize(1366, screenHeight - 100); // 设置最小和关闭按钮的样式 IconHelper::Instance()->setIcon(ui->btnMenuMin, QChar(0xf068)); @@ -122,6 +146,9 @@ { ChannelItem * channel = channelItemList.at(i); channel->updatePhaseMeasureData(phaseData); + + QString valueStr = QString::number(phaseData->channelData.at(i) * 1E12, 'f', 3); + ((QGroupBox *) ui->scrollContents->children().at(i + 1))->setTitle(QString("通道 - %1 测量结果:%2 ps").arg(i + 1).arg(valueStr)); } } } diff --git a/PhaseWindow.h b/PhaseWindow.h index 1fcfeef..b4c33b1 100644 --- a/PhaseWindow.h +++ b/PhaseWindow.h @@ -21,6 +21,10 @@ explicit PhaseWindow(QWidget *parent = nullptr); ~PhaseWindow(); + void mouseMoveEvent(QMouseEvent *event); + void mousePressEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + public slots: void drawPhaseDataOnPage(PhaseDataDto * phaseData); @@ -35,6 +39,8 @@ private: Ui::PhaseWindow *ui; + QPoint last; + QList channelGroupList; QList channelItemList; diff --git a/common/utils/QSerialPortUtil.cpp b/common/utils/QSerialPortUtil.cpp index 3509461..5668837 100644 --- a/common/utils/QSerialPortUtil.cpp +++ b/common/utils/QSerialPortUtil.cpp @@ -65,14 +65,14 @@ QByteArray buffer; buffer.append(QByteUtil::hexStringToBytes(frameId.mid(0, 8))); - for (int i = 1; i <= 4; i++) + for (int i = 1; i <= 6; i++) { int value = qrand() % 100 - 30; buffer.append(QByteUtil::hexStringToBytes("00800000")).append(QByteUtil::ULongToBytes(value + lastValue[i], 4)); lastValue[i] += value; } - for (int i = 5; i <= 16; i++) + for (int i = 7; i <= 16; i++) { buffer.append(QByteUtil::hexStringToBytes("0080000000000000")); }