Qt:检测矩形悬停

发布于 2025-01-05 22:44:07 字数 107 浏览 4 评论 0原文

Qt 中是否有任何类可以将 (x,y) 坐标传递给并询问“哪个已知矩形悬停”?在初始化过程中将矩形添加到该对象。

矩形可以由任何可以容纳 (x1, y1, x2, y2) 的类来表示。

Is there any class in Qt that i can pass (x,y) coordinates to and ask "what known rectangle is hovered"? Rectangles are added to that object at initialization procedure.

Rectangle may be represented by any class that can hold (x1, y1, x2, y2).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

や莫失莫忘 2025-01-12 22:44:07

CMANNET85 右

if QRect(l, t, b, r).contains(QPoint(x, y)):
    print("Point is inside Rectangle")

cmannett85 right

if QRect(l, t, b, r).contains(QPoint(x, y)):
    print("Point is inside Rectangle")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文