加入 dockWidget

This commit is contained in:
tangchao0503
2025-01-01 18:46:33 +08:00
parent cbc81cb75e
commit 0e46470402
17 changed files with 1278 additions and 1052 deletions

55
HPPA/PowerControl.cpp Normal file
View File

@ -0,0 +1,55 @@
#include "PowerControl.h"
PowerControl::PowerControl(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
connect(ui.lamp_power_open_btn, SIGNAL(clicked()), this, SLOT(onLampPowerOpen_btn()));
connect(ui.lamp_power_close_btn, SIGNAL(clicked()), this, SLOT(onLampPowerClose_btn()));
connect(ui.motor_power_open_btn, SIGNAL(clicked()), this, SLOT(onMotorPowerOpen_btn()));
connect(ui.motor_power_close_btn, SIGNAL(clicked()), this, SLOT(onMotorPowerClose_btn()));
}
PowerControl::~PowerControl()
{}
void PowerControl::getRequest(QString str)
{
QNetworkRequest request;
QNetworkAccessManager* naManager = new QNetworkAccessManager(this);
QMetaObject::Connection connRet = QObject::connect(naManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*)));
Q_ASSERT(connRet);
request.setUrl(QUrl(str));
QNetworkReply* reply = naManager->get(request);
}
void PowerControl::onLampPowerOpen_btn()//onLampPowerOpen_btn
{
QString xx = "http://192.168.1.3/setshutter?Portname=3&Value=1";
getRequest(xx);
}
void PowerControl::onLampPowerClose_btn()//onLampPowerClose_btn
{
QString xx = "http://192.168.1.3/setshutter?Portname=3&Value=0";
getRequest(xx);
}
void PowerControl::onMotorPowerOpen_btn()
{
QString xx = "http://192.168.1.3/setshutter?Portname=1&Value=1";
getRequest(xx);
emit powerOpened();
}
void PowerControl::onMotorPowerClose_btn()
{
QString xx = "http://192.168.1.3/setshutter?Portname=1&Value=0";
getRequest(xx);
emit powerClosed();
}