diff options
author | Shawn Rutledge <shawn.rutledge@digia.com> | 2012-10-04 15:47:02 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-10-16 08:41:48 +0200 |
commit | 3dad01ed58f9a01c78f2ce7fc596382426c4da0a (patch) | |
tree | 70fa957e40df1b0a203cf048113c8ece41b20443 /src/gui/kernel/qguiapplication.cpp | |
parent | 02549ed219163413c9d7b2d1f28df13d6bcbe6c0 (diff) |
QScreen's physicalSize can change. Ensure siblings are updated.
I have found the following scenarios when the physical size can
appear to change even though you can't actually stretch your monitor:
1) VNC allows setting the resolution. Physical size will then be a
fraction of the physical size of the monitor on which you display the
VNC window.
2) When you rotate your display, the width and height are reversed.
3) MacOS X simulates a change in physical size when you change the
mode to one whose aspect ratio does not match your monitor, and also
when you use simulated HiDPI mode on a non-HiDPI monitor. While this
info is basically wrong, since we are now querying the OS for it, we
might as well make sure it is propagated all the way through to the
QScreen object's properties.
Also, make sure that when geometry changes on one screen, all the
siblings are informed of the change in virtual geometry. Also
simplified the signals (don't need separate ones to inform of
changes which are fundamentally related to each other and always
change together).
Change-Id: I6a98a1c203e24e8fbeef6e90999671e56dc0c655
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src/gui/kernel/qguiapplication.cpp')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index f9b38d2e6d..a67917ca3b 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1946,13 +1946,12 @@ void QGuiApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate: Qt::ScreenOrientation primaryOrientation = s->primaryOrientation(); s->d_func()->updatePrimaryOrientation(); - emit s->sizeChanged(s->size()); emit s->geometryChanged(s->geometry()); - emit s->physicalDotsPerInchXChanged(s->physicalDotsPerInchX()); - emit s->physicalDotsPerInchYChanged(s->physicalDotsPerInchY()); + emit s->physicalSizeChanged(s->physicalSize()); emit s->physicalDotsPerInchChanged(s->physicalDotsPerInch()); - emit s->availableSizeChanged(s->availableSize()); - emit s->availableGeometryChanged(s->availableGeometry()); + emit s->logicalDotsPerInchChanged(s->logicalDotsPerInch()); + foreach (QScreen* sibling, s->virtualSiblings()) + emit sibling->virtualGeometryChanged(sibling->virtualGeometry()); if (s->primaryOrientation() != primaryOrientation) emit s->primaryOrientationChanged(s->primaryOrientation()); @@ -1974,8 +1973,8 @@ void QGuiApplicationPrivate::reportAvailableGeometryChange( QScreen *s = e->screen.data(); s->d_func()->availableGeometry = e->availableGeometry; - emit s->availableSizeChanged(s->availableSize()); - emit s->availableGeometryChanged(s->availableGeometry()); + foreach (QScreen* sibling, s->virtualSiblings()) + emit sibling->virtualGeometryChanged(sibling->virtualGeometry()); } void QGuiApplicationPrivate::reportLogicalDotsPerInchChange(QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e) @@ -1990,8 +1989,6 @@ void QGuiApplicationPrivate::reportLogicalDotsPerInchChange(QWindowSystemInterfa QScreen *s = e->screen.data(); s->d_func()->logicalDpi = QDpi(e->dpiX, e->dpiY); - emit s->logicalDotsPerInchXChanged(s->logicalDotsPerInchX()); - emit s->logicalDotsPerInchYChanged(s->logicalDotsPerInchY()); emit s->logicalDotsPerInchChanged(s->logicalDotsPerInch()); } |