#include "leadscheme.h" #include #include #include #include LeadScheme::LeadScheme(QWidget * parent ):QWidget (parent) { init(); initconnect(); initLay(); } LeadScheme::~LeadScheme() { } void LeadScheme::init() { 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); } bool LeadScheme::initconnect() { bool bCon = true; bCon = connect(&m_btnOK,SIGNAL(clicked(bool)),this,SLOT(slotSave())); if(!bCon) { qDebug()<<"connect failed"<setText("导联方案"); QVBoxLayout * vlayScheme = new QVBoxLayout; vlayScheme->addWidget(labScheme); vlayScheme->addWidget(&m_LeadSchemes); QLabel * labNum = new QLabel; labNum->setText("导联"); QVBoxLayout * vlayNum = new QVBoxLayout; vlayNum->addWidget(labNum ); 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; vlayExPoints->addWidget(labExPoints ); vlayExPoints->addWidget(&m_listExPoints ); QHBoxLayout * hlayWPoints = new QHBoxLayout; QWidget * wPoints = new QWidget; wPoints->setLayout(hlayWPoints); hlayWPoints->addLayout(vlayNum ); hlayWPoints->addLayout(vlayPoints); hlayWPoints->addLayout(vlayExPoints); QLabel * labScheme = new QLabel; labScheme->setText("导联方案"); QVBoxLayout * vlayScheme = new QVBoxLayout; vlayScheme->addWidget(labScheme,1,Qt::AlignHCenter); vlayScheme->addWidget(&m_LeadSchemes,1); vlayScheme->addStretch(); #else QLabel * labScheme = new QLabel; labScheme->setText("导联方案"); 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"; QButtonGroup *pButtonGroup0 = new QButtonGroup(this); QButtonGroup *pButtonGroup1 = new QButtonGroup(this); // 设置互斥 pButtonGroup1->setExclusive(true); QButtonGroup *pButtonGroup2= new QButtonGroup(this); // 设置互斥 pButtonGroup2->setExclusive(true); QButtonGroup *pButtonGroup3 = new QButtonGroup(this); // 设置互斥 pButtonGroup3->setExclusive(true); int colmn = 0; QStringList Sches; Sches<<"8通道"<<"16通道"<<"64通道"; gridlayOut->addWidget(labScheme,0,colmn++,Qt::AlignHCenter); for (int i= 0 ; isetMinimumHeight(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); int minHeight = 45; for (int i = 0 ;isetMinimumHeight(minHeight); btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); pButtonGroup1->addButton(btn); gridlayOut->addWidget( btn,i+1,1); btn->setCheckable(true); } gridlayOut->addWidget( labPoints,0,colmn++,Qt::AlignHCenter); for (int i = 0 ;isetMinimumHeight(minHeight); btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); pButtonGroup2->addButton(btn); gridlayOut->addWidget( btn,i+1,2); btn->setCheckable(true); } gridlayOut->addWidget( labExPoints,0,colmn++,Qt::AlignHCenter); for (int i = 0 ;isetMinimumHeight(minHeight); btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); pButtonGroup3->addButton(btn); gridlayOut->addWidget( btn,i+1,3); btn->setCheckable(true); } //end #endif QWidget * wClickedPints = new QWidget; wClickedPints->setStyleSheet("border-image:url(:/image/img_lead.png);}"); // wClickedPints->setFixedWidth(500); //wClickedPints->show(); QHBoxLayout * hlayAll = new QHBoxLayout; // hlayAll->addLayout(vlayScheme,1); hlayAll->addWidget(wPoints,3); hlayAll->addWidget(wClickedPints,3); QList 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; #if 0 // "名称:Fp1\tx:306\ty:150" json.insert("Fp1",QJsonValue::fromVariant(QPoint(306,150))); //"名称:Fp2\tx:481\ty:151" json.insert("Fp2",QJsonValue::fromVariant(QPoint(481,151))); //"名称:F7\tx:197\ty:224" json.insert("F7",QJsonValue::fromVariant(QPoint(197,224))); // "名称:F3\tx:293\ty:253" json.insert("F3",QJsonValue::fromVariant(QPoint(293,253))); // "名称:Fz\tx:389\ty:263" json.insert("Fz",QJsonValue::fromVariant(QPoint(389,263))); //"名称:F4\tx:489\ty:252" json.insert("F4",QJsonValue::fromVariant(QPoint(489,252))); //"名称:F8\tx:590\ty:223" json.insert("F8",QJsonValue::fromVariant(QPoint(590,223))); // "名称:A1\tx:2\ty:410" json.insert("A1",QJsonValue::fromVariant(QPoint(2,410))); //"名称:T3\tx:133\ty:410" json.insert("T3",QJsonValue::fromVariant(QPoint(133,410))); //"名称:C3\tx:263\ty:411" json.insert("C3",QJsonValue::fromVariant(QPoint(263,411))); //"名称:Cz\tx:392\ty:411" json.insert("Cz",QJsonValue::fromVariant(QPoint(392,411))); //"名称:C4\tx:523\ty:412" json.insert("C4",QJsonValue::fromVariant(QPoint(523,412))); // "名称:T4\tx:651\ty:413" json.insert("T4",QJsonValue::fromVariant(QPoint(651,413))); //"名称:A2\tx:781\ty:414" json.insert("A2",QJsonValue::fromVariant(QPoint(781,414))); // "名称:T5\tx:195\ty:608" json.insert("T5",QJsonValue::fromVariant(QPoint(195,608))); //"名称:P3\tx:293\ty:582" json.insert("P3",QJsonValue::fromVariant(QPoint(293,582))); //"名称:Pz\tx:392\ty:572" json.insert("Pz",QJsonValue::fromVariant(QPoint(392,572))); //"名称:P4\tx:490\ty:580" json.insert("P4",QJsonValue::fromVariant(QPoint(490,580))); //"名称:T6\tx:585\ty:609" json.insert("T6",QJsonValue::fromVariant(QPoint(585,609))); //"名称:O1\tx:307\ty:679" json.insert("O1",QJsonValue::fromVariant(QPoint(307,679))); // "名称:O2\tx:481\ty:682" json.insert("O2",QJsonValue::fromVariant(QPoint(481,682))); #endif QList listPoints; listPoints.append(QPoint(306,150)); //"名称:Fp2\tx:481\ty:151" listPoints.append(QPoint(481,151)); //"名称:F7\tx:197\ty:224" listPoints.append(QPoint(197,224)); // "名称:F3\tx:293\ty:253" listPoints.append(QPoint(293,253)); // "名称:Fz\tx:389\ty:263" listPoints.append(QPoint(389,263)); //"名称:F4\tx:489\ty:252" listPoints.append(QPoint(489,252)); //"名称:F8\tx:590\ty:223" listPoints.append(QPoint(590,223)); // "名称:A1\tx:2\ty:410" listPoints.append(QPoint(2,410)); //"名称:T3\tx:133\ty:410" listPoints.append(QPoint(133,410)); //"名称:C3\tx:263\ty:411" listPoints.append(QPoint(263,411)); //"名称:Cz\tx:392\ty:411" listPoints.append(QPoint(392,411)); //"名称:C4\tx:523\ty:412" listPoints.append(QPoint(523,412)); // "名称:T4\tx:651\ty:413" listPoints.append(QPoint(651,413)); //"名称:A2\tx:781\ty:414" listPoints.append(QPoint(781,414)); // "名称:T5\tx:195\ty:608" listPoints.append(QPoint(195,608)); //"名称:P3\tx:293\ty:582" listPoints.append(QPoint(293,582)); //"名称:Pz\tx:392\ty:572" listPoints.append(QPoint(392,572)); //"名称:P4\tx:490\ty:580" listPoints.append(QPoint(490,580)); //"名称:T6\tx:585\ty:609" listPoints.append(QPoint(585,609)); //"名称:O1\tx:307\ty:679" listPoints.append(QPoint(307,679)); // "名称:O2\tx:481\ty:682" listPoints.append(QPoint(481,682)); for(int i = 0 ; i< listNames.size();i++) { MoveButton * btn = new MoveButton(wClickedPints); btn->setParent(wClickedPints); QPoint tempPoint = listPoints.at(i);//json.value(listNames.at(i)).toVariant().toPoint(); btn->setGeometry(tempPoint.x(), tempPoint.y(), radius, radius); //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); } void LeadScheme::slotSave() { 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(); qDebug()<