PyQt/简单的窗口贴边隐藏/README.md
2018-03-08 13:06:21 +08:00

14 lines
767 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 简单的窗口贴边隐藏
## 大概思路
- 1.思路是当窗口进入左边,顶部,右边一半时,此时判断窗口的坐标
- 2.如果窗口的x坐标小于0 则需要隐藏到左边
- 3.如果窗口的y坐标小于0 则需要隐藏到顶部
- 4.如果窗口的x坐标大于屏幕宽度-窗口宽度/2 则需要隐藏到右边
## 事件
- 1.mousePressEvent鼠标按下事件主要记录按下的坐标
- 1.mouseMoveEvent鼠标移动事件用于移动窗口
- 1.mouseReleaseEvent鼠标弹起事件用于判断是否需要隐藏窗口
- 1.enterEvent鼠标进入事件用于窗口隐藏后是否需要暂时显示预览
- 1.leaveEvent鼠标离开事件用于窗口暂时显示后自动隐藏效果