summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qhighdpiscaling.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Clean up comments and dead codePaul Olav Tvete2015-07-011-20/+2
| | | | | Change-Id: Iadaca71328404bd6c526af5095b32e5e35548182 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* Add application attribute to disable highDPI scalingPaul Olav Tvete2015-06-301-0/+8
| | | | | | | | | | Main use case is for KDE Plasma, which needs to know about real window system coordinates. Can also be used by applications that do all the scaling manually, and that do not want to have Qt scale the coordinate systems and painters. Change-Id: Ic595131c5e2fb4c0af95e9b5bd3e40beee86760b Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* Add environment variable to set per-screen scalingPaul Olav Tvete2015-06-301-0/+38
| | | | | Change-Id: I0fce05998ba6092c4dd1d64790c56c0668383477 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* Scale logicalDpi when turning on screen scalingPaul Olav Tvete2015-06-181-0/+11
| | | | | | | | | | | | | 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-13/+34
| | | | | | | | | | | | | | | | | | | 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>
* dirty hack to make setScreenFactor workPaul Olav Tvete2015-06-171-0/+4
| | | | | | | | | This is a seriously dirty hack, but without this, screen geometries will be wrong when scale factors are changed after application startup. Change-Id: Ia39164303ef648ec3752d7f4b9db06477a2d3fb4 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* Update doc.Morten Johan Sørvig2015-06-161-2/+36
| | | | | | | | | | 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-12/+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>
* Print "deprecated" warning on QT_DEVICE_PIXEL_RATIO usage.Morten Johan Sørvig2015-06-031-9/+18
| | | | | | | | Also clean up the env. variable definitions. Change-Id: If51ab515d7d7d6be9b984417ce7262a83ea48a66 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
* Support QT_DEVICE_PIXEL_RATIOPaul Olav Tvete2015-06-021-1/+7
| | | | | | | For compatibility with Qt 5.5 (and 5.4) Change-Id: I30fe0e493849f116983299f36061d443a522eec3 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* usePixelDensity and perScreenActive are different conceptsPaul Olav Tvete2015-06-011-5/+8
| | | | | | | | | | 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-24/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Multi-screen fixesPaul Olav Tvete2015-05-041-1/+56
| | | | | | | | | | | 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.
* DevicePixels -> NativePixelsPaul Olav Tvete2015-04-151-3/+3
|
* Per-screen scaleFactorPaul Olav Tvete2015-04-141-2/+14
| | | | | | | 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-3/+3
| | | | ...and use fromDevicePixels instead of toDeviceIndependentPixels
* Per window scale factor settingMorten Johan Sørvig2015-04-141-1/+2
| | | | | ./highdpi --window-scale-factor --mainwindow Also fix a couple of scaling logic bugs.
* WIP: Add logging via category "qt.scaling"Morten Johan Sørvig2015-03-261-1/+5
| | | | 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-3/+21
| | | | | | | | 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/+102
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