修改托盘无线网络输入密码界面交互
This commit is contained in:
parent
d3a2589fc7
commit
89a40f3ae3
|
@ -199,7 +199,7 @@ void WlanListItem::onRightButtonClicked()
|
||||||
void WlanListItem::enterEvent(QEvent *event)
|
void WlanListItem::enterEvent(QEvent *event)
|
||||||
{
|
{
|
||||||
//qDebug()<< LOG_FLAG <<"enterEvent" << m_wirelessNetItem.m_NetSsid;
|
//qDebug()<< LOG_FLAG <<"enterEvent" << m_wirelessNetItem.m_NetSsid;
|
||||||
m_mouseIsOut = false;
|
// m_mouseIsOut = false;
|
||||||
if (m_pwdFrame != nullptr && !m_pwdFrame->isVisible()) {
|
if (m_pwdFrame != nullptr && !m_pwdFrame->isVisible()) {
|
||||||
if (Deactivated != m_connectState) {
|
if (Deactivated != m_connectState) {
|
||||||
m_hoverButton->setProperty("useButtonPalette", true);
|
m_hoverButton->setProperty("useButtonPalette", true);
|
||||||
|
@ -223,7 +223,7 @@ void WlanListItem::enterEvent(QEvent *event)
|
||||||
void WlanListItem::leaveEvent(QEvent *event)
|
void WlanListItem::leaveEvent(QEvent *event)
|
||||||
{
|
{
|
||||||
//qDebug()<< LOG_FLAG <<"leaveEvent"<< m_wirelessNetItem.m_NetSsid;
|
//qDebug()<< LOG_FLAG <<"leaveEvent"<< m_wirelessNetItem.m_NetSsid;
|
||||||
m_mouseIsOut = true;
|
// m_mouseIsOut = true;
|
||||||
m_hoverButton->hide();
|
m_hoverButton->hide();
|
||||||
if (m_connectState == Activated || m_connectState == Deactivating) {
|
if (m_connectState == Activated || m_connectState == Deactivating) {
|
||||||
m_nameLabel->setLabelMaximumWidth(NAMELABLE_MAX_WIDTH_ACTIVATED);
|
m_nameLabel->setLabelMaximumWidth(NAMELABLE_MAX_WIDTH_ACTIVATED);
|
||||||
|
@ -234,12 +234,12 @@ void WlanListItem::leaveEvent(QEvent *event)
|
||||||
} else {
|
} else {
|
||||||
m_nameLabel->setLabelMaximumWidth(NAMELABLE_MAX_WIDTH_DEACTIVATED);
|
m_nameLabel->setLabelMaximumWidth(NAMELABLE_MAX_WIDTH_DEACTIVATED);
|
||||||
}
|
}
|
||||||
if (m_pwdFrame && m_pwdFrame->isVisible()) {
|
// if (m_pwdFrame && m_pwdFrame->isVisible()) {
|
||||||
if (m_focusIsOut) {
|
// if (m_focusIsOut) {
|
||||||
setExpanded(false);
|
// setExpanded(false);
|
||||||
}
|
// }
|
||||||
return QFrame::leaveEvent(event);
|
// return QFrame::leaveEvent(event);
|
||||||
}
|
// }
|
||||||
|
|
||||||
return ListItem::leaveEvent(event);
|
return ListItem::leaveEvent(event);
|
||||||
}
|
}
|
||||||
|
@ -252,18 +252,18 @@ bool WlanListItem::eventFilter(QObject *watched, QEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (watched == m_pwdLineEdit) {
|
// if (watched == m_pwdLineEdit) {
|
||||||
if (event->type() == QEvent::FocusOut) {
|
// if (event->type() == QEvent::FocusOut) {
|
||||||
m_focusIsOut = true;
|
// m_focusIsOut = true;
|
||||||
//qDebug()<< LOG_FLAG <<"focusOutEvent" << m_wirelessNetItem.m_NetSsid;
|
// //qDebug()<< LOG_FLAG <<"focusOutEvent" << m_wirelessNetItem.m_NetSsid;
|
||||||
if (m_mouseIsOut) {
|
// if (m_mouseIsOut) {
|
||||||
setExpanded(false);
|
// setExpanded(false);
|
||||||
}
|
// }
|
||||||
} else if (event->type() == QEvent::FocusIn) {
|
// } else if (event->type() == QEvent::FocusIn) {
|
||||||
//qDebug()<< LOG_FLAG <<"focusInEvent" << m_wirelessNetItem.m_NetSsid;
|
// //qDebug()<< LOG_FLAG <<"focusInEvent" << m_wirelessNetItem.m_NetSsid;
|
||||||
m_focusIsOut = false;
|
// m_focusIsOut = false;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
return QFrame::eventFilter(watched, event);
|
return QFrame::eventFilter(watched, event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,8 +122,8 @@ private:
|
||||||
QCheckBox *m_autoConnectCheckBox = nullptr;
|
QCheckBox *m_autoConnectCheckBox = nullptr;
|
||||||
QLabel *m_autoConnectLabel = nullptr;
|
QLabel *m_autoConnectLabel = nullptr;
|
||||||
|
|
||||||
bool m_focusIsOut = true;
|
//bool m_focusIsOut = true;
|
||||||
bool m_mouseIsOut = true;
|
//bool m_mouseIsOut = true;
|
||||||
|
|
||||||
bool m_forgetConnection = false;
|
bool m_forgetConnection = false;
|
||||||
bool m_isApMode = false;
|
bool m_isApMode = false;
|
||||||
|
|
|
@ -154,11 +154,12 @@ void WlanPage::initWlanUI()
|
||||||
addWlanMoreItem();
|
addWlanMoreItem();
|
||||||
m_inactivatedAreaLayout->addWidget(m_inactivatedNetListWidget);
|
m_inactivatedAreaLayout->addWidget(m_inactivatedNetListWidget);
|
||||||
|
|
||||||
connect(m_inactivatedNetListWidget, &QListWidget::currentItemChanged, this, [=]() {
|
connect(m_inactivatedNetListWidget, &QListWidget::currentItemChanged,
|
||||||
if (m_inactivatedNetListWidget->currentItem() != nullptr) {
|
this, &WlanPage::onInactivateListWidgetItemChanged);
|
||||||
m_inactivatedNetListWidget->currentItem()->setSelected(false);
|
|
||||||
}
|
//点击【已连接】网络区域 去掉其他网络的选中效果
|
||||||
});
|
connect(m_activatedNetListWidget, &QListWidget::clicked, this, &WlanPage::setInactivateListItemNoSelect);
|
||||||
|
connect(m_activatedNetListWidget, &QListWidget::currentItemChanged, this, &WlanPage::setInactivateListItemNoSelect);
|
||||||
|
|
||||||
QPalette pal = m_activatedNetListWidget->palette();
|
QPalette pal = m_activatedNetListWidget->palette();
|
||||||
pal.setBrush(QPalette::Base, QColor(0,0,0,0)); //背景透明
|
pal.setBrush(QPalette::Base, QColor(0,0,0,0)); //背景透明
|
||||||
|
@ -890,6 +891,28 @@ void WlanPage::onDeviceManagedChanged(QString deviceName, bool managed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WlanPage::onInactivateListWidgetItemChanged(QListWidgetItem *current, QListWidgetItem *previous)
|
||||||
|
{
|
||||||
|
if (previous != nullptr) {
|
||||||
|
QSize normalSize(previous->sizeHint().width(), NORMAL_HEIGHT);
|
||||||
|
previous->setSizeHint(normalSize);
|
||||||
|
WlanListItem *p_wlanItem = (WlanListItem*)m_inactivatedNetListWidget->itemWidget(previous);
|
||||||
|
p_wlanItem->setExpanded(false);
|
||||||
|
}
|
||||||
|
if (current != nullptr) {
|
||||||
|
current->setSelected(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WlanPage::setInactivateListItemNoSelect()
|
||||||
|
{
|
||||||
|
if (m_inactivatedNetListWidget->currentItem() != nullptr) {
|
||||||
|
WlanListItem *p_wlanItem = (WlanListItem*)m_inactivatedNetListWidget->itemWidget(m_inactivatedNetListWidget->currentItem());
|
||||||
|
p_wlanItem->setExpanded(false);
|
||||||
|
m_inactivatedNetListWidget->currentItem()->setSelected(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WlanPage::sendApStateChangeSignal(QString uuid,
|
void WlanPage::sendApStateChangeSignal(QString uuid,
|
||||||
QString ssid,
|
QString ssid,
|
||||||
QString deviceName,
|
QString deviceName,
|
||||||
|
@ -1535,6 +1558,7 @@ void WlanPage::onWlanPageVisibleChanged(int index)
|
||||||
qDebug() << "wlanpage not visible";
|
qDebug() << "wlanpage not visible";
|
||||||
showNonePwd();
|
showNonePwd();
|
||||||
}
|
}
|
||||||
|
m_inactivatedNetListWidget->setCurrentIndex(QModelIndex()); // 去除item选中效果
|
||||||
}
|
}
|
||||||
|
|
||||||
void WlanPage::showNonePwd()
|
void WlanPage::showNonePwd()
|
||||||
|
|
|
@ -138,6 +138,9 @@ private Q_SLOTS:
|
||||||
void onWlanStateChanged(NetworkManager::Device::State newstate, NetworkManager::Device::State oldstate, NetworkManager::Device::StateChangeReason reason);
|
void onWlanStateChanged(NetworkManager::Device::State newstate, NetworkManager::Device::State oldstate, NetworkManager::Device::StateChangeReason reason);
|
||||||
void onDeviceManagedChanged(QString deviceName, bool managed);
|
void onDeviceManagedChanged(QString deviceName, bool managed);
|
||||||
|
|
||||||
|
void onInactivateListWidgetItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
||||||
|
void setInactivateListItemNoSelect();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *watched, QEvent *event);
|
bool eventFilter(QObject *watched, QEvent *event);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue