kylin-nm/plugins/wlanconnect/itemframe.cpp

64 lines
1.7 KiB
C++
Raw Normal View History

2021-10-27 12:28:16 +08:00
#include "itemframe.h"
2021-12-01 11:07:21 +08:00
#include <QPainter>
2021-10-27 12:28:16 +08:00
#define LAYOUT_MARGINS 0,0,0,0
2021-12-02 09:49:29 +08:00
#define MAIN_LAYOUT_MARGINS 0,0,0,0
2021-10-27 12:28:16 +08:00
ItemFrame::ItemFrame(QString devName, QWidget *parent)
{
deviceLanLayout = new QVBoxLayout(this);
deviceLanLayout->setContentsMargins(MAIN_LAYOUT_MARGINS);
lanItemFrame = new QFrame(this);
lanItemFrame->setFrameShape(QFrame::Shape::NoFrame);
lanItemFrame->setContentsMargins(LAYOUT_MARGINS);
lanItemLayout = new QVBoxLayout(this);
lanItemLayout->setContentsMargins(LAYOUT_MARGINS);
lanItemLayout->setSpacing(1);
addWlanWidget = new AddNetBtn(true, this);
2021-10-27 12:28:16 +08:00
deviceLanLayout->setSpacing(1);
setLayout(deviceLanLayout);
lanItemFrame->setLayout(lanItemLayout);
deviceFrame = new DeviceFrame(devName, this);
deviceLanLayout->addWidget(deviceFrame);
deviceLanLayout->addWidget(lanItemFrame);
deviceLanLayout->addWidget(addWlanWidget);
2021-10-27 12:28:16 +08:00
//下拉按钮
connect(deviceFrame->dropDownLabel, &DrownLabel::labelClicked, this, &ItemFrame::onDrownLabelClicked);
}
ItemFrame::~ItemFrame()
{
}
void ItemFrame::onDrownLabelClicked()
{
if (!deviceFrame->dropDownLabel->isChecked) {
lanItemFrame->show();
deviceFrame->dropDownLabel->setDropDownStatus(true);
} else {
lanItemFrame->hide();
deviceFrame->dropDownLabel->setDropDownStatus(false);
}
}
2021-12-01 11:07:21 +08:00
void ItemFrame::filletStyleChange()
{
if (lanItemLayout->isEmpty()) {
return;
}
for (int i = 0; i < lanItemLayout->count(); ++i) {
QLayoutItem *it = lanItemLayout->itemAt(i);
WlanItem *itemFrame = (WlanItem*)(it->widget());
if (i != lanItemLayout->count()-1) {
itemFrame->setHalfFillet(false);
} else {
itemFrame->setHalfFillet(true);
}
}
}