Fix screenForGeometry on a corner case
QRect only deals with integers, and I had a window set on the corner and without a size. When this screen was created, it was reported to be on the wrong screen, thus created there wrong. The reason for this is that ::center is not prepared for this use. QRect(QPoint(500,500), QSize()).center() is QRect(499, 499) Change-Id: I24e57182f84873306f180749e96368d6da1147a9 Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>bb10
parent
d0f57439d0
commit
d2792d2ed9
|
|
@ -484,7 +484,9 @@ QPlatformScreen *QPlatformWindow::screenForGeometry(const QRect &newGeometry) co
|
|||
{
|
||||
QPlatformScreen *currentScreen = screen();
|
||||
QPlatformScreen *fallback = currentScreen;
|
||||
QPoint center = newGeometry.center();
|
||||
//QRect::center can return a value outside the rectangle if it's empty
|
||||
const QPoint center = newGeometry.isEmpty() ? newGeometry.topLeft() : newGeometry.center();
|
||||
|
||||
if (!parent() && currentScreen && !currentScreen->geometry().contains(center)) {
|
||||
Q_FOREACH (QPlatformScreen* screen, currentScreen->virtualSiblings()) {
|
||||
if (screen->geometry().contains(center))
|
||||
|
|
|
|||
Loading…
Reference in New Issue