Skip to content

Commit 5788897

Browse files
yixinsharkdeepin-bot[bot]
authored andcommitted
fix: bluetooth applet widget layout display abnormality
After the other devices are expanded, click on other places to make the window lose focus and disappear, and click on the plug-in window again, and the layout will show abnormalities Log: as title Pms: BUG-298193
1 parent 18b72c6 commit 5788897

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

plugins/dde-dock/bluetooth/componments/bluetoothadapteritem.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,13 @@ void BluetoothAdapterItem::setUnnamedDevicesVisible(bool isShow)
525525

526526
void BluetoothAdapterItem::showEvent(QShowEvent *event)
527527
{
528+
// 设置默认展开状态:只有在没有已配对设备时才展开其他设备列表
529+
if (m_adapterSwitchEnabled) {
530+
bool shouldExpand = m_myDeviceModel->rowCount() < 1;
531+
m_otherDeviceControlWidget->setExpandState(shouldExpand);
532+
m_otherDeviceListView->setVisible(shouldExpand);
533+
}
534+
528535
emit deviceCountChanged();
529536
if (m_adapter->discover()) {
530537
return;
@@ -538,9 +545,9 @@ void BluetoothAdapterItem::showEvent(QShowEvent *event)
538545

539546
void BluetoothAdapterItem::hideEvent(QHideEvent *event)
540547
{
548+
// 面板隐藏时,重置为自动折叠模式,下次显示时使用默认行为
541549
m_autoFold = true;
542-
if (m_adapterSwitchEnabled && m_myDeviceModel->rowCount() > 0)
543-
m_otherDeviceControlWidget->setExpandState(false);
550+
544551
QWidget::hideEvent(event);
545552
}
546553

0 commit comments

Comments
 (0)