mirror of
https://github.com/NanjingForestryUniversity/uppermachine-candy.git
synced 2025-11-08 14:24:15 +00:00
feat: 新增下位机队列空检测
socket监听下位机发送的error信号,并且在分选界面显示error警告,当出现该警告时,应减速传送带至合适速度并重新开始分选
This commit is contained in:
parent
2b9f2b859d
commit
2fbb4067c4
@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.5.2, 2022-06-26T14:44:07. -->
|
||||
<!-- Written by QtCreator 4.5.2, 2023-02-07T10:04:40. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{f40858e6-f94a-4d17-9db8-96ef47726f77}</value>
|
||||
<value type="QByteArray">{64e02d7d-cd76-4242-b280-2dec608f5169}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
@ -61,12 +61,12 @@
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{8fde18c1-a446-458e-9f45-046b48cb1bad}</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{00533096-fe49-4822-b384-b3c69b58cfb0}</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/nvidia/CandyProject/candy</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/nvidia/CandyProject/candy624</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
@ -184,13 +184,13 @@
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">candy</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/nvidia/CandyProject/candy/candy.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/nvidia/CandyProject/candy624/candy.pro</value>
|
||||
<value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">candy.pro</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">/home/nvidia/CandyProject/candy</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">/home/nvidia/CandyProject/candy624</value>
|
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
|
||||
5
ccc.mfs
5
ccc.mfs
@ -1,6 +1,6 @@
|
||||
# {05D8C294-F295-4dfb-9D01-096BD04049F4}
|
||||
# GenApi persistence file (version 3.0.0)
|
||||
# Device = HIKROBOT::HIKCamera -- HIKROBOT GigE Vision Camera Interface -- Device version = 1.2.0 -- Product GUID = EE4B7E09-DA29-4956-A1EC-212263331CFC -- Product version GUID = 79ace398-62e3-44a6-8845-f81aaf104382
|
||||
# Device = GEV::Camera -- GigE Vision Camera Interface -- Device version = 1.2.0 -- Product GUID = EE4B7E09-DA29-4956-A1EC-212263331CFC -- Product version GUID = 79ace398-62e3-44a6-8845-f81aaf104382
|
||||
DeviceLinkSelector 0
|
||||
DeviceLinkHeartbeatMode On
|
||||
DeviceLinkSelector 0
|
||||
@ -64,7 +64,7 @@ AcquisitionFrameRate 11.57
|
||||
AcquisitionFrameRateEnable 1
|
||||
TriggerSelector FrameBurstStart
|
||||
TriggerSelector FrameBurstStart
|
||||
TriggerMode On
|
||||
TriggerMode Off
|
||||
TriggerSelector FrameBurstStart
|
||||
TriggerSelector FrameBurstStart
|
||||
TriggerSource Line2
|
||||
@ -239,6 +239,7 @@ AutoFunctionAOIUsageWhiteBalance 0
|
||||
AutoFunctionAOISelector AOI1
|
||||
UserSetSelector Default
|
||||
UserSetDefault Default
|
||||
GevPAUSEFrameReception 0
|
||||
GevHeartbeatTimeout 3000
|
||||
GevGVCPHeartbeatDisable 0
|
||||
GevMCTT 0
|
||||
|
||||
@ -22,7 +22,7 @@ static const uint qt_meta_data_Widget[] = {
|
||||
6, // revision
|
||||
0, // classname
|
||||
0, 0, // classinfo
|
||||
48, 14, // methods
|
||||
49, 14, // methods
|
||||
0, 0, // properties
|
||||
0, 0, // enums/sets
|
||||
0, 0, // constructors
|
||||
@ -80,6 +80,7 @@ static const uint qt_meta_data_Widget[] = {
|
||||
1023, 24, 24, 24, 0x08,
|
||||
1041, 24, 24, 24, 0x08,
|
||||
1059, 24, 24, 24, 0x08,
|
||||
1080, 24, 24, 24, 0x08,
|
||||
|
||||
0 // eod
|
||||
};
|
||||
@ -114,6 +115,7 @@ static const char qt_meta_stringdata_Widget[] = {
|
||||
"On_btn6_clicked()\0On_btn7_clicked()\0"
|
||||
"On_btn8_clicked()\0On_btn9_clicked()\0"
|
||||
"On_btn0_clicked()\0On_btn_DEL_clicked()\0"
|
||||
"readfrom_lowermachine()\0"
|
||||
};
|
||||
|
||||
void Widget::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
|
||||
@ -170,6 +172,7 @@ void Widget::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void
|
||||
case 45: _t->On_btn9_clicked(); break;
|
||||
case 46: _t->On_btn0_clicked(); break;
|
||||
case 47: _t->On_btn_DEL_clicked(); break;
|
||||
case 48: _t->readfrom_lowermachine(); break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
@ -207,9 +210,9 @@ int Widget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||
if (_id < 0)
|
||||
return _id;
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
if (_id < 48)
|
||||
if (_id < 49)
|
||||
qt_static_metacall(this, _c, _id, _a);
|
||||
_id -= 48;
|
||||
_id -= 49;
|
||||
}
|
||||
return _id;
|
||||
}
|
||||
|
||||
BIN
moc_widget.o
BIN
moc_widget.o
Binary file not shown.
24
thread.cpp
24
thread.cpp
@ -9,6 +9,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <iostream>
|
||||
|
||||
QSemaphore emptybuff(2); //空缓冲区信号量
|
||||
QSemaphore fullbuff(0); //正在处理的缓冲区信号量
|
||||
@ -39,7 +40,10 @@ extern void __stdcall onImageDataCallBackFunc(unsigned char * pData, MV_FRAME_OU
|
||||
if(!emptybuff.tryAcquire()) //申请空缓冲区
|
||||
{
|
||||
loss_flag = true;
|
||||
qDebug()<<"loss loss loss loss loss loss loss loss";
|
||||
|
||||
std::cout << ">>> loss loss loss loss <<<" << std::endl;
|
||||
fflush(0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -81,7 +85,7 @@ Process_img::Process_img(QObject *parent) : QThread(parent), m_stop(false)
|
||||
|
||||
void Process_img::run()
|
||||
{
|
||||
qDebug()<<"deal thread:"<<QThread::currentThreadId();
|
||||
// qDebug()<<"deal thread:"<<QThread::currentThreadId();
|
||||
|
||||
int n = fullbuff.available(); //申请处理使用的缓冲区
|
||||
if(n > 0) //确保为0
|
||||
@ -219,23 +223,7 @@ void Process_img::data_process(cv::Mat img)
|
||||
if(defect_size < blow_time)
|
||||
{
|
||||
int compensation = (blow_time - defect_size) / 2;
|
||||
// if (start - compensation < 0)
|
||||
// {
|
||||
// start = 0;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// start = start - compensation;
|
||||
// }
|
||||
|
||||
// if (end + compensation > (PULSE_NUMBER-1))
|
||||
// {
|
||||
// end = PULSE_NUMBER-1;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// end = end + compensation;
|
||||
// }
|
||||
if((start - compensation > 0) && ((end + compensation) < PULSE_NUMBER - 1))
|
||||
{
|
||||
start = start - compensation;
|
||||
|
||||
@ -42,6 +42,7 @@ public:
|
||||
QPushButton *btn_Tab2_1;
|
||||
QPushButton *btn_Tab2_5;
|
||||
QLabel *label_stop;
|
||||
QLabel *label_warning;
|
||||
QWidget *tab_3;
|
||||
QPushButton *btn_Tab3_4;
|
||||
QPushButton *btn_Tab3_6;
|
||||
@ -524,6 +525,11 @@ public:
|
||||
QFont font4;
|
||||
font4.setPointSize(18);
|
||||
label_stop->setFont(font4);
|
||||
label_warning = new QLabel(tab_2);
|
||||
label_warning->setObjectName(QString::fromUtf8("label_warning"));
|
||||
label_warning->setGeometry(QRect(530, 530, 141, 41));
|
||||
label_warning->setFont(font4);
|
||||
label_warning->setStyleSheet(QString::fromUtf8("color:rgb(255, 0, 0);"));
|
||||
tabWidget->addTab(tab_2, QString());
|
||||
tab_3 = new QWidget();
|
||||
tab_3->setObjectName(QString::fromUtf8("tab_3"));
|
||||
@ -1352,7 +1358,7 @@ public:
|
||||
|
||||
retranslateUi(Widget);
|
||||
|
||||
tabWidget->setCurrentIndex(4);
|
||||
tabWidget->setCurrentIndex(1);
|
||||
|
||||
|
||||
QMetaObject::connectSlotsByName(Widget);
|
||||
@ -1381,6 +1387,7 @@ public:
|
||||
btn_Tab2_5->setText(QApplication::translate("Widget", "\345\217\202\346\225\260\350\260\203\346\225\264\n"
|
||||
"Parameters", 0, QApplication::UnicodeUTF8));
|
||||
label_stop->setText(QString());
|
||||
label_warning->setText(QString());
|
||||
tabWidget->setTabText(tabWidget->indexOf(tab_2), QApplication::translate("Widget", "Tab 2", 0, QApplication::UnicodeUTF8));
|
||||
btn_Tab3_4->setText(QApplication::translate("Widget", "\347\233\270\346\234\272\345\217\202\346\225\260\350\256\276\347\275\256\n"
|
||||
"Camera Parameters", 0, QApplication::UnicodeUTF8));
|
||||
|
||||
353
widget.cpp
353
widget.cpp
@ -40,6 +40,7 @@ Widget::Widget(QWidget *parent) :
|
||||
ui(new Ui::Widget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
system("mkdir -p /home/nvidia/candyPic");
|
||||
this->setWindowFlags(Qt::Widget);
|
||||
this->showFullScreen();
|
||||
init_window();
|
||||
@ -188,19 +189,6 @@ void Widget::connect_signals()
|
||||
connect(ui->btn_channel_up, SIGNAL(clicked()), this, SLOT(On_btnchannelup_click()));
|
||||
connect(ui->btn_channel_down, SIGNAL(clicked()), this, SLOT(On_btnchanneldown_click()));
|
||||
connect(ui->btn_channel_send, SIGNAL(clicked()), this, SLOT(On_btn_channel_send_clicked()));
|
||||
// connect(ui->btn_1, SIGNAL(clicked()), this, SLOT(On_btn_1_clicked()));
|
||||
// connect(ui->btn_2, SIGNAL(clicked()), this, SLOT(On_btn_2_clicked()));
|
||||
// connect(ui->btn_3, SIGNAL(clicked()), this, SLOT(On_btn_3_clicked()));
|
||||
// connect(ui->btn_4, SIGNAL(clicked()), this, SLOT(On_btn_4_clicked()));
|
||||
// connect(ui->btn_5, SIGNAL(clicked()), this, SLOT(On_btn_5_clicked()));
|
||||
// connect(ui->btn_6, SIGNAL(clicked()), this, SLOT(On_btn_6_clicked()));
|
||||
// connect(ui->btn_7, SIGNAL(clicked()), this, SLOT(On_btn_7_clicked()));
|
||||
// connect(ui->btn_8, SIGNAL(clicked()), this, SLOT(On_btn_8_clicked()));
|
||||
// connect(ui->btn_9, SIGNAL(clicked()), this, SLOT(On_btn_9_clicked()));
|
||||
// connect(ui->btn_0, SIGNAL(clicked()), this, SLOT(On_btn_0_clicked()));
|
||||
// connect(ui->btn_dot, SIGNAL(clicked()), this, SLOT(On_btn_dot_clicked()));
|
||||
// connect(ui->btn_del, SIGNAL(clicked()), this, SLOT(On_btn_del_clicked()));
|
||||
// connect(ui->btn_clr, SIGNAL(clicked()), this, SLOT(On_btn_clr_clicked()));
|
||||
}
|
||||
|
||||
void Widget::On_btn_Tab1_2_click()
|
||||
@ -224,6 +212,7 @@ void Widget::On_btnStart_click()
|
||||
connect(process_img, SIGNAL(send_res(QVector<bad_candy_box>)), this, SLOT(drawbox(QVector<bad_candy_box>)), Qt::BlockingQueuedConnection);
|
||||
connect(process_img, SIGNAL(send_tab(uint8_t*)), this, SLOT(get_tab(uint8_t*)), Qt::BlockingQueuedConnection);
|
||||
|
||||
ui->label_warning->setText(" ");
|
||||
int n = emptybuff.available();
|
||||
if(n < 2)
|
||||
{
|
||||
@ -238,7 +227,7 @@ void Widget::On_btnStart_click()
|
||||
QByteArray ba = delay_time.toLatin1();
|
||||
char* dt = ba.data();
|
||||
char send_tab[12];
|
||||
qDebug() << dt[0] << dt[1] <<dt[2] << dt[3];
|
||||
// qDebug() << dt[0] << dt[1] <<dt[2] << dt[3];
|
||||
send_tab[0] = 0xAA;
|
||||
send_tab[1] = 0x00;
|
||||
send_tab[2] = 0x06;
|
||||
@ -348,25 +337,11 @@ void Widget::On_bthStop_click()
|
||||
process_img->exitThread();
|
||||
process_img->wait();
|
||||
|
||||
//
|
||||
//my_test_thread
|
||||
// grab_img->wait();
|
||||
// if(grab_img->isFinished())
|
||||
// {
|
||||
// qDebug()<<"grab thread finish";
|
||||
// }
|
||||
//
|
||||
|
||||
if(process_img->isFinished())
|
||||
if(!process_img->isFinished())
|
||||
{
|
||||
qDebug()<<"process thread finish";
|
||||
qDebug()<<"process thread finish failed";
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// delete grab_img;
|
||||
//
|
||||
|
||||
delete process_img;
|
||||
|
||||
qDebug() << "Stop Success!";
|
||||
@ -586,6 +561,12 @@ void Widget::judge_password(QString password)
|
||||
|
||||
void Widget::showimage(cv::Mat img)
|
||||
{
|
||||
// if(loss_flag == true)
|
||||
// {
|
||||
// ui->label_warning->setText("loss");
|
||||
// QApplication::processEvents();
|
||||
// loss_flag = false;
|
||||
// }
|
||||
static int counter = 0;
|
||||
if(save_flag && counter == 0)
|
||||
{
|
||||
@ -620,29 +601,27 @@ void Widget::drawbox(QVector<bad_candy_box> bounding_box)
|
||||
QRect rect(bounding_box[i].pointA_x* (pix.width() / 2376.0f), bounding_box[i].pointA_y* (pix.height() / 584.0f), width, height);
|
||||
rects << rect;
|
||||
}
|
||||
|
||||
painter.drawRects(rects);
|
||||
ui->showlabel->setPixmap(pix);
|
||||
|
||||
// if(empty_flag == false)
|
||||
// if(loss_flag)
|
||||
// {
|
||||
// QDateTime time = QDateTime::currentDateTime();648
|
||||
// QString str = time.toString("yyyyMMddhhmmss");
|
||||
// QString filepath = RESULT_PATH + str + ".bmp";.
|
||||
//#ifdef DEBUG
|
||||
// cv::imwrite(filepath.toLatin1().data(), defect_pic);
|
||||
//#else
|
||||
// pix.save(filepath);
|
||||
//#endif
|
||||
// empty_flag = true;
|
||||
//// uint8_t buf[3008] = {0};
|
||||
//// uint8_t zero[3000] = {0};
|
||||
////// socket->write((const char*)buf, 3000);
|
||||
//// buf[0] = 0xAA;
|
||||
//// buf[1] = 0x0B;
|
||||
//// buf[2] = 0xBA;
|
||||
//// buf[3] = 'd';
|
||||
//// buf[4] = 'a';
|
||||
//// buf[3005] = 0xFF;
|
||||
//// buf[3006] = 0xFF;
|
||||
//// buf[3007] = 0xBB;
|
||||
//// memcpy(buf+5, zero, 3000);
|
||||
//// socket->write((const char*)buf, 3008);
|
||||
// loss_flag = false;
|
||||
// }
|
||||
|
||||
if(loss_flag)
|
||||
{
|
||||
uint8_t buf[2500] = {0};
|
||||
socket->write((const char*)buf, 2500);
|
||||
loss_flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::showimage_test(cv::Mat img)
|
||||
@ -684,6 +663,7 @@ void Widget::ServerNewConnection()
|
||||
ui->MCU_status->setStyleSheet("QLabel{background-color:rgb(0,255,0);}");
|
||||
ui->MCU_status->setText(QString::fromLocal8Bit("已连接"));
|
||||
qDebug()<<"new connection";
|
||||
connect(socket, SIGNAL(readyRead()), this, SLOT(readfrom_lowermachine()));
|
||||
|
||||
//char send_buf[13] = {0xAA, 0x00, 0x07, 'p', 'o', 'w', 'e', 'r', 'o', 'n', 0xFF, 0xFF, 0xBB};
|
||||
//socket->write((const char*)send_buf, 13);
|
||||
@ -785,7 +765,7 @@ void Widget::On_btnImportImg_click()
|
||||
}
|
||||
qDebug()<<filepath;
|
||||
QString str = SAVE_IMAGE_PATH;
|
||||
QString command = "cp " + str + "*\ " + filepath;
|
||||
QString command = "mv " + str + "*\ " + filepath + ";sync";
|
||||
QMessageBox box;
|
||||
box.setText("export?");
|
||||
box.setStandardButtons(QMessageBox::Yes|QMessageBox::No);
|
||||
@ -793,9 +773,13 @@ void Widget::On_btnImportImg_click()
|
||||
int res = box.exec();
|
||||
if(res == QMessageBox::Yes)
|
||||
{
|
||||
ui->btnImportImg->setText(QString::fromLocal8Bit("导出中"));
|
||||
ui->btnImportImg->setText(QString::fromLocal8Bit("导出中..."));
|
||||
// ui->btnImportImg->setStyleSheet("background-color:rgb(255,0,0)");
|
||||
QApplication::processEvents();
|
||||
system(command.toUtf8().data());
|
||||
|
||||
ui->btnImportImg->setText(QString::fromLocal8Bit("导出图片\nExport Images"));
|
||||
// ui->btnImportImg->setStyleSheet("background-color:rgb(0,255,0)");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1203,264 +1187,13 @@ void Widget::On_btn_channel_send_clicked()
|
||||
socket->write((const char*)buf, TRIGGER_PULSE_NUMBER * (VALVE_NUMBER / 8) + 8);
|
||||
}
|
||||
|
||||
//void Widget::On_btn_1_clicked()
|
||||
//{
|
||||
// QWidget* m_widget = this->focusWidget();
|
||||
// if(m_widget->inherits("QSpinBox"))
|
||||
// {
|
||||
// QSpinBox* spinbox = qobject_cast<QSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append("1");
|
||||
// spinbox->setValue(str.toInt());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// QDoubleSpinBox* spinbox = qobject_cast<QDoubleSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append("1");
|
||||
// spinbox->setValue(str.toDouble());
|
||||
// }
|
||||
//}
|
||||
|
||||
//void Widget::On_btn_2_clicked()
|
||||
//{
|
||||
// QWidget* m_widget = this->focusWidget();
|
||||
// if(m_widget->inherits("QSpinBox"))
|
||||
// {
|
||||
// QSpinBox* spinbox = qobject_cast<QSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append("2");
|
||||
// spinbox->setValue(str.toInt());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// QDoubleSpinBox* spinbox = qobject_cast<QDoubleSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append("2");
|
||||
// spinbox->setValue(str.toDouble());
|
||||
// }
|
||||
//}
|
||||
|
||||
//void Widget::On_btn_3_clicked()
|
||||
//{
|
||||
// QWidget* m_widget = this->focusWidget();
|
||||
// if(m_widget->inherits("QSpinBox"))
|
||||
// {
|
||||
// QSpinBox* spinbox = qobject_cast<QSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append("3");
|
||||
// spinbox->setValue(str.toInt());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// QDoubleSpinBox* spinbox = qobject_cast<QDoubleSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append("3");
|
||||
// spinbox->setValue(str.toDouble());
|
||||
// }
|
||||
//}
|
||||
|
||||
//void Widget::On_btn_4_clicked()
|
||||
//{
|
||||
// QWidget* m_widget = this->focusWidget();
|
||||
// if(m_widget->inherits("QSpinBox"))
|
||||
// {
|
||||
// QSpinBox* spinbox = qobject_cast<QSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append("4");
|
||||
// spinbox->setValue(str.toInt());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// QDoubleSpinBox* spinbox = qobject_cast<QDoubleSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append("4");
|
||||
// spinbox->setValue(str.toDouble());
|
||||
// }
|
||||
//}
|
||||
|
||||
//void Widget::On_btn_5_clicked()
|
||||
//{
|
||||
// QWidget* m_widget = this->focusWidget();
|
||||
// if(m_widget->inherits("QSpinBox"))
|
||||
// {
|
||||
// QSpinBox* spinbox = qobject_cast<QSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append("5");
|
||||
// spinbox->setValue(str.toInt());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// QDoubleSpinBox* spinbox = qobject_cast<QDoubleSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append("5");
|
||||
// spinbox->setValue(str.toDouble());
|
||||
// }
|
||||
//}
|
||||
|
||||
//void Widget::On_btn_6_clicked()
|
||||
//{
|
||||
// QWidget* m_widget = this->focusWidget();
|
||||
// if(m_widget->inherits("QSpinBox"))
|
||||
// {
|
||||
// QSpinBox* spinbox = qobject_cast<QSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append("6");
|
||||
// spinbox->setValue(str.toInt());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// QDoubleSpinBox* spinbox = qobject_cast<QDoubleSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append("6");
|
||||
// spinbox->setValue(str.toDouble());
|
||||
// }
|
||||
//}
|
||||
|
||||
//void Widget::On_btn_7_clicked()
|
||||
//{
|
||||
// QWidget* m_widget = this->focusWidget();
|
||||
// if(m_widget->inherits("QSpinBox"))
|
||||
// {
|
||||
// QSpinBox* spinbox = qobject_cast<QSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append("7");
|
||||
// spinbox->setValue(str.toInt());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// QDoubleSpinBox* spinbox = qobject_cast<QDoubleSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append("7");
|
||||
// spinbox->setValue(str.toDouble());
|
||||
// }
|
||||
//}
|
||||
|
||||
//void Widget::On_btn_8_clicked()
|
||||
//{
|
||||
// QWidget* m_widget = this->focusWidget();
|
||||
// if(m_widget->inherits("QSpinBox"))
|
||||
// {
|
||||
// QSpinBox* spinbox = qobject_cast<QSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append("8");
|
||||
// spinbox->setValue(str.toInt());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// QDoubleSpinBox* spinbox = qobject_cast<QDoubleSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append("8");
|
||||
// spinbox->setValue(str.toDouble());
|
||||
// }
|
||||
//}
|
||||
|
||||
//void Widget::On_btn_9_clicked()
|
||||
//{
|
||||
// QWidget* m_widget = this->focusWidget();
|
||||
// if(m_widget->inherits("QSpinBox"))
|
||||
// {
|
||||
// QSpinBox* spinbox = qobject_cast<QSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append("9");
|
||||
// spinbox->setValue(str.toInt());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// QDoubleSpinBox* spinbox = qobject_cast<QDoubleSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append("9");
|
||||
// spinbox->setValue(str.toDouble());
|
||||
// }
|
||||
//}
|
||||
|
||||
//void Widget::On_btn_0_clicked()
|
||||
//{
|
||||
// QWidget* m_widget = this->focusWidget();
|
||||
// if(m_widget->inherits("QSpinBox"))
|
||||
// {
|
||||
// QSpinBox* spinbox = qobject_cast<QSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append("0");
|
||||
// spinbox->setValue(str.toInt());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// QDoubleSpinBox* spinbox = qobject_cast<QDoubleSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append("0");
|
||||
// spinbox->setValue(str.toDouble());
|
||||
// }
|
||||
//}
|
||||
|
||||
//void Widget::On_btn_dot_clicked()
|
||||
//{
|
||||
// QWidget* m_widget = this->focusWidget();
|
||||
// if(m_widget->inherits("QDoubleSpinbox"))
|
||||
// {
|
||||
// QDoubleSpinBox* spinbox = qobject_cast<QDoubleSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// str.append(".");
|
||||
// spinbox->setValue(str.toDouble());
|
||||
// }
|
||||
//}
|
||||
|
||||
//void Widget::On_btn_del_clicked()
|
||||
//{
|
||||
// QWidget* m_widget = this->focusWidget();
|
||||
// if(m_widget->inherits("QSpinBox"))
|
||||
// {
|
||||
// QSpinBox* spinbox = qobject_cast<QSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// if(str.size()==0) return;
|
||||
// str = str.left(str.size()-1);
|
||||
|
||||
// spinbox->setValue(str.toInt());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// QDoubleSpinBox* spinbox = qobject_cast<QDoubleSpinBox*>(m_widget);
|
||||
// int value = spinbox->value();
|
||||
// QString str = QString::number(value);
|
||||
// if(str.size()==0) return;
|
||||
// str = str.left(str.size()-1);
|
||||
// spinbox->setValue(str.toDouble());
|
||||
// }
|
||||
//}
|
||||
|
||||
//void Widget::On_btn_clr_clicked()
|
||||
//{
|
||||
// QWidget* m_widget = this->focusWidget();
|
||||
// if(m_widget->inherits("QSpinBox"))
|
||||
// {
|
||||
// QSpinBox* spinbox = qobject_cast<QSpinBox*>(m_widget);
|
||||
// spinbox->clear();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// QDoubleSpinBox* spinbox = qobject_cast<QDoubleSpinBox*>(m_widget);
|
||||
// spinbox->cleanText();
|
||||
// }
|
||||
//}
|
||||
void Widget::readfrom_lowermachine()
|
||||
{
|
||||
char recbuf[8] = {0};
|
||||
int ret = socket->read(recbuf, 8);
|
||||
if(ret > 0){
|
||||
// std::cout << "loss loss loss" << std::endl;
|
||||
// fflush(0);
|
||||
ui->label_warning->setText("error");
|
||||
}
|
||||
}
|
||||
|
||||
15
widget.h
15
widget.h
@ -11,6 +11,7 @@
|
||||
#include "thread.h"
|
||||
#include "camera.h"
|
||||
#include "correct.h"
|
||||
#include "qprocess.h"
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
@ -105,19 +106,7 @@ private slots:
|
||||
void On_btn0_clicked();
|
||||
void On_btn_DEL_clicked();
|
||||
|
||||
// void On_btn_1_clicked();
|
||||
// void On_btn_2_clicked();
|
||||
// void On_btn_3_clicked();
|
||||
// void On_btn_4_clicked();
|
||||
// void On_btn_5_clicked();
|
||||
// void On_btn_6_clicked();
|
||||
// void On_btn_7_clicked();
|
||||
// void On_btn_8_clicked();
|
||||
// void On_btn_9_clicked();
|
||||
// void On_btn_0_clicked();
|
||||
// void On_btn_dot_clicked();
|
||||
// void On_btn_del_clicked();
|
||||
// void On_btn_clr_clicked();
|
||||
void readfrom_lowermachine();
|
||||
|
||||
private:
|
||||
Ui::Widget *ui;
|
||||
|
||||
23
widget.ui
23
widget.ui
@ -26,7 +26,7 @@
|
||||
<string notr="true">background-color: rgb(218, 239, 252);</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>4</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_1">
|
||||
<attribute name="title">
|
||||
@ -2811,6 +2811,27 @@ Parameters</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_warning">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>530</x>
|
||||
<y>530</y>
|
||||
<width>141</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>18</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color:rgb(255, 0, 0);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user