fix:电池按钮不显示问题

This commit is contained in:
winnerym 2022-10-24 15:51:16 +08:00
parent 7045d7016d
commit d2cff1fc8e
1 changed files with 7 additions and 8 deletions

View File

@ -173,16 +173,16 @@ bool LockWidget::eventFilter(QObject *obj, QEvent *event)
}
}
if(event->type() == QEvent::WindowActivate){
if(event->type() == QEvent::WindowActivate || event->type() == 8){ // QEvent::FocusIn
if(!isNetFinished){
isNetFinished = true;
isNetFinished = true;
QTimer::singleShot(2000, this, [=](){
m_kylinNM = new KylinNM(this);
m_kylinNM = new KylinNM(this);
m_kylinNM->installEventFilter(this);
connect(m_kylinNM, &KylinNM::onConnectChanged, this,[=](){
connect(m_kylinNM, &KylinNM::onConnectChanged, this,[=](){
updateNetIcon(m_kylinNM->getConnectStatus());
});
m_kylinNM->hide();
m_kylinNM->hide();
QtConcurrent::run([=](){
updateNetIcon(getNetStatus());
});
@ -671,9 +671,9 @@ void LockWidget::initUI()
QDBusInterface *powerInterface = new QDBusInterface(
"org.ukui.upower", "/upower", "org.ukui.upower", QDBusConnection::sessionBus(), this);
if (batInterface->isValid()) {
QDBusReply<QString> reply = powerInterface->call("MachineType");
QDBusReply<int> reply = powerInterface->call("MachineType");
if (reply.isValid()) {
if ("book" == reply.value()) {
if (1 == reply.value()) {
QDBusReply<QString> iconreply = batInterface->call("IconName");
setBatteryIcon(iconreply.value());
QDBusConnection::sessionBus().connect(
@ -1004,7 +1004,6 @@ void LockWidget::showNetManager(bool keynavigation)
if(!m_kylinNM){
return;
}
if(m_kylinNM->isVisible())
{
setCheckedSheet(NETWORKBTN, false);