Only consider QScreen virtual siblings that have been added
If a platform builds up a list of QPlatformScreens, and then adds them incrementally, while at the same time implementing virtualSiblings in QPlatformScreen to return the full list of screens, the virtual sibling QScreens will contain nullptrs for each non-added screen. It could be argued that this is the fault of the platform plugin, since it's reporting a virtual sibling that it hasn't added yet, but we can easily work around it in QScreen as well. Fixes: QTBUG-113977 Pick-to: 6.5 Change-Id: I4b9472646a5cc10b6fd35c606e3ae15941da1587 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
672a1d022c
commit
ea1af6b7ed
@ -360,8 +360,11 @@ QList<QScreen *> QScreen::virtualSiblings() const
|
||||
const QList<QPlatformScreen *> platformScreens = d->platformScreen->virtualSiblings();
|
||||
QList<QScreen *> screens;
|
||||
screens.reserve(platformScreens.size());
|
||||
for (QPlatformScreen *platformScreen : platformScreens)
|
||||
screens << platformScreen->screen();
|
||||
for (QPlatformScreen *platformScreen : platformScreens) {
|
||||
// Only consider platform screens that have been added
|
||||
if (auto *knownScreen = platformScreen->screen())
|
||||
screens << knownScreen;
|
||||
}
|
||||
return screens;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user