2024-11-26 17:16:25 +08:00
|
|
|
#include "leadscheme.h"
|
2024-11-28 17:54:32 +08:00
|
|
|
#include <QDebug>
|
|
|
|
#include <QJsonObject>
|
|
|
|
#include <QJsonValue>
|
|
|
|
#include <QButtonGroup>
|
2024-12-02 17:01:16 +08:00
|
|
|
#include "operatorjson.h"
|
|
|
|
#include <QApplication>
|
2024-11-26 17:16:25 +08:00
|
|
|
LeadScheme::LeadScheme(QWidget * parent ):QWidget (parent)
|
|
|
|
{
|
|
|
|
init();
|
2024-11-28 17:54:32 +08:00
|
|
|
initconnect();
|
2024-11-26 17:16:25 +08:00
|
|
|
initLay();
|
|
|
|
|
|
|
|
}
|
|
|
|
LeadScheme::~LeadScheme()
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void LeadScheme::init()
|
|
|
|
{
|
|
|
|
|
2024-11-28 17:54:32 +08:00
|
|
|
m_LeadSchemes.setStyleSheet("QPushButton{\
|
|
|
|
background: rgba(255, 255, 255);\
|
|
|
|
color: black;\
|
|
|
|
border-radius: 8px;\
|
|
|
|
border:0px ; \
|
|
|
|
}\
|
|
|
|
QPushButton:hover{\
|
|
|
|
color: black;\
|
|
|
|
background: rgb(255, 255, 255);\
|
|
|
|
border-radius: 8px;\
|
|
|
|
}\
|
|
|
|
QPushButton:pressed{\
|
|
|
|
color: black;\
|
|
|
|
background: rgb(255, 255, 255);\
|
|
|
|
border-radius: 8px;\
|
|
|
|
}\
|
|
|
|
QPushButton:checked{\
|
|
|
|
color: white;\
|
|
|
|
background: rgb(51, 144, 76);\
|
|
|
|
border-radius: 8px;\
|
|
|
|
}"\
|
|
|
|
"QWidget#NavList1{background-color:rgb(255, 255, 255);}"\
|
|
|
|
);
|
|
|
|
|
|
|
|
m_listNum.setStyleSheet("QPushButton{\
|
|
|
|
background: rgba(255, 255, 255);\
|
|
|
|
color: black;\
|
|
|
|
border-radius: 8px;\
|
|
|
|
border:0px ; \
|
|
|
|
}\
|
|
|
|
QPushButton:hover{\
|
|
|
|
color: black;\
|
|
|
|
background: rgb(255, 255, 255);\
|
|
|
|
border-radius: 8px;\
|
|
|
|
}\
|
|
|
|
QPushButton:pressed{\
|
|
|
|
color: black;\
|
|
|
|
background: rgb(255, 255, 255);\
|
|
|
|
border-radius: 8px;\
|
|
|
|
}\
|
|
|
|
QPushButton:checked{\
|
|
|
|
color: white;\
|
|
|
|
background: rgb(51, 144, 76);\
|
|
|
|
border-radius: 8px;\
|
|
|
|
}"\
|
|
|
|
"QWidget#NavList1{background-color:rgb(255, 255, 255);}"\
|
|
|
|
);
|
|
|
|
|
|
|
|
m_listPoints.setStyleSheet("QPushButton{\
|
|
|
|
background: rgba(255, 255, 255);\
|
|
|
|
color: black;\
|
|
|
|
border-radius: 8px;\
|
|
|
|
border:0px ; \
|
|
|
|
}\
|
|
|
|
QPushButton:hover{\
|
|
|
|
color: black;\
|
|
|
|
background: rgb(255, 255, 255);\
|
|
|
|
border-radius: 8px;\
|
|
|
|
}\
|
|
|
|
QPushButton:pressed{\
|
|
|
|
color: black;\
|
|
|
|
background: rgb(255, 255, 255);\
|
|
|
|
border-radius: 8px;\
|
|
|
|
}\
|
|
|
|
QPushButton:checked{\
|
|
|
|
color: white;\
|
|
|
|
background: rgb(51, 144, 76);\
|
|
|
|
border-radius: 8px;\
|
|
|
|
}"\
|
|
|
|
"QWidget#NavList1{background-color:rgb(255, 255, 255);}"\
|
|
|
|
);
|
|
|
|
m_listExPoints.setStyleSheet("QPushButton{\
|
|
|
|
background: rgba(255, 255, 255);\
|
|
|
|
color: black;\
|
|
|
|
border-radius: 8px;\
|
|
|
|
border:0px ; \
|
|
|
|
}\
|
|
|
|
QPushButton:hover{\
|
|
|
|
color: black;\
|
|
|
|
background: rgb(255, 255, 255);\
|
|
|
|
border-radius: 8px;\
|
|
|
|
}\
|
|
|
|
QPushButton:pressed{\
|
|
|
|
color: black;\
|
|
|
|
background: rgb(255, 255, 255);\
|
|
|
|
border-radius: 8px;\
|
|
|
|
}\
|
|
|
|
QPushButton:checked{\
|
|
|
|
color: white;\
|
|
|
|
background: rgb(51, 144, 76);\
|
|
|
|
border-radius: 8px;\
|
|
|
|
}"\
|
|
|
|
"QWidget#NavList1{background-color:rgb(255, 255, 255);}"\
|
|
|
|
);
|
|
|
|
|
|
|
|
m_btnNew.setText("新建");
|
|
|
|
m_btndelete.setText("删除");
|
|
|
|
m_btnCancel.setText("取消");
|
|
|
|
m_btnOK.setText("确认");
|
|
|
|
m_btnNew.setStyleSheet("QPushButton{\
|
|
|
|
background: white;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:hover{\
|
|
|
|
background: #0d9ddb;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:pressed{\
|
|
|
|
background: #0d9ddb;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:checked{\
|
|
|
|
background: #0d9ddb;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}");
|
|
|
|
m_btndelete.setStyleSheet("QPushButton{\
|
|
|
|
background: red;\
|
|
|
|
color:white;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:hover{\
|
|
|
|
background: #0d9ddb;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:pressed{\
|
|
|
|
background: #0d9ddb;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:checked{\
|
|
|
|
background: #0d9ddb;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}");
|
|
|
|
m_btnCancel.setStyleSheet("QPushButton{\
|
|
|
|
background: white;\
|
|
|
|
color:blue;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:hover{\
|
|
|
|
background: #0d9ddb;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:pressed{\
|
|
|
|
background: #0d9ddb;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:checked{\
|
|
|
|
background: #0d9ddb;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}");
|
|
|
|
m_btnOK.setStyleSheet("QPushButton{\
|
|
|
|
background: green;\
|
|
|
|
color:white;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:hover{\
|
|
|
|
background: #0d9ddb;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:pressed{\
|
|
|
|
background: #0d9ddb;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:checked{\
|
|
|
|
background: #0d9ddb;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}");
|
|
|
|
|
|
|
|
|
|
|
|
m_LeadSchemes.setList(QStringList()<<"8通道"<<"16通道"<<"64通道",QStringList()<<""<<""<<"");
|
|
|
|
|
|
|
|
|
|
|
|
m_listNum.setList(QStringList()<<"0"<<"1"<<"2"<<"3"<<"4"<<"5"<<"6"<<"7"<<"8"<<"9"<<"10"<<"11"<<
|
|
|
|
"12"<<"13"<<"14"<<"15",QStringList()<<"0"<<"1"<<"2"<<"3"<<"4"<<"5"<<"6"<<"7"<<"8"<<"9"<<"10"<<"11"<<
|
|
|
|
"12"<<"13"<<"14"<<"15");
|
|
|
|
m_listPoints.setList( QStringList()<<"F1"<<"F2"<<"F3"<<"F4"<<"C3"<<"C4"<<"P3"<<"P4"<<"O1"<<"O2"<<"F7"<<"F8"<<
|
|
|
|
"T3"<<"T4"<<"T5"<<"T6", QStringList()<<"F1"<<"F2"<<"F3"<<"F4"<<"C3"<<"C4"<<"P3"<<"P4"<<"O1"<<"O2"<<"F7"<<"F8"<<
|
|
|
|
"T3"<<"T4"<<"T5"<<"T6");
|
|
|
|
m_listExPoints.setList(QStringList()<<"A1"<<"A2"<<"A1"<<"A1"<<"A2"<<"A1"<<"A2"<<"A1"<<"A2"<<"A1"<<"A2"<<"A1"<<
|
|
|
|
"A1"<<"A2"<<"A1"<<"A2",QStringList()<<"A1"<<"A2"<<"A1"<<"A1"<<"A2"<<"A1"<<"A2"<<"A1"<<"A2"<<"A1"<<"A2"<<"A1"<<
|
|
|
|
"A1"<<"A2"<<"A1"<<"A2");
|
|
|
|
|
|
|
|
//QSize sizeTemp(30,40);
|
|
|
|
|
|
|
|
// m_LeadSchemes.setCustomSize(sizeTemp);
|
|
|
|
//m_listNum.setCustomSize(sizeTemp);
|
|
|
|
// m_listExPoints.setCustomSize(sizeTemp);
|
|
|
|
// m_listPoints.setCustomSize(sizeTemp);
|
|
|
|
|
2024-11-26 17:16:25 +08:00
|
|
|
}
|
2024-11-28 17:54:32 +08:00
|
|
|
bool LeadScheme::initconnect()
|
2024-11-26 17:16:25 +08:00
|
|
|
{
|
2024-11-28 17:54:32 +08:00
|
|
|
bool bCon = true;
|
|
|
|
bCon = connect(&m_btnOK,SIGNAL(clicked(bool)),this,SLOT(slotSave()));
|
|
|
|
if(!bCon)
|
|
|
|
{
|
|
|
|
qDebug()<<"connect failed"<<endl;
|
|
|
|
return bCon;
|
2024-11-26 17:16:25 +08:00
|
|
|
|
2024-11-28 17:54:32 +08:00
|
|
|
}
|
|
|
|
return bCon;
|
2024-11-26 17:16:25 +08:00
|
|
|
}
|
|
|
|
void LeadScheme::initLay()
|
|
|
|
{
|
2024-11-28 17:54:32 +08:00
|
|
|
#if 0
|
2024-11-26 17:16:25 +08:00
|
|
|
QLabel * labScheme = new QLabel;
|
|
|
|
labScheme->setText("导联方案");
|
|
|
|
QVBoxLayout * vlayScheme = new QVBoxLayout;
|
|
|
|
vlayScheme->addWidget(labScheme);
|
|
|
|
vlayScheme->addWidget(&m_LeadSchemes);
|
|
|
|
|
|
|
|
QLabel * labNum = new QLabel;
|
|
|
|
labNum->setText("导联");
|
|
|
|
QVBoxLayout * vlayNum = new QVBoxLayout;
|
2024-11-28 17:54:32 +08:00
|
|
|
vlayNum->addWidget(labNum );
|
2024-11-26 17:16:25 +08:00
|
|
|
vlayNum->addWidget(&m_listNum);
|
|
|
|
|
|
|
|
|
|
|
|
QLabel * labPoints = new QLabel;
|
|
|
|
labPoints->setText("测点");
|
|
|
|
QVBoxLayout * vlayPoints = new QVBoxLayout;
|
|
|
|
vlayPoints->addWidget(labPoints);
|
|
|
|
vlayPoints->addWidget(&m_listPoints);
|
|
|
|
|
|
|
|
|
|
|
|
QLabel * labExPoints = new QLabel;
|
|
|
|
labExPoints->setText("参考点");
|
|
|
|
QVBoxLayout * vlayExPoints = new QVBoxLayout;
|
2024-11-28 17:54:32 +08:00
|
|
|
vlayExPoints->addWidget(labExPoints );
|
|
|
|
vlayExPoints->addWidget(&m_listExPoints );
|
|
|
|
|
2024-11-26 17:16:25 +08:00
|
|
|
|
|
|
|
QHBoxLayout * hlayWPoints = new QHBoxLayout;
|
|
|
|
QWidget * wPoints = new QWidget;
|
|
|
|
wPoints->setLayout(hlayWPoints);
|
2024-11-28 17:54:32 +08:00
|
|
|
hlayWPoints->addLayout(vlayNum );
|
2024-11-26 17:16:25 +08:00
|
|
|
hlayWPoints->addLayout(vlayPoints);
|
|
|
|
hlayWPoints->addLayout(vlayExPoints);
|
|
|
|
|
2024-11-28 17:54:32 +08:00
|
|
|
QLabel * labScheme = new QLabel;
|
|
|
|
labScheme->setText("导联方案");
|
|
|
|
QVBoxLayout * vlayScheme = new QVBoxLayout;
|
2024-11-29 16:44:01 +08:00
|
|
|
vlayScheme->addWidget(labScheme,1,Qt::AlignHCenter);
|
|
|
|
vlayScheme->addWidget(&m_LeadSchemes,1);
|
|
|
|
vlayScheme->addStretch();
|
|
|
|
|
|
|
|
|
|
|
|
#else
|
2024-11-26 17:16:25 +08:00
|
|
|
|
2024-11-29 16:44:01 +08:00
|
|
|
QLabel * labScheme = new QLabel;
|
|
|
|
labScheme->setText("导联方案");
|
2024-11-26 17:16:25 +08:00
|
|
|
|
2024-11-28 17:54:32 +08:00
|
|
|
QLabel * labNum = new QLabel;
|
|
|
|
labNum->setText("导联");
|
|
|
|
|
|
|
|
QLabel * labPoints = new QLabel;
|
|
|
|
labPoints->setText("测点");
|
|
|
|
|
|
|
|
QLabel * labExPoints = new QLabel;
|
|
|
|
labExPoints->setText("参考点");
|
|
|
|
//start
|
|
|
|
QWidget * wPoints = new QWidget;
|
|
|
|
wPoints->setStyleSheet("QPushButton{\
|
|
|
|
background: rgba(255, 255, 255);\
|
|
|
|
color: black;\
|
|
|
|
border-radius: 8px;\
|
|
|
|
border:0px ; \
|
|
|
|
}\
|
|
|
|
QPushButton:hover{\
|
|
|
|
color: black;\
|
|
|
|
background: rgb(255, 255, 255);\
|
|
|
|
border-radius: 8px;\
|
|
|
|
}\
|
|
|
|
QPushButton:pressed{\
|
|
|
|
color: black;\
|
|
|
|
background: rgb(255, 255, 255);\
|
|
|
|
border-radius: 8px;\
|
|
|
|
}\
|
|
|
|
QPushButton:checked{\
|
|
|
|
color: white;\
|
|
|
|
background: rgb(51, 144, 76);\
|
|
|
|
border-radius: 8px;\
|
|
|
|
}"\
|
|
|
|
"QWidget#NavList1{background-color:rgb(255, 255, 255);}"\
|
|
|
|
);
|
|
|
|
QGridLayout * gridlayOut = new QGridLayout;
|
|
|
|
QVBoxLayout * vlayPoints = new QVBoxLayout;
|
|
|
|
vlayPoints->addLayout(gridlayOut);
|
|
|
|
// vlayPoints->addStretch();
|
|
|
|
wPoints->setLayout(vlayPoints);
|
|
|
|
QStringList strList1,strList2,strList3;
|
|
|
|
strList1<<"0"<<"1"<<"2"<<"3"<<"4"<<"5"<<"6"<<"7"<<"8"<<"9"<<"10"<<"11"<<
|
|
|
|
"12"<<"13"<<"14"<<"15";
|
|
|
|
strList2<<"F1"<<"F2"<<"F3"<<"F4"<<"C3"<<"C4"<<"P3"<<"P4"<<"O1"<<"O2"<<"F7"<<"F8"<<
|
|
|
|
"T3"<<"T4"<<"T5"<<"T6";
|
|
|
|
strList3<<"A1"<<"A2"<<"A1"<<"A1"<<"A2"<<"A1"<<"A2"<<"A1"<<"A2"<<"A1"<<"A2"<<"A1"<<
|
|
|
|
"A1"<<"A2"<<"A1"<<"A2";
|
2024-11-29 16:44:01 +08:00
|
|
|
QButtonGroup *pButtonGroup0 = new QButtonGroup(this);
|
|
|
|
|
2024-11-28 17:54:32 +08:00
|
|
|
QButtonGroup *pButtonGroup1 = new QButtonGroup(this);
|
|
|
|
// 设置互斥
|
|
|
|
pButtonGroup1->setExclusive(true);
|
|
|
|
QButtonGroup *pButtonGroup2= new QButtonGroup(this);
|
|
|
|
// 设置互斥
|
|
|
|
pButtonGroup2->setExclusive(true);
|
|
|
|
QButtonGroup *pButtonGroup3 = new QButtonGroup(this);
|
|
|
|
// 设置互斥
|
|
|
|
pButtonGroup3->setExclusive(true);
|
2024-11-29 16:44:01 +08:00
|
|
|
int colmn = 0;
|
|
|
|
|
|
|
|
|
|
|
|
QStringList Sches;
|
|
|
|
Sches<<"8通道"<<"16通道"<<"64通道";
|
|
|
|
gridlayOut->addWidget(labScheme,0,colmn++,Qt::AlignHCenter);
|
|
|
|
for (int i= 0 ; i<Sches.size();i++)
|
|
|
|
{
|
|
|
|
QPushButton * btn = new QPushButton(Sches.at(i));
|
|
|
|
//btn->setMinimumHeight(minHeight);
|
|
|
|
btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
|
|
pButtonGroup0->addButton(btn);
|
|
|
|
gridlayOut->addWidget( btn,i+1,0);
|
|
|
|
btn->setCheckable(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gridlayOut->addWidget(labNum,0,colmn++,Qt::AlignHCenter);
|
2024-11-28 17:54:32 +08:00
|
|
|
int minHeight = 45;
|
|
|
|
for (int i = 0 ;i<strList1.size();i++)
|
|
|
|
{
|
|
|
|
QPushButton * btn = new QPushButton(strList1.at(i));
|
|
|
|
//btn->setMinimumHeight(minHeight);
|
|
|
|
btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
|
|
pButtonGroup1->addButton(btn);
|
2024-11-29 16:44:01 +08:00
|
|
|
gridlayOut->addWidget( btn,i+1,1);
|
2024-11-28 17:54:32 +08:00
|
|
|
btn->setCheckable(true);
|
|
|
|
|
|
|
|
}
|
2024-11-29 16:44:01 +08:00
|
|
|
gridlayOut->addWidget( labPoints,0,colmn++,Qt::AlignHCenter);
|
2024-11-28 17:54:32 +08:00
|
|
|
for (int i = 0 ;i<strList2.size();i++)
|
|
|
|
{
|
|
|
|
QPushButton * btn = new QPushButton(strList2.at(i));
|
|
|
|
//btn->setMinimumHeight(minHeight);
|
|
|
|
btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
|
|
pButtonGroup2->addButton(btn);
|
2024-11-29 16:44:01 +08:00
|
|
|
gridlayOut->addWidget( btn,i+1,2);
|
2024-11-28 17:54:32 +08:00
|
|
|
btn->setCheckable(true);
|
|
|
|
|
|
|
|
}
|
2024-11-29 16:44:01 +08:00
|
|
|
gridlayOut->addWidget( labExPoints,0,colmn++,Qt::AlignHCenter);
|
2024-11-28 17:54:32 +08:00
|
|
|
for (int i = 0 ;i<strList3.size();i++)
|
|
|
|
{
|
|
|
|
QPushButton * btn = new QPushButton(strList3.at(i));
|
|
|
|
//btn->setMinimumHeight(minHeight);
|
|
|
|
btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
|
|
pButtonGroup3->addButton(btn);
|
2024-11-29 16:44:01 +08:00
|
|
|
gridlayOut->addWidget( btn,i+1,3);
|
2024-11-28 17:54:32 +08:00
|
|
|
btn->setCheckable(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
//end
|
|
|
|
|
|
|
|
#endif
|
|
|
|
QWidget * wClickedPints = new QWidget;
|
|
|
|
wClickedPints->setStyleSheet("border-image:url(:/image/img_lead.png);}");
|
|
|
|
// wClickedPints->setFixedWidth(500);
|
|
|
|
//wClickedPints->show();
|
2024-11-26 17:16:25 +08:00
|
|
|
QHBoxLayout * hlayAll = new QHBoxLayout;
|
2024-11-29 16:44:01 +08:00
|
|
|
// hlayAll->addLayout(vlayScheme,1);
|
|
|
|
hlayAll->addWidget(wPoints,3);
|
2024-11-28 17:54:32 +08:00
|
|
|
hlayAll->addWidget(wClickedPints,3);
|
|
|
|
|
|
|
|
|
|
|
|
QList<QColor> colors;
|
|
|
|
colors.append(QColor(100, 184, 255));
|
|
|
|
colors.append(QColor(255, 107, 107));
|
|
|
|
colors.append(QColor(24, 189, 155));
|
|
|
|
colors.append(QColor(1, 174, 103));
|
|
|
|
colors.append(QColor(52, 73, 94));
|
|
|
|
|
|
|
|
int x = 5;
|
|
|
|
int y = 5;
|
|
|
|
int radius = 50;
|
|
|
|
|
|
|
|
QStringList listNames;
|
|
|
|
listNames<<"Fp1"<<"Fp2"
|
|
|
|
<<"F7"<<"F3"<<"Fz"<<"F4"<<"F8"
|
|
|
|
<<"A1"<<"T3"<<"C3"<<"Cz"<<"C4"<<"T4"<<"A2"
|
|
|
|
<<"T5"<<"P3" <<"Pz"<<"P4" <<"T6"
|
|
|
|
<<"O1"<<"O2";
|
|
|
|
|
|
|
|
QJsonObject json;
|
2024-12-02 17:01:16 +08:00
|
|
|
OperatorJson Ojson;
|
|
|
|
Ojson.readJson(QApplication::applicationDirPath()+"/0.json",json);
|
2024-11-28 17:54:32 +08:00
|
|
|
|
|
|
|
|
2024-12-02 17:01:16 +08:00
|
|
|
qDebug()<<"hahaha"<<json<<endl;
|
2024-11-28 17:54:32 +08:00
|
|
|
for(int i = 0 ; i< listNames.size();i++)
|
|
|
|
{
|
|
|
|
MoveButton * btn = new MoveButton(wClickedPints);
|
|
|
|
btn->setParent(wClickedPints);
|
2024-12-02 17:01:16 +08:00
|
|
|
int x =json[listNames.at(i)].toObject()["x"].toInt();
|
|
|
|
int y = json[listNames.at(i)].toObject()["y"].toInt();
|
2024-11-28 17:54:32 +08:00
|
|
|
|
2024-12-02 17:01:16 +08:00
|
|
|
btn->setGeometry(x,y, radius, radius);
|
2024-11-28 17:54:32 +08:00
|
|
|
//x = x + radius;
|
|
|
|
btn->setText(listNames.at(i));
|
|
|
|
btn->setCanMove(true);
|
|
|
|
btn->setShowOverlay(true);
|
|
|
|
btn->setBgColor(QColor(1, 174, 103));
|
|
|
|
m_listMoveBtns.append(btn);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QWidget * Wall = new QWidget;
|
|
|
|
Wall->setLayout(hlayAll);
|
|
|
|
Wall->setStyleSheet("QWidget \
|
|
|
|
{\
|
|
|
|
background-color:white;\
|
|
|
|
border-radius:10px;\
|
|
|
|
}");
|
|
|
|
|
|
|
|
|
|
|
|
QHBoxLayout * hbtn = new QHBoxLayout;
|
|
|
|
hbtn->addStretch();
|
|
|
|
hbtn->addWidget(&m_btnNew);
|
|
|
|
hbtn->addWidget(&m_btndelete);
|
|
|
|
hbtn->addWidget(&m_btnCancel);
|
|
|
|
hbtn->addWidget(&m_btnOK);
|
|
|
|
hbtn->addStretch();
|
|
|
|
|
|
|
|
|
|
|
|
QVBoxLayout * vlayAll = new QVBoxLayout;
|
|
|
|
vlayAll->addWidget(Wall);
|
|
|
|
vlayAll->addLayout(hbtn);
|
|
|
|
setLayout(vlayAll);
|
2024-11-26 17:16:25 +08:00
|
|
|
}
|
2024-12-02 17:01:16 +08:00
|
|
|
#include "operatorjson.h"
|
|
|
|
#include <QApplication>
|
2024-11-28 17:54:32 +08:00
|
|
|
void LeadScheme::slotSave()
|
|
|
|
{
|
2024-12-02 17:01:16 +08:00
|
|
|
QJsonObject jsonSave;
|
|
|
|
|
2024-11-28 17:54:32 +08:00
|
|
|
for(int i = 0;i< m_listMoveBtns.size();i++ )
|
|
|
|
{
|
|
|
|
auto btn = m_listMoveBtns.at(i);
|
|
|
|
QString text = btn->getText();
|
|
|
|
int x = btn->x();
|
|
|
|
int y = btn->y();
|
2024-12-02 17:01:16 +08:00
|
|
|
QJsonObject perJson;
|
|
|
|
perJson.insert("x",x);
|
|
|
|
perJson.insert("y",y);
|
|
|
|
jsonSave.insert(text,perJson);
|
2024-11-28 17:54:32 +08:00
|
|
|
qDebug()<<QString("名称:%1\tx:%2\ty:%3").arg(text).arg(x).arg(y)<<endl;
|
2024-12-02 17:01:16 +08:00
|
|
|
}
|
|
|
|
OperatorJson json;
|
|
|
|
json.savaJson(jsonSave,QApplication::applicationDirPath()+"/0.json");
|
|
|
|
|
2024-11-28 17:54:32 +08:00
|
|
|
}
|