添加产品切换模板
This commit is contained in:
@@ -108,7 +108,7 @@ else()
|
||||
${HANDLEAI_SRC_FILES}
|
||||
${ALGO_HEAD_FILES}
|
||||
${ALGO_SRC_FILES}
|
||||
${UI_FILES} "ff.rc" "icon.qrc" )
|
||||
${UI_FILES} "ff.rc" "icon.qrc" "uiModule/uiModule_switchProduct.h")
|
||||
else()
|
||||
add_executable( ${CURRENT_FOLDER} WIN32
|
||||
${HEAD_FILES}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 KiB |
@@ -22,42 +22,8 @@ void connectSignalAndSlots(MainWindow* front, backEndManager* back)
|
||||
QObject::connect(front, &MainWindow::reInitSignal, back, &backEndManager::initialization);
|
||||
QObject::connect(front->_loadingWidget.retryBtn, &QPushButton::clicked, back, &backEndManager::initialization);
|
||||
}
|
||||
//exmple 860 168/144 1
|
||||
QByteArray createReadPlcQByteArray(int pos, int areaCode, int lenth)
|
||||
{
|
||||
int pos1 = std::max(0, pos - 255);
|
||||
int pos2 = pos - pos1;
|
||||
QString str1 = QString("%1").arg(pos1, 2, 16, QLatin1Char('0')).toUpper();
|
||||
QString str2 = QString("%1").arg(pos2, 2, 16, QLatin1Char('0')).toUpper();
|
||||
QString str3 = QString("%1").arg(lenth, 2, 16, QLatin1Char('0')).toUpper();
|
||||
QString str = QString("50 00 00 FF FF 03 00 0C 00 0A 00 01 04 00 00 %1 %2 00 %3 %4 00")
|
||||
.arg(str1)
|
||||
.arg(str2)
|
||||
.arg(QString::number(areaCode, 16).toUpper())
|
||||
.arg(str3);
|
||||
return QByteArray::fromHex(str.toStdString().c_str());
|
||||
}
|
||||
//exmple 862 168/144 1 1
|
||||
QByteArray createwritePlcQByteArray(int pos, int areaCode, int lenth, int value)
|
||||
{
|
||||
int pos1 = std::max(0, pos - 255);
|
||||
int pos2 = pos - pos1;
|
||||
|
||||
QString str1 = QString("%1").arg(pos1, 2, 16, QLatin1Char('0')).toUpper();
|
||||
QString str2 = QString("%1").arg(pos2, 2, 16, QLatin1Char('0')).toUpper();
|
||||
QString str3 = QString("%1").arg(lenth, 2, 16, QLatin1Char('0')).toUpper();
|
||||
QString str4 = QString("%1").arg(value, 2, 16, QLatin1Char('0')).toUpper();
|
||||
QString str = QString("50 00 00 FF FF 03 00 0E 00 0A 00 01 14 00 00 %1 %2 00 %3 00 %4 00 %5 00")
|
||||
.arg(str1)
|
||||
.arg(str2)
|
||||
.arg(QString::number(areaCode, 16).toUpper())
|
||||
.arg(str3)
|
||||
.arg(str4);
|
||||
return QByteArray::fromHex(str.toStdString().c_str());
|
||||
}
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QByteArray r = createReadPlcQByteArray(102, 168, 1);
|
||||
QApplication a(argc, argv);
|
||||
LogMsg::Create(LogMsg::LogMsgType::DebugMsg);
|
||||
//检测是否已运行
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <uiModule/components/dashBoard.h>
|
||||
#include <uiModule/components/fancyProcessBar.h>
|
||||
#include <uiModule/components/fancyLogWindow.h>
|
||||
#include <uiModule/uiModule_switchProduct.h>
|
||||
|
||||
class summaryDataManager
|
||||
{
|
||||
public:
|
||||
@@ -146,6 +148,8 @@ public:
|
||||
progressBar3->setProgress(0.8);
|
||||
layout->addWidget(progressBar3);
|
||||
|
||||
switchProductWidget* _switchProductWidget = new switchProductWidget();
|
||||
layout->addWidget(_switchProductWidget);
|
||||
LogWindow* log = new LogWindow();
|
||||
layout->addWidget(log);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
#include <qwidget.h>
|
||||
#include <qlabel.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qlayout.h>
|
||||
#include <qpushbutton.h>
|
||||
class switchProductWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
int currentProductIndex = 0;
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
fancyButtonText* switchBtn = new fancyButtonText(100, 60, "修改", "修改当前机型");
|
||||
QComboBox* productSelect = new QComboBox(this);
|
||||
QLabel* currentProduct = new QLabel(this);
|
||||
switchProductWidget()
|
||||
{
|
||||
this->setLayout(layout);
|
||||
|
||||
productSelect->addItem("产品1");
|
||||
productSelect->addItem("产品2");
|
||||
|
||||
layout->addWidget(productSelect);
|
||||
productSelect->hide();
|
||||
|
||||
currentProduct->setText("产品1");
|
||||
layout->addWidget(currentProduct);
|
||||
layout->addWidget(switchBtn);
|
||||
|
||||
connect(switchBtn, &QPushButton::clicked, this, &switchProductWidget::startSwitch);
|
||||
connect(productSelect, &QComboBox::currentTextChanged, this, &switchProductWidget::currentProductSwitch);
|
||||
}
|
||||
private:
|
||||
int siwtchBtnState = 0;
|
||||
private slots:
|
||||
void startSwitch()
|
||||
{
|
||||
if(siwtchBtnState == 0)
|
||||
{
|
||||
currentProduct->hide();
|
||||
productSelect->show();
|
||||
switchBtn->setText("取消");
|
||||
siwtchBtnState = 1;
|
||||
return;
|
||||
}
|
||||
else if (siwtchBtnState == 1)
|
||||
{
|
||||
currentProduct->show();
|
||||
productSelect->hide();
|
||||
switchBtn->setText("修改");
|
||||
siwtchBtnState = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
void currentProductSwitch(QString input)
|
||||
{
|
||||
int index = productSelect->currentIndex();
|
||||
}
|
||||
};
|
||||
|
||||
#pragma once
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user