Skip to content

Commit 26d8a87

Browse files
wjyrichdeepin-bot[bot]
authored andcommitted
fix: adjust height calculation order in BluetoothApplet
1. Reordered the height calculation logic to prioritize maximum height check before minimum height check 2. This prevents potential layout issues when content height exceeds maximum allowed height 3. Maintains the same functionality but with more logical calculation flow 4. The change ensures consistent behavior when dealing with edge cases fix: 调整蓝牙小程序高度计算顺序 1. 重新排序高度计算逻辑,优先检查最大高度限制再检查最小高度限制 2. 防止当内容高度超过允许最大值时可能出现的布局问题 3. 保持相同功能但采用更合理的计算流程 4. 此变更确保处理边界情况时行为一致 Pms: BUG-320239
1 parent 3ced55a commit 26d8a87

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,16 +340,16 @@ void BluetoothApplet::updateSize()
340340
static const int settingHeight = DeviceItemHeight + 10 + 10;
341341
height += settingHeight;
342342

343-
// 如果比快捷面板允许的最小高度还小,则以快捷面板允许的最小高度为准
344-
const int hMargins = m_mainLayout->contentsMargins().top() + m_mainLayout->contentsMargins().bottom();
345-
height = qMax(m_minHeight - hMargins, height);
346-
347343
// 最大的高度为显示8个设备的高度
348344
static const int maxHeight = (TitleHeight + TitleSpace) + (MaxDeviceCount * DeviceItemHeight) + ((MaxDeviceCount-1) * 10) + settingHeight;
349345

350346
// 如果比允许的最大高度还大,则以最大高度为准
351347
height = qMin(maxHeight, height);
352348

349+
// 如果比快捷面板允许的最小高度还小,则以快捷面板允许的最小高度为准
350+
const int hMargins = m_mainLayout->contentsMargins().top() + m_mainLayout->contentsMargins().bottom();
351+
height = qMax(m_minHeight - hMargins, height);
352+
353353
// 加上飞行模式提示控件高度
354354
m_airplaneModeWidget->isVisibleTo(this) ? m_airplaneModeWidget->setFixedHeight(height - settingHeight - adapterHeight) : m_airplaneModeWidget->setFixedHeight(0);
355355

0 commit comments

Comments
 (0)