1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-18 08:22:33 +02:00

Remove QScreen to get valid data from windows

This commit is contained in:
Elias Steurer 2021-12-18 11:48:15 +01:00
parent 7263204616
commit 7f341e642e
2 changed files with 3 additions and 6 deletions

View File

@ -82,7 +82,7 @@ QVariant MonitorListModel::data(const QModelIndex& index, int role) const
case MonitorRole::Index: case MonitorRole::Index:
return m_monitorList.at(row).m_index; return m_monitorList.at(row).m_index;
case MonitorRole::Geometry: case MonitorRole::Geometry:
return m_monitorList.at(row).m_screen->geometry(); return m_monitorList.at(row).m_geometry;
case MonitorRole::InstalledType: case MonitorRole::InstalledType:
if (m_monitorList.at(row).m_activeWallpaper) { if (m_monitorList.at(row).m_activeWallpaper) {
return static_cast<int>(m_monitorList.at(row).m_activeWallpaper->type()); return static_cast<int>(m_monitorList.at(row).m_activeWallpaper->type());
@ -138,7 +138,7 @@ void MonitorListModel::loadMonitors()
width, width,
height); height);
beginInsertRows(index, m_monitorList.size(), m_monitorList.size()); 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(); endInsertRows();
} }
#else #else

View File

@ -59,17 +59,14 @@ struct Monitor {
Monitor( Monitor(
const int index, const int index,
const QRect& geometry, const QRect& geometry)
QScreen* screen)
{ {
m_index = index; m_index = index;
m_geometry = geometry; m_geometry = geometry;
m_screen = screen;
} }
int m_index { 0 }; int m_index { 0 };
QRect m_geometry; QRect m_geometry;
QScreen* m_screen { nullptr };
std::shared_ptr<ScreenPlayWallpaper> m_activeWallpaper { nullptr }; std::shared_ptr<ScreenPlayWallpaper> m_activeWallpaper { nullptr };
}; };