-
Notifications
You must be signed in to change notification settings - Fork 37
fix: handle left edge click to toggle launcher visibility #706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds a Panel left-edge click handler in the launcher QML item so the launcher toggles its visibility only when it is the leftmost (minimum dock order) launcher. Sequence diagram for left edge click toggling launcher visibilitysequenceDiagram
actor User
participant LeftEdge as LeftScreenEdge
participant Panel
participant LauncherItem
participant LauncherController
User->>LeftEdge: click
LeftEdge->>Panel: notifyLeftEdgeClick()
Panel-->>LauncherItem: leftEdgeClicked(minOrder)
alt launcher is leftmost
LauncherItem->>LauncherItem: check dockOrder == minOrder
LauncherItem->>LauncherController: toggle visible
else launcher is not leftmost
LauncherItem->>LauncherItem: check dockOrder != minOrder
LauncherItem-->>LauncherController: no action
end
Class diagram for launcher edge click handlingclassDiagram
class Panel {
+leftEdgeClicked(minOrder)
}
class LauncherItem {
+int dockOrder
+onLeftEdgeClicked(minOrder)
}
class LauncherController {
+bool visible
}
LauncherItem ..> Panel : listens to leftEdgeClicked
LauncherItem ..> LauncherController : toggles visible
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - I've left some high level feedback:
- Consider guarding the
Connectionstarget with a null/availability check (e.g.target: Panel || null) so the component doesn’t try to bind to an undefinedPanelobject in edge cases where the panel isn’t yet initialized. - Instead of directly toggling
LauncherController.visible, it may be clearer and safer to route this through an existing controller/API method (e.g. atoggleVisibility()handler) if available, to keep visibility state changes centralized.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider guarding the `Connections` target with a null/availability check (e.g. `target: Panel || null`) so the component doesn’t try to bind to an undefined `Panel` object in edge cases where the panel isn’t yet initialized.
- Instead of directly toggling `LauncherController.visible`, it may be clearer and safer to route this through an existing controller/API method (e.g. a `toggleVisibility()` handler) if available, to keep visibility state changes centralized.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| target: Panel | ||
| function onLeftEdgeClicked(minOrder) { | ||
| if (launcher.dockOrder == minOrder) { | ||
| LauncherController.visible = !LauncherController.visible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个响应,封装为一个函数,调用跟Mouse一样的,
1. Added Connections component to listen for Panel's leftEdgeClicked signal 2. When left edge is clicked and this launcher has the minimum dock order, toggle launcher visibility 3. This ensures launcher responds to edge clicks when it's positioned at the leftmost dock position Log: Launcher now toggles visibility when clicking the left screen edge Influence: 1. Test clicking left screen edge when launcher is at leftmost position - should toggle launcher 2. Test clicking left screen edge when launcher is not at leftmost position - should not affect launcher 3. Verify launcher visibility toggles correctly between shown and hidden states 4. Test with multiple launchers/docks to ensure only the leftmost one responds 5. Verify launcher behavior consistency with other edge interactions fix: 处理左侧边缘点击以切换启动器可见性 1. 添加 Connections 组件监听 Panel 的 leftEdgeClicked 信号 2. 当点击左侧边缘且此启动器具有最小停靠顺序时,切换启动器可见性 3. 确保启动器在位于最左侧停靠位置时能响应边缘点击 Log: 启动器现在会在点击屏幕左侧边缘时切换可见性 Influence: 1. 测试当启动器位于最左侧位置时点击屏幕左侧边缘 - 应切换启动器状态 2. 测试当启动器不位于最左侧位置时点击屏幕左侧边缘 - 不应影响启动器 3. 验证启动器可见性在显示和隐藏状态之间正确切换 4. 测试多个启动器/停靠栏,确保只有最左侧的启动器响应 5. 验证启动器行为与其他边缘交互的一致性 PMS: BUG-345931
44121e5 to
f3ab937
Compare
deepin pr auto review代码审查报告1. 语法逻辑审查改进点:
2. 代码质量审查改进点:
3. 代码性能审查改进点:
4. 代码安全审查改进点:
5. 改进后的代码示例AppletItem {
implicitWidth: useColumnLayout ? Panel.rootObject.dockSize : Panel.rootObject.dockItemMaxSize * 0.8
implicitHeight: useColumnLayout ? Panel.rootObject.dockItemMaxSize * 0.8 : Panel.rootObject.dockSize
// 属性定义
property point itemPos: Qt.point(0, 0)
// 函数定义
/*!
\brief Toggles the visibility of the launcher and closes the tooltip.
*/
function toggleLauncher() {
if (LauncherController) {
LauncherController.visible = !LauncherController.visible
}
if (toolTip) {
toolTip.close()
}
}
function updateItemPos() {
// ... 现有代码 ...
}
Connections {
target: Panel.rootObject
function onDockCenterPartPosChanged() {
// ... 现有代码 ...
}
}
Connections {
target: Panel
function onLeftEdgeClicked(minOrder) {
if (launcher && launcher.dockOrder === minOrder) {
toggleLauncher()
}
}
}
// ... 其他代码 ...
MouseArea {
anchors.fill: parent
onClicked: function (mouse) {
if (mouse.button === Qt.LeftButton) {
toggleLauncher()
}
}
}
}6. 总结
这些改进将使代码更加健壮、可读和易于维护。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, wjyrich 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 |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
Log: Launcher now toggles visibility when clicking the left screen edge
Influence:
fix: 处理左侧边缘点击以切换启动器可见性
Log: 启动器现在会在点击屏幕左侧边缘时切换可见性
Influence:
PMS: BUG-345931
Summary by Sourcery
Bug Fixes: