#include "mainpage_power.h" mainpage_Power::mainpage_Power(QWidget *parent) : QWidget(parent) { label_4_1=new QLabel(this); label_4_2=new QLabel(this); label_4_3=new QLabel(this); label_4_4=new QLabel(this); label_4_5=new QLabel(this); label_4_6=new QLabel(this); label_4_7=new QLabel(this); label_4_8=new QLabel(this); label_4_9=new QLabel(this); label_4_10=new QLabel(this); label_4_11=new QLabel(this); label_4_12=new QLabel(this); label_4_13=new QLabel(this); label_4_14=new QLabel(this); label_4_15=new QLabel(this); label_4_16=new QLabel(this); label_4_17=new QLabel(this); label_4_18=new QLabel(this); label_4_19=new QLabel(this); label_3_10=new QLabel(this); label_3_11=new QLabel(this); line3_2=new QFrame(this); line4_1=new QFrame(this); line4_3=new QFrame(this); label_4_1->setGeometry(30,10,200,20); label_4_1->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(255, 255, 255)"); label_4_1->setText("有功功率:"); label_4_2->setGeometry(30,30,220,20); label_4_2->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(0, 0, 0)"); label_4_3->setGeometry(30,50,220,20); label_4_3->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(0, 0, 0)"); label_4_4->setGeometry(30,70,220,20); label_4_4->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(0, 0, 0)"); label_4_5->setGeometry(30,90,220,20); label_4_5->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(0, 0, 0)"); label_4_6->setGeometry(250,10,220,20); label_4_6->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(255, 255, 255)"); label_4_6->setText("无功功率:"); label_4_7->setGeometry(250,30,220,20); label_4_7->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(0, 0, 0)"); label_4_8->setGeometry(250,50,220,20); label_4_8->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(0, 0, 0)"); label_4_9->setGeometry(250,70,220,20); label_4_9->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(0, 0, 0)"); label_4_10->setGeometry(250,90,220,20); label_4_10->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(0, 0, 0)"); label_4_11->setGeometry(470,10,100,20); label_4_11->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(255, 255, 255)"); label_4_11->setText("功率因数:"); label_4_12->setGeometry(470,30,150,20); label_4_12->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(0, 0, 0)"); label_4_13->setGeometry(470,50,150,20); label_4_13->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(0, 0, 0)"); label_4_14->setGeometry(470,70,150,20); label_4_14->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(0, 0, 0)"); label_4_15->setGeometry(470,90,150,20); label_4_15->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(0, 0, 0)"); label_3_10->setGeometry(640,10,140,20); label_3_10->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(255, 255, 255)"); label_3_10->setText("视在功率:"); label_3_11->setGeometry(640,30,140,20); label_3_11->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(0, 0, 0)"); label_4_16->setGeometry(640,50,150,20); label_4_16->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(255, 255, 255)"); label_4_16->setText("有功需量:"); label_4_17->setGeometry(640,70,150,20); label_4_17->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(0, 0, 0)"); label_4_18->setGeometry(640,90,150,20); label_4_18->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(255, 255, 255)"); label_4_18->setText("无功需量:"); label_4_19->setGeometry(640,110,150,20); label_4_19->setStyleSheet("background: rgb(145, 145, 145);font: 12pt 黑体 bold;color: rgb(0, 0, 0)"); line3_2->setGeometry(460,10,1,150); line3_2->setFrameShape(QFrame::VLine); line4_1->setGeometry(240,10,1,150); line4_1->setFrameShape(QFrame::VLine); line4_3->setGeometry(630,10,1,150); line4_3->setFrameShape(QFrame::VLine); } void mainpage_Power::onPageTwoDataUpdate(float A_PowerFactor3,float B_PowerFactor3,float C_PowerFactor2) { bool ok; auto get_right_minus = [&](QByteArray &array,int q = 10)->float{ QString transition1 = array.toHex(); int transition2 = transition1.toUInt(&ok,16); return (float)transition2*1.0/q; }; /*有功功率显示*/ float A_Active_Power3 = get_right_minus(SEC.SecActivePowerAA,1000); ACC.A_Active_Power = A_Active_Power3; label_4_2->setText("A相有功功率:"+QString::number(A_Active_Power3,'f',2)+"kW");//10进制转字符串 qDebug()<<"a xiang you gong:"<setText("B相有功功率:"+QString::number(B_Active_Power3,'f',2)+"kW");//10进制转字符串 qDebug()<<"b xiang you gong:"<setText("C相有功功率:"+QString::number(C_Active_Power2,'f',2)+"kW");//10进制转字符串 qDebug()<<"c xiang you gong:"<setText("总有功功率:"+QString::number(Com_Active_Power2,'f',2)+"kW");//10进制转字符串 qDebug()<<"zong you gong:"<setText("A相无功功率:"+QString::number(A_Reactive_PowerAA3,'f',2)+"kVar");//10进制转字符串 qDebug()<<"a xiang wu gong:"<setText("B相无功功率:"+QString::number(A_Reactive_PowerBB3,'f',2)+"kVar");//10进制转字符串 qDebug()<<"b xiang wu gong:"<setText("C相无功功率:"+QString::number(A_Reactive_PowerCC3,'f',2)+"kVar");//10进制转字符串 qDebug()<<"c xiang wu gong:"<setText("总无功功率:"+QString::number(Com_Reactive_Power2,'f',2)+"kVar");//10进制转字符串 qDebug()<<"zong wu gong:"<setText("A相功率因数:"+QString::number(A_PowerFactor3,'f',2));//10进制转字符串 qDebug()<<"a xiang PowerFactor:"<setText("B相功率因数:"+QString::number(B_PowerFactor3,'f',2));//10进制转字符串 qDebug()<<"b xiang PowerFactor:"<setText("C相功率因数:"+QString::number(C_PowerFactor2,'f',2));//10进制转字符串 qDebug()<<"c xiang PowerFactor:"<setText("总功率因数:"+QString::number(Com_PowerFactor2,'f',2));//10进制转字符串 qDebug()<<"zong PowerFactor:"<setText(QString::number(Electroplate_Active_Power,'f',2)+"kVA");//10进制转字符串 qDebug()<<"shizai Power:"<setText(QString::number(Demand3,'f',2)+"kW");//10进制转字符串 qDebug()<<"Demand have:"<setText(QString::number(Demand_N2,'f',2)+"kVar");//10进制转字符串 qDebug()<<"Demand wu:"<