fix(ui): set icon opacity for photo mode buttons in takePhotoSettingA…#474
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRestores correct icon opacity for photo mode control buttons when entering photo mode by explicitly resetting icon opacity on key UI buttons alongside existing overall opacity changes. Flow diagram for photo mode button opacity updatesflowchart LR
A[enterPhotoMode setState true] --> B[setOpacity 102 on m_flashlightUnfoldBtn]
A --> C[setOpacity 102 on m_filtersUnfoldBtn]
A --> D[setOpacity 102 on m_exposureBtn]
A --> E[setIconOpacity 1 on m_flashlightUnfoldBtn]
A --> F[setIconOpacity 1 on m_delayUnfoldBtn]
A --> G[setIconOpacity 1 on m_filtersUnfoldBtn]
A --> H[setIconOpacity 1 on m_exposureBtn]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider replacing the hard-coded opacity values (e.g.,
102and1) with named constants or an enum to make the intended visual states clearer and easier to maintain. - It may be worth centralizing the logic that restores button opacity/iconOpacity for photo mode into a small helper to avoid future inconsistencies if more buttons or states are added.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider replacing the hard-coded opacity values (e.g., `102` and `1`) with named constants or an enum to make the intended visual states clearer and easier to maintain.
- It may be worth centralizing the logic that restores button opacity/iconOpacity for photo mode into a small helper to avoid future inconsistencies if more buttons or states are added.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
…reaWidget Add setIconOpacity(1) calls for flashlight, delay, filters, and exposure buttons when entering photo mode to restore correct visual state 修复(ui): 拍照模式下恢复按钮图标透明度状态 进入拍照模式时对闪光灯、延迟拍摄、滤镜、曝光按钮调用 setIconOpacity(1), 恢复按钮图标正常透明度显示 Log: 修复拍照模式按钮图标透明度异常 Bug: https://pms.uniontech.com/bug-view-196565.html
deepin pr auto review你好!我是你的智能编程助手 CodeGeeX。我已仔细审查了你提供的 Git Diff 输入。本次代码变更主要包含两处修改:一处是版权年份的更新,另一处是在 以下是我对本次代码变更的详细审查意见: 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
综合改进建议代码示例基于以上分析,我为你提供一份重构后的代码示例,以提升代码的健壮性和可维护性: // 在头文件中(如 takephotosettingareawidget.h)添加成员变量:
// QList<QWidget*> m_photoModeButtons; // 或者使用对应的按钮类型,如 QList<CustomButton*> m_photoModeButtons;
// 在构造函数中进行初始化(确保按钮 new 之后):
// m_photoModeButtons = {m_flashlightUnfoldBtn, m_delayUnfoldBtn, m_filtersUnfoldBtn, m_exposureBtn};
// 修改后的 setState 函数:
void takePhotoSettingAreaWidget::setState(bool bPhoto)
{
// ... 前置代码 ...
if (bPhoto) {
// 使用范围 for 循环统一设置,减少代码重复
for (auto* btn : m_photoModeButtons) {
if (btn) { // 安全性检查
btn->setVisible(true); // 确保可见(如果原逻辑需要)
}
}
// 单独处理特殊透明度的设置(如果 setOpacity 和 setIconOpacity 是所有按钮共有的,也可以放入循环)
m_flashlightUnfoldBtn->setOpacity(102);
m_filtersUnfoldBtn->setOpacity(102);
m_exposureBtn->setOpacity(102);
for (auto* btn : m_photoModeButtons) {
if (btn) {
btn->setIconOpacity(1);
}
}
} else {
// 统一隐藏,修复原先可能遗漏 m_delayUnfoldBtn 的问题
for (auto* btn : m_photoModeButtons) {
if (btn) {
btn->setVisible(false);
}
}
}
// ... 后置代码 ...
}总结:本次变更最核心的问题是逻辑一致性缺失( |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, Resurgamz The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/merge |
…reaWidget
Add setIconOpacity(1) calls for flashlight, delay, filters, and exposure buttons when entering photo mode to restore correct visual state
修复(ui): 拍照模式下恢复按钮图标透明度状态
进入拍照模式时对闪光灯、延迟拍摄、滤镜、曝光按钮调用 setIconOpacity(1), 恢复按钮图标正常透明度显示
Log: 修复拍照模式按钮图标透明度异常
Bug: https://pms.uniontech.com/bug-view-196565.html
Summary by Sourcery
Bug Fixes: