Optimize code.
This commit is contained in:
parent
c2a3b603b1
commit
c299e43cda
|
@ -14,6 +14,7 @@ ListItem::~ListItem()
|
|||
{
|
||||
delete m_netButton;
|
||||
m_netButton = NULL;
|
||||
|
||||
delete m_infoButton;
|
||||
m_infoButton = NULL;
|
||||
}
|
||||
|
@ -26,19 +27,24 @@ void ListItem::setName(const QString &name)
|
|||
void ListItem::initUI()
|
||||
{
|
||||
m_mainLayout = new QVBoxLayout(this);
|
||||
this->setLayout(m_mainLayout);
|
||||
m_mainLayout->setContentsMargins(MAIN_LAYOUT_MARGINS);
|
||||
m_mainLayout->setSpacing(MAIN_LAYOUT_SPACING);
|
||||
this->setLayout(m_mainLayout);
|
||||
|
||||
m_itemFrame = new QFrame(this);
|
||||
|
||||
m_hItemLayout = new QHBoxLayout(m_itemFrame);
|
||||
m_hItemLayout->setContentsMargins(ITEM_FRAME_MARGINS);
|
||||
m_hItemLayout->setSpacing(ITEM_FRAME_SPACING);
|
||||
|
||||
m_netButton = new NetButton(m_itemFrame);
|
||||
m_nameLabel = new QLabel(m_itemFrame);
|
||||
m_infoButton = new InfoButton(m_itemFrame);
|
||||
|
||||
m_hItemLayout->addWidget(m_netButton);
|
||||
m_hItemLayout->addWidget(m_nameLabel);
|
||||
m_hItemLayout->addStretch();
|
||||
m_hItemLayout->addWidget(m_infoButton);
|
||||
|
||||
m_mainLayout->addWidget(m_itemFrame);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue