From db2cf45f484c43837be2d464e2d28204776ed922 Mon Sep 17 00:00:00 2001 From: gongheng Date: Fri, 3 Jul 2026 14:18:34 +0800 Subject: [PATCH] fix(partition): add tolerance to add button enable condition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add floating-point tolerance when comparing input value with remaining space to prevent disabling the add button due to precision error. 比较输入值与剩余空间时增加浮点容差,避免因精度误差错误禁用添加按钮。 Log: 修复添加按钮在边界值被错误禁用 PMS: BUG-364667 Influence: 修复后用户输入等于剩余空间时添加按钮可正常启用,提升分区创建交互体验。 --- application/widgets/customcontrol/partitionwidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/widgets/customcontrol/partitionwidget.cpp b/application/widgets/customcontrol/partitionwidget.cpp index 8e5eee04..4f24de9f 100644 --- a/application/widgets/customcontrol/partitionwidget.cpp +++ b/application/widgets/customcontrol/partitionwidget.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only @@ -778,7 +778,7 @@ void PartitionWidget::onSetSliderValue() m_block = 1; m_slider->setValue(static_cast((value / (m_total - (sumValue() / 1024))) * 100)); m_currentEditSize = QString::number(value * 1024, 'f', 4); - if (value == 0.00 || value > (m_total - sumValue() / 1024)) { + if (value == 0.00 || value > (m_total - sumValue() / 1024) + 0.01) { m_addButton->setEnabled(false); } else { m_addButton->setEnabled(true);