48 lines
1.5 KiB
Diff
48 lines
1.5 KiB
Diff
From 2b6125c1a32d3de702a60a10e2baceee481f28c0 Mon Sep 17 00:00:00 2001
|
|
From: liuxinhao <liuxinhao@kylinsec.com.cn>
|
|
Date: Tue, 9 Jan 2024 16:59:21 +0800
|
|
Subject: [PATCH 10/17] fix(account): Fix the issue of setting default
|
|
selection sidebar errors
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
- 修复设置默认选择侧边栏错误的问题
|
|
|
|
Closes #24761
|
|
---
|
|
plugins/account/account-widget.cpp | 14 ++++++--------
|
|
1 file changed, 6 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/plugins/account/account-widget.cpp b/plugins/account/account-widget.cpp
|
|
index 957b154..59b6cad 100644
|
|
--- a/plugins/account/account-widget.cpp
|
|
+++ b/plugins/account/account-widget.cpp
|
|
@@ -106,17 +106,15 @@ void AccountWidget::appendUser(const QString &userPath)
|
|
|
|
void AccountWidget::setDefaultSelectedUser()
|
|
{
|
|
- if (m_tabList->count() <= 1)
|
|
+ auto items = m_tabList->findItems(AccountsGlobalInfo::instance()->getCurrentUser(), Qt::MatchCaseSensitive);
|
|
+ if (items.size() >= 1)
|
|
{
|
|
- m_tabList->setCurrentRow(0);
|
|
- return;
|
|
+ auto userItem = items.at(0);
|
|
+ m_tabList->setCurrentRow(m_tabList->row(userItem));
|
|
}
|
|
-
|
|
- auto items = m_tabList->findItems(AccountsGlobalInfo::instance()->getCurrentUser(), Qt::MatchCaseSensitive);
|
|
- if (items.size() > 0)
|
|
+ else
|
|
{
|
|
- auto item = items.at(0);
|
|
- m_tabList->setCurrentRow(m_tabList->row(item));
|
|
+ m_tabList->setCurrentRow(0);
|
|
}
|
|
}
|
|
|
|
--
|
|
2.33.0
|
|
|