调整设置支持重新布局
This commit is contained in:
parent
a40a56b260
commit
85daf3be65
Binary file not shown.
@ -244,7 +244,7 @@ void LeadScheme::initLay()
|
||||
}
|
||||
#else
|
||||
QStringList Sches;
|
||||
Sches<<"8通道"<<"16通道"<<"64通道";
|
||||
Sches<<"8通道"<<"16通道"<<"64通道"<<"sss"<<"kk";
|
||||
gridlayOut->addWidget(labScheme,0,colmn++,Qt::AlignHCenter);
|
||||
QScrollArea * scroll = new QScrollArea;
|
||||
scroll->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
|
||||
@ -254,8 +254,8 @@ void LeadScheme::initLay()
|
||||
|
||||
gridlayOut->addWidget(scroll,1,colmn-1,12,1);
|
||||
// QGridLayout * gridShech = new QGridLayout;
|
||||
QVBoxLayout * vlayHH = new QVBoxLayout;
|
||||
wShech->setLayout(vlayHH);
|
||||
m_vlayHH = new QVBoxLayout;
|
||||
wShech->setLayout(m_vlayHH);
|
||||
for (int i= 0 ; i<Sches.size();i++)
|
||||
{
|
||||
QPushButton * btn = new QPushButton(Sches.at(i));
|
||||
@ -263,10 +263,10 @@ void LeadScheme::initLay()
|
||||
btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
pButtonGroup0->addButton(btn);
|
||||
//gridShech->addWidget( btn,i+1,0);
|
||||
vlayHH->addWidget(btn);
|
||||
m_vlayHH->addWidget(btn);
|
||||
btn->setCheckable(true);
|
||||
}
|
||||
vlayHH->addStretch();
|
||||
m_vlayHH->addStretch();
|
||||
|
||||
scroll->setWidget(wShech);
|
||||
|
||||
@ -388,18 +388,52 @@ void LeadScheme::initLay()
|
||||
border-radius:10px;\
|
||||
}");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QVBoxLayout * vlayAll = new QVBoxLayout;
|
||||
vlayAll->addWidget(Wall);
|
||||
//vlayAll->addLayout(hbtn);
|
||||
setLayout(vlayAll);
|
||||
}
|
||||
void LeadScheme::reLay()
|
||||
{
|
||||
QLayoutItem *child;
|
||||
while ((child = m_vlayHH->takeAt(0)) != 0)
|
||||
{
|
||||
//删除Stretch(弹簧)等布局
|
||||
if (child->spacerItem())
|
||||
{
|
||||
m_vlayHH->removeItem(child);
|
||||
continue;
|
||||
}
|
||||
//删除布局
|
||||
//删除布局
|
||||
QWidget * w = child->widget();
|
||||
|
||||
void LeadScheme::slotSave()
|
||||
{
|
||||
if(w->inherits("QAbstractButton"))
|
||||
{
|
||||
QPushButton * btn = static_cast<QPushButton *>(w);
|
||||
if(btn)
|
||||
{
|
||||
|
||||
bool ok = btn->text().compare("8通道")== 0 ||btn->text().compare("16通道")== 0 ||btn->text().compare("64通道")== 0 ;
|
||||
if(ok)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
m_vlayHH->removeWidget(child->widget());
|
||||
child->widget()->setParent(0);
|
||||
if (w)
|
||||
{
|
||||
w->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
void LeadScheme::slotSave()
|
||||
{
|
||||
QJsonObject jsonSave;
|
||||
|
||||
for(int i = 0;i< m_listMoveBtns.size();i++ )
|
||||
@ -416,7 +450,7 @@ void LeadScheme::initLay()
|
||||
}
|
||||
OperatorJson json;
|
||||
json.savaJson(jsonSave,QApplication::applicationDirPath()+"/0.json");
|
||||
|
||||
reLay();
|
||||
}
|
||||
void LeadScheme::slotNew()
|
||||
{
|
||||
|
@ -20,7 +20,8 @@ public:
|
||||
void init();
|
||||
bool initconnect();
|
||||
void initLay();
|
||||
|
||||
private:
|
||||
void reLay();
|
||||
private slots:
|
||||
void slotSave();
|
||||
void slotNew();
|
||||
@ -30,7 +31,7 @@ private:
|
||||
QPushButton m_btndelete;
|
||||
QPushButton m_btnCancel;
|
||||
QPushButton m_btnOK;
|
||||
|
||||
QVBoxLayout * m_vlayHH ;
|
||||
QList<MoveButton*> m_listMoveBtns;
|
||||
QLineEdit m_editShecName;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user