Fix:the wlanitem show bug 10-14
This commit is contained in:
parent
d2e035ed8a
commit
1705488d60
|
@ -58,8 +58,8 @@ void WlanListItem::setExpanded(const bool &expanded)
|
||||||
}
|
}
|
||||||
this->setFixedHeight(expanded ? EXPANDED_HEIGHT : NORMAL_HEIGHT);
|
this->setFixedHeight(expanded ? EXPANDED_HEIGHT : NORMAL_HEIGHT);
|
||||||
|
|
||||||
m_pwdFrame->setVisible(expanded);
|
// m_pwdFrame->setVisible(false);
|
||||||
m_autoConnectFrame->setVisible(expanded);
|
// m_autoConnectFrame->setVisible(false);
|
||||||
emit this->itemHeightChanged(m_data->m_NetSsid);
|
emit this->itemHeightChanged(m_data->m_NetSsid);
|
||||||
if (!expanded) {
|
if (!expanded) {
|
||||||
QPalette pal = qApp->palette();
|
QPalette pal = qApp->palette();
|
||||||
|
@ -68,6 +68,12 @@ void WlanListItem::setExpanded(const bool &expanded)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WlanListItem::setWlanItemPwdVisible(const bool &expanded)
|
||||||
|
{
|
||||||
|
m_pwdFrame->setVisible(expanded);
|
||||||
|
m_autoConnectFrame->setVisible(expanded);
|
||||||
|
}
|
||||||
|
|
||||||
QString WlanListItem::getSsid()
|
QString WlanListItem::getSsid()
|
||||||
{
|
{
|
||||||
if (!m_data) {
|
if (!m_data) {
|
||||||
|
|
|
@ -30,6 +30,7 @@ public:
|
||||||
void setWlanSignal(const int &signal);
|
void setWlanSignal(const int &signal);
|
||||||
void setWlanState(const int &state);
|
void setWlanState(const int &state);
|
||||||
void setExpanded(const bool &expanded);
|
void setExpanded(const bool &expanded);
|
||||||
|
void setWlanItemPwdVisible(const bool &expanded);
|
||||||
QString getSsid();
|
QString getSsid();
|
||||||
KyWirelessNetItem *m_data = nullptr;
|
KyWirelessNetItem *m_data = nullptr;
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -386,6 +386,10 @@ void WlanPage::onWlanRemoved(QString interface, QString ssid)
|
||||||
int height = m_itemsMap.value(ssid).second->height();
|
int height = m_itemsMap.value(ssid).second->height();
|
||||||
m_inactivatedNetListWidget->setFixedHeight(m_inactivatedNetListWidget->height() - height - NET_LIST_SPACING);
|
m_inactivatedNetListWidget->setFixedHeight(m_inactivatedNetListWidget->height() - height - NET_LIST_SPACING);
|
||||||
m_inactivatedWlanListAreaCentralWidget->setFixedHeight(m_inactivatedNetListWidget->height() + m_hiddenWlanLabel->height());
|
m_inactivatedWlanListAreaCentralWidget->setFixedHeight(m_inactivatedNetListWidget->height() + m_hiddenWlanLabel->height());
|
||||||
|
QListWidgetItem * aItem = (m_itemsMap.value(ssid)).first;
|
||||||
|
delete aItem;
|
||||||
|
WlanListItem * awItem = (m_itemsMap.value(ssid)).second;
|
||||||
|
delete awItem;
|
||||||
}
|
}
|
||||||
m_itemsMap.remove(ssid);
|
m_itemsMap.remove(ssid);
|
||||||
}
|
}
|
||||||
|
@ -605,22 +609,32 @@ void WlanPage::onActivatedWlanChanged(QString uuid, NetworkManager::ActiveConnec
|
||||||
|
|
||||||
void WlanPage::onItemHeightChanged(const QString &ssid)
|
void WlanPage::onItemHeightChanged(const QString &ssid)
|
||||||
{
|
{
|
||||||
|
qDebug() << "onItemHeightChanged" << __LINE__;
|
||||||
if (!m_itemsMap.contains(ssid)) { return; }
|
if (!m_itemsMap.contains(ssid)) { return; }
|
||||||
|
//新的展开item
|
||||||
QListWidgetItem *item = (m_itemsMap.value(ssid)).first;
|
QListWidgetItem *item = (m_itemsMap.value(ssid)).first;
|
||||||
|
WlanListItem * m_item = (m_itemsMap.value(ssid)).second;
|
||||||
|
|
||||||
if (m_expandedItem && m_expandedItem != item) {
|
if (m_expandedItem && m_expandedItem != item) {
|
||||||
|
qDebug() << "onItemHeightChanged : the old fold and the new expanded" << m_expandedItem << item << __LINE__;
|
||||||
QSize size(m_inactivatedNetListWidget->itemWidget(m_expandedItem)->size().width(), NORMAL_HEIGHT);
|
QSize size(m_inactivatedNetListWidget->itemWidget(m_expandedItem)->size().width(), NORMAL_HEIGHT);
|
||||||
//旧的收起
|
//旧的收起
|
||||||
m_expandedItem->setSizeHint(size);
|
m_expandedItem->setSizeHint(size);
|
||||||
m_inactivatedNetListWidget->itemWidget(m_expandedItem)->setFixedHeight(NORMAL_HEIGHT);
|
m_inactivatedNetListWidget->itemWidget(m_expandedItem)->setFixedHeight(NORMAL_HEIGHT);
|
||||||
|
m_wlanExpandedItem->setWlanItemPwdVisible(false);
|
||||||
//新的展开
|
//新的展开
|
||||||
m_expandedItem = item;
|
m_expandedItem = item;
|
||||||
|
m_wlanExpandedItem = m_item;
|
||||||
item->setSizeHint(m_inactivatedNetListWidget->itemWidget(item)->size());
|
item->setSizeHint(m_inactivatedNetListWidget->itemWidget(item)->size());
|
||||||
|
m_item->setWlanItemPwdVisible(true);
|
||||||
} else if (!m_expandedItem) {
|
} else if (!m_expandedItem) {
|
||||||
|
qDebug() << "onItemHeightChanged : only expanded the new one " << m_expandedItem << item << __LINE__;
|
||||||
m_expandedItem = item;
|
m_expandedItem = item;
|
||||||
|
m_wlanExpandedItem = m_item;
|
||||||
m_inactivatedNetListWidget->setFixedHeight(m_inactivatedNetListWidget->height() + m_inactivatedNetListWidget->itemWidget(item)->height() - item->sizeHint().height());
|
m_inactivatedNetListWidget->setFixedHeight(m_inactivatedNetListWidget->height() + m_inactivatedNetListWidget->itemWidget(item)->height() - item->sizeHint().height());
|
||||||
m_inactivatedWlanListAreaCentralWidget->setFixedHeight(m_inactivatedNetListWidget->height() + m_hiddenWlanLabel->height());
|
m_inactivatedWlanListAreaCentralWidget->setFixedHeight(m_inactivatedNetListWidget->height() + m_hiddenWlanLabel->height());
|
||||||
item->setSizeHint(m_inactivatedNetListWidget->itemWidget(item)->size());
|
item->setSizeHint(m_inactivatedNetListWidget->itemWidget(item)->size());
|
||||||
|
m_item->setWlanItemPwdVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,7 @@ private:
|
||||||
|
|
||||||
QMap<QString, QPair<QListWidgetItem*, WlanListItem*>> m_itemsMap;
|
QMap<QString, QPair<QListWidgetItem*, WlanListItem*>> m_itemsMap;
|
||||||
QListWidgetItem *m_expandedItem = nullptr;
|
QListWidgetItem *m_expandedItem = nullptr;
|
||||||
|
WlanListItem *m_wlanExpandedItem = nullptr;
|
||||||
QFrame * m_inactivatedWlanListAreaCentralWidget = nullptr;
|
QFrame * m_inactivatedWlanListAreaCentralWidget = nullptr;
|
||||||
QVBoxLayout * m_inactivatedWlanListAreaLayout = nullptr;
|
QVBoxLayout * m_inactivatedWlanListAreaLayout = nullptr;
|
||||||
QFrame * m_hiddenWlanWidget = nullptr;
|
QFrame * m_hiddenWlanWidget = nullptr;
|
||||||
|
|
|
@ -83,7 +83,7 @@ int main(int argc, char *argv[])
|
||||||
// QApplication a(argc, argv);
|
// QApplication a(argc, argv);
|
||||||
QString id = QString("kylin-nm"+ QLatin1String(getenv("DISPLAY")));
|
QString id = QString("kylin-nm"+ QLatin1String(getenv("DISPLAY")));
|
||||||
QtSingleApplication a(id, argc, argv);
|
QtSingleApplication a(id, argc, argv);
|
||||||
// qInstallMessageHandler(messageOutput);
|
qInstallMessageHandler(messageOutput);
|
||||||
if (a.isRunning()) {
|
if (a.isRunning()) {
|
||||||
auto connection = QDBusConnection::sessionBus();
|
auto connection = QDBusConnection::sessionBus();
|
||||||
QDBusInterface iface("com.kylin.network",
|
QDBusInterface iface("com.kylin.network",
|
||||||
|
|
Loading…
Reference in New Issue