From c6580ce69650000fda71ddea582798cce080e675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Mon, 23 Sep 2013 23:04:17 +0200 Subject: [PATCH] add int Screens::intersecting(QRect) REVIEW: 112910 --- screens.cpp | 11 +++++++++++ screens.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/screens.cpp b/screens.cpp index 23caf59352..c351c7e12e 100644 --- a/screens.cpp +++ b/screens.cpp @@ -117,6 +117,17 @@ int Screens::current() const return m_current; } +int Screens::intersecting(const QRect &r) const +{ + int cnt = 0; + for (int i = 0; i < count(); ++i) { + if (geometry(i).intersects(r)) { + ++cnt; + } + } + return cnt; +} + DesktopWidgetScreens::DesktopWidgetScreens(QObject *parent) : Screens(parent) , m_desktop(QApplication::desktop()) diff --git a/screens.h b/screens.h index f05f818519..0ba11d1aa9 100644 --- a/screens.h +++ b/screens.h @@ -68,6 +68,8 @@ public: inline bool isChanging() { return m_changedTimer->isActive(); } + int intersecting(const QRect &r) const; + public Q_SLOTS: void reconfigure();