diff --git a/lib/utils/ui-helpers.cpp b/lib/utils/ui-helpers.cpp index 3a91c3cc..f7f5bb02 100644 --- a/lib/utils/ui-helpers.cpp +++ b/lib/utils/ui-helpers.cpp @@ -160,4 +160,12 @@ void QeueUITask(void (*task)(void *param), void *param) obs_queue_task(OBS_TASK_UI, task, param, false); } +bool IsCursorInWidgetArea(QWidget *widget) +{ + const auto cursorPos = QCursor::pos(); + const auto widgetPos = widget->mapFromGlobal(cursorPos); + const auto widgetRect = widget->rect(); + return widgetRect.contains(widgetPos); +} + } // namespace advss diff --git a/lib/utils/ui-helpers.hpp b/lib/utils/ui-helpers.hpp index 89742946..62bcf503 100644 --- a/lib/utils/ui-helpers.hpp +++ b/lib/utils/ui-helpers.hpp @@ -33,4 +33,6 @@ EXPORT std::string GetThemeTypeName(); void QeueUITask(void (*task)(void *param), void *param); +bool IsCursorInWidgetArea(QWidget *widget); + } // namespace advss