gpt4 book ai didi

qt - 如何检查 QPointF 是否在 QRect 中?

转载 作者:行者123 更新时间:2023-12-04 11:03:09 25 4
gpt4 key购买 nike

我有一个 widgetmyWidget 的中心我用了 mousePressEvent()myWidget抓取鼠标按下事件。我要隐藏myWidget在鼠标按下时而不是在 widget 内部按下时.
我可以通过 event->windowPos() 计算出打印位置这给出了 QPointF还有 ui->widget->rect()这是一个 QRect .

我如何检查 QpointFQRect 里面?

最佳答案

用过的:

if (ui->widget->geometry().contains(event->pos())) return;

关于qt - 如何检查 QPointF 是否在 QRect 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36686548/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com