Mobile wallpaper 1Mobile wallpaper 2Mobile wallpaper 3Mobile wallpaper 4Mobile wallpaper 5Mobile wallpaper 6Mobile wallpaper 7Mobile wallpaper 8
76 字
1 分钟
PySide6如何检测窗口是否可以在屏幕完全显示
from PySide6.QtWidgets import QApplication
from PySide6.QtCore import QRect
# 通过Rect检测
rect = self.frameGeometry()
# 通过Point检测
rect = QRect(self.pos(), self.size())
# 获取screen对象
screen = QApplication.screenAt(rect.center())
if not screen:
screen = QApplication.primaryScreen()
available = screen.availableGeometry()
avaRect = available.contains(rect)
result = [
max(0, available.left() - rect.left()), # left
max(0, available.top() - rect.top()), # top
max(0, available.right() - rect.right()), # right
max(0, available.bottom() - rect.bottom()) # bottom
]
PySide6如何检测窗口是否可以在屏幕完全显示
https://www.mikuas.top/posts/checkwindowisfulldisplayonthescreen/
作者
Mikuas
发布于
2025-05-11
许可协议
CC BY-NC-SA 4.0

部分信息可能已经过时