From 7f341e642ebd52b74ec7064bb02d882f0eb7f0c4 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Sat, 18 Dec 2021 11:48:15 +0100 Subject: [PATCH] Remove QScreen to get valid data from windows --- ScreenPlay/src/monitorlistmodel.cpp | 4 ++-- ScreenPlay/src/monitorlistmodel.h | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/ScreenPlay/src/monitorlistmodel.cpp b/ScreenPlay/src/monitorlistmodel.cpp index 7caa2178..bc102582 100644 --- a/ScreenPlay/src/monitorlistmodel.cpp +++ b/ScreenPlay/src/monitorlistmodel.cpp @@ -82,7 +82,7 @@ QVariant MonitorListModel::data(const QModelIndex& index, int role) const case MonitorRole::Index: return m_monitorList.at(row).m_index; case MonitorRole::Geometry: - return m_monitorList.at(row).m_screen->geometry(); + return m_monitorList.at(row).m_geometry; case MonitorRole::InstalledType: if (m_monitorList.at(row).m_activeWallpaper) { return static_cast(m_monitorList.at(row).m_activeWallpaper->type()); @@ -138,7 +138,7 @@ void MonitorListModel::loadMonitors() width, height); beginInsertRows(index, m_monitorList.size(), m_monitorList.size()); - m_monitorList.append(Monitor { i, geometry, QApplication::screens().at(i) }); + m_monitorList.append(Monitor { i, geometry }); endInsertRows(); } #else diff --git a/ScreenPlay/src/monitorlistmodel.h b/ScreenPlay/src/monitorlistmodel.h index 74cf4c67..24adcd06 100644 --- a/ScreenPlay/src/monitorlistmodel.h +++ b/ScreenPlay/src/monitorlistmodel.h @@ -59,17 +59,14 @@ struct Monitor { Monitor( const int index, - const QRect& geometry, - QScreen* screen) + const QRect& geometry) { m_index = index; m_geometry = geometry; - m_screen = screen; } int m_index { 0 }; QRect m_geometry; - QScreen* m_screen { nullptr }; std::shared_ptr m_activeWallpaper { nullptr }; };