summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qhighdpiscaling_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Add QPointF/QRectF scale functionswip/highdpiPaul Olav Tvete2015-07-011-7/+31
| | | | | Change-Id: I91c5afc061e91c6088398d039c1c1fd3d79254ca Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* Clean up comments and dead codePaul Olav Tvete2015-07-011-30/+2
| | | | | Change-Id: Iadaca71328404bd6c526af5095b32e5e35548182 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* Scale logicalDpi when turning on screen scalingPaul Olav Tvete2015-06-181-0/+3
| | | | | | | | | | | | | Assume that the logical DPI for the primary screen is sane, and keep font sizes constant as screens are scaled. The global scale factor will act as a zoom level, and will cause all fonts to be bigger. Note that since we do not change logicalDpi after application startup, the manual test sliders will not match what happens with auto scaling. We may want to fix that... Change-Id: I5a3daa57c2dacf0158836492d31573723e49399a Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* Only turn off font hinting when really scalingPaul Olav Tvete2015-06-181-2/+5
| | | | | | | | | | | | | | | | | | | We don't want to turn off font hinting based on whether auto-scaling is on, otherwise Qt Creator will look bad on a low-DPI screen. Instead, we turn it off only if we have at least one screen that is scaled. QHighDpiScaling::isActive() now means that there is actual scaling going on. There is currently no need for the old meaning, so this change does not include QHighDpiScaling::isEnabled(). Note that nothing can save us from the case where there is one high-DPI and one low-DPI screen. In that case we choose looking bad on the low-DPI screen instead of looking like crap on the high-DPI screen. Also note that our font system we doesn't allow us to change our minds on hinting later when screens are plugged in or removed. Change-Id: I14a4ec7a49f4ba74a4c74684c7b951d0a71b951d Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* Update doc.Morten Johan Sørvig2015-06-161-23/+0
| | | | | | | | | | Move to the class documentation in the cpp file, focus on documenting the class and not necessarily high-dpi scaling in general. Change-Id: I4f04398904325b2f9061db8d3a82cd362276e977 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
* Move min/max size constrain logic to QPlatformWindow.Morten Johan Sørvig2015-06-041-3/+0
| | | | | | | | | | | | This increases the uniformity of the to/fromNativePixels functions by removing a special case, and avoids pulling the qwindow_p.h details into qhihgdpiscaling.cpp. Keep the logic of constraining the device-independent size. Change-Id: Id0dae30a7c0170ff2e5d21b94d56719cc900c726 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* Fix drag and drop for XcbPaul Olav Tvete2015-06-031-0/+12
| | | | | | | | | | | | | | | | | Make the xcb plugin work in native coordinates, using platform windows as much as possible. As part of this, replace QMouseEvent in QBasicDrag with just a QPoint. This is private API, so we can change this without warning. In addition to xcb, QBasicDrag is used in QSimpleDrag and for Wayland. QSimpleDrag does not yet have a fix for highDpi, but it should continue working in the non-scaled case. Wayland (and any other module which uses QBasicDrag) will need a compile fix. Also fix bug in QWindowSystemInterface: handleDrag()/handleDrop() take positions in window local coordinates, not global. Change-Id: I86543e4f52a7b3ba1efeac815cf89bbd97c0a0a2 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* usePixelDensity and perScreenActive are different conceptsPaul Olav Tvete2015-06-011-0/+1
| | | | | | | | | | Previously, setting a scale factor on a screen would also turn on pixel density scaling. Scaling everything twice is not twice as good... Change-Id: I617b76a717c8f83089d534604b3596754c42dad4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
* Refactor QHighDpiScaling internals and usageMorten Johan Sørvig2015-05-291-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Overall goal is to simplify, separate concerns, and improve cross-platform-ness and testability. QT_SCALE_FACTOR is now a pure cross-platform global scale factor setter has no "auto". "auto" requires input from the platform plugin via QPlatformScreen:: pixelDensity() and gets a separate environment variable: QT_AUTO_SCREEN_SCALE_FACTOR The effective scale factor (aka devicePixelRatio) is now computed as the product of the global, screen, and window scale factors. This matches how devicePixelRatio is computed in general (the window system devicePixelRatio is also a factor), and makes QT_SCALE_FACTOR work consistently regardless if there is a window scale factor set or not. This also means we can remove the if/else casing from the nativePixels conversion functions. Add QHighDpiScaling initializer which reads the environment variables and sets the "active" variables. Call it during QGuiApplication construction, before the platform plugin is created Add per-screen scale factor setting capability to the manual test. This makes it possible to test this logic on all platforms. The command line argument is --screen-scale-factor. Change-Id: I054337cbae37a01cdd731d26d9cb628fcecdb652 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
* Crash fix for autotestsPaul Olav Tvete2015-05-051-8/+8
| | | | | Apparently, autotests call the windowsysteminterface functions with null pointers...
* Multi-screen fixesPaul Olav Tvete2015-05-041-38/+240
| | | | | | | | | | | Various fixes, including: * Resize backingstore properly if screen has changed * Trigger resize event on screen change if necessary * Fix yet another race condition in screen detection * Trying to fix screen mapping Not completely finished, but I think it's better to keep in sync, and not diverge too much.
* Compile on AndroidMorten Johan Sørvig2015-04-151-0/+1
|
* DevicePixels -> NativePixelsPaul Olav Tvete2015-04-151-31/+31
|
* Per-screen scaleFactorPaul Olav Tvete2015-04-141-1/+3
| | | | | | | To enable, set QT_SCALE_FACTOR=auto Tons of bugs, since this does not port all the QT_DEVICE_PIXEL_RATIO fixes from xcb.
* Move qHighDpi functions into the QHighDpi namespacePaul Olav Tvete2015-04-141-31/+35
| | | | ...and use fromDevicePixels instead of toDeviceIndependentPixels
* WIP: Add logging via category "qt.scaling"Morten Johan Sørvig2015-03-261-0/+3
| | | | Change-Id: Ia94ba9a8961f1a31635135545ded0078a93de380
* WIP: Read QT_SCALE_FACTOR env. variableMorten Johan Sørvig2015-03-261-1/+1
| | | | | | Drop the "HIGHDPI" term Change-Id: I55cb4de34f302dee7897d70ce6693fea9d66926f
* WIP: Introduce per-window scale factorsMorten Johan Sørvig2015-03-261-49/+58
| | | | | | | | The qHighDpi functions now take an optional Window * The scale factor can be set with QHighDpiScaling:: setWindowFactor(QWindow *, factor) Change-Id: I34c80d2e031c257504d789ac5135de731d29929a
* WIP: Add platform independent high-dpi support to QtGuiMorten Johan Sørvig2015-03-261-0/+251
Add coordinate scaling support to the QWindow/ QWindowSystemInterface layer. The scale factor can be set with the QT_HIGHDPI_SCALE_FACTOR environment variable. Setting a scale factor different than the default (1) now has the following effects: QWindow::devicePixelRatio is set accordingly, enabling the high-dpi code paths. QWindow and related classes now return geometry in device independent pixels. This includes screen, desktop and window geometry as well as event coordinates. The platform plugins continue to operate in device pixels, unaware of the scaling. Task-number: QTBUG-38858 Change-Id: I85b0d1bc682b25196f6db286e672a64f8da0ae5c