use define
This commit is contained in:
parent
ca88d224dd
commit
5c65f62860
|
@ -416,10 +416,10 @@ void LanPage::constructConnectionArea()
|
|||
|
||||
}
|
||||
}
|
||||
if (m_inactivatedLanListWidget->count() < 4) {
|
||||
m_inactivatedLanListWidget->setFixedWidth(383);
|
||||
if (m_inactivatedLanListWidget->count() < MAX_ITEMS) {
|
||||
m_inactivatedLanListWidget->setFixedWidth(MIN_WIDTH);
|
||||
} else {
|
||||
m_inactivatedLanListWidget->setFixedWidth(400);
|
||||
m_inactivatedLanListWidget->setFixedWidth(MAX_WIDTH);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -462,8 +462,8 @@ bool LanPage::removeConnectionItem(QMap<QString, QListWidgetItem *> &connectMap,
|
|||
p_listWidgetItem = nullptr;
|
||||
|
||||
iter = connectMap.erase(iter);
|
||||
if (m_inactivatedLanListWidget->count() < 4) {
|
||||
m_inactivatedLanListWidget->setFixedWidth(383);
|
||||
if (m_inactivatedLanListWidget->count() < MAX_ITEMS) {
|
||||
m_inactivatedLanListWidget->setFixedWidth(MIN_WIDTH);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -515,8 +515,8 @@ void LanPage::onAddConnection(QString uuid) //新增一个有线
|
|||
|
||||
delete p_newItem;
|
||||
p_newItem = nullptr;
|
||||
if (m_inactivatedLanListWidget->count() >= 4) {
|
||||
m_inactivatedLanListWidget->setFixedWidth(400);
|
||||
if (m_inactivatedLanListWidget->count() >= MAX_ITEMS) {
|
||||
m_inactivatedLanListWidget->setFixedWidth(MAX_WIDTH);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -760,7 +760,7 @@ void LanPage::initUI()
|
|||
m_activatedLanListWidget->setFrameShape(QFrame::Shape::NoFrame);
|
||||
m_activatedLanListWidget->setSpacing(LAN_LIST_SPACING);
|
||||
m_activatedLanListWidget->setFixedHeight(ITEM_HEIGHT); //active区域固定高度,只显示一个条目
|
||||
m_activatedLanListWidget->setFixedWidth(383);
|
||||
m_activatedLanListWidget->setFixedWidth(MIN_WIDTH);
|
||||
m_activatedLanListWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_activatedNetLayout->addWidget(m_activatedLanListWidget);
|
||||
|
||||
|
@ -844,8 +844,8 @@ void LanPage::updateActivatedConnectionArea(KyConnectItem *p_newItem)
|
|||
m_activeConnectionMap.insert(p_newItem->m_connectUuid, p_listWidgetItem);
|
||||
this->showDesktopNotify(tr("LAN Connected Successfully"));
|
||||
}
|
||||
if (m_inactivatedLanListWidget->count() < 4) {
|
||||
m_inactivatedLanListWidget->setFixedWidth(383);
|
||||
if (m_inactivatedLanListWidget->count() < MAX_ITEMS) {
|
||||
m_inactivatedLanListWidget->setFixedWidth(MIN_WIDTH);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -868,10 +868,10 @@ void LanPage::updateConnectionArea(KyConnectItem *p_newItem)
|
|||
m_inactiveConnectionMap.insert(p_newItem->m_connectUuid, p_listWidgetItem);
|
||||
this->showDesktopNotify(tr("LAN Disconnected Successfully"));
|
||||
}
|
||||
if (m_inactivatedLanListWidget->count() < 4) {
|
||||
m_inactivatedLanListWidget->setFixedWidth(383);
|
||||
if (m_inactivatedLanListWidget->count() < MAX_ITEMS) {
|
||||
m_inactivatedLanListWidget->setFixedWidth(MIN_WIDTH);
|
||||
} else {
|
||||
m_inactivatedLanListWidget->setFixedWidth(400);
|
||||
m_inactivatedLanListWidget->setFixedWidth(MAX_WIDTH);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
@ -33,6 +33,10 @@
|
|||
#define INACTIVE_AREA_MIN_HEIGHT 170
|
||||
#define ACTIVE_AREA_MAX_HEIGHT 92
|
||||
|
||||
#define MAX_ITEMS 4
|
||||
#define MAX_WIDTH 400
|
||||
#define MIN_WIDTH 383
|
||||
|
||||
#define SCROLL_STEP 4
|
||||
|
||||
enum KyDeviceType
|
||||
|
|
|
@ -79,7 +79,7 @@ void WlanPage::initWlanUI()
|
|||
m_activatedNetListWidget->setContentsMargins(MAIN_LAYOUT_MARGINS);
|
||||
m_activatedNetListWidget->setSpacing(NET_LIST_SPACING);
|
||||
m_activatedNetListWidget->setFixedHeight(NORMAL_HEIGHT);
|
||||
m_activatedNetListWidget->setFixedWidth(383);
|
||||
m_activatedNetListWidget->setFixedWidth(MIN_WIDTH);
|
||||
m_activatedNetListWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_activatedNetLayout->addWidget(m_activatedNetListWidget);
|
||||
|
||||
|
@ -383,8 +383,8 @@ void WlanPage::deleteWirelessItemFormMap(QMap<QString, QListWidgetItem*> &wirele
|
|||
delete p_listWidgetItem;
|
||||
p_listWidgetItem = nullptr;
|
||||
|
||||
if (m_inactivatedNetListWidget->count() < 4) {
|
||||
m_inactivatedNetListWidget->setFixedWidth(383);
|
||||
if (m_inactivatedNetListWidget->count() < MAX_ITEMS) {
|
||||
m_inactivatedNetListWidget->setFixedWidth(MIN_WIDTH);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -461,10 +461,10 @@ void WlanPage::constructWirelessNetArea()
|
|||
|
||||
qDebug() << "[WlanPage] Stopped loading wireless net list! time="
|
||||
<< QDateTime::currentDateTime().toString("hh:mm:ss.zzzz");
|
||||
if (m_inactivatedNetListWidget->count() < 4) {
|
||||
m_inactivatedNetListWidget->setFixedWidth(383);
|
||||
if (m_inactivatedNetListWidget->count() < MAX_ITEMS) {
|
||||
m_inactivatedNetListWidget->setFixedWidth(MIN_WIDTH);
|
||||
} else {
|
||||
m_inactivatedNetListWidget->setFixedWidth(400);
|
||||
m_inactivatedNetListWidget->setFixedWidth(MAX_WIDTH);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -515,8 +515,8 @@ void WlanPage::onWlanAdded(QString interface, KyWirelessNetItem &item)
|
|||
updateWlanItemState(m_inactivatedNetListWidget, p_listWidgetItem, Deactivated);
|
||||
|
||||
addWlanMoreItem();
|
||||
if (m_inactivatedNetListWidget->count() >= 4) {
|
||||
m_inactivatedNetListWidget->setFixedWidth(400);
|
||||
if (m_inactivatedNetListWidget->count() >= MAX_ITEMS) {
|
||||
m_inactivatedNetListWidget->setFixedWidth(MAX_WIDTH);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -836,8 +836,8 @@ void WlanPage::updateActivatedArea(QString uuid, QString ssid, QString devName)
|
|||
m_activateConnectionItemMap.insert(wirelessNetItem.m_NetSsid, p_listWidgetItem);
|
||||
|
||||
m_activatedNetListWidget->setFixedHeight(p_listWidgetItem->sizeHint().height());
|
||||
if (m_inactivatedNetListWidget->count() < 4) {
|
||||
m_inactivatedNetListWidget->setFixedWidth(383);
|
||||
if (m_inactivatedNetListWidget->count() < MAX_ITEMS) {
|
||||
m_inactivatedNetListWidget->setFixedWidth(MIN_WIDTH);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -869,10 +869,10 @@ void WlanPage::updateWirelessNetArea(QString uuid, QString ssid, QString devName
|
|||
|
||||
// 更新‘更多’条目,以保证其处于listwidget的最底部
|
||||
addWlanMoreItem();
|
||||
if (m_inactivatedNetListWidget->count() < 4) {
|
||||
m_inactivatedNetListWidget->setFixedWidth(383);
|
||||
if (m_inactivatedNetListWidget->count() < MAX_ITEMS) {
|
||||
m_inactivatedNetListWidget->setFixedWidth(MIN_WIDTH);
|
||||
} else {
|
||||
m_inactivatedNetListWidget->setFixedWidth(400);
|
||||
m_inactivatedNetListWidget->setFixedWidth(MAX_WIDTH);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -128,8 +128,7 @@ void SwitchButton::leaveEvent(QEvent *event)
|
|||
{
|
||||
if (m_enabled && m_bIsOn) {
|
||||
m_colorActive = COLOR_ACTIVE;
|
||||
}
|
||||
else if (m_enabled && !m_bIsOn) {
|
||||
} else if (m_enabled && !m_bIsOn) {
|
||||
m_colorInactive = COLOR_INACTIVE;
|
||||
}
|
||||
this->update();
|
||||
|
|
Loading…
Reference in New Issue