summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qhighdpiscaling.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.10' into devLars Knoll2018-01-021-2/+16
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf sc/corelib/io/qfsfileengine_p.h src/corelib/io/qstorageinfo_unix.cpp src/platformsupport/eglconvenience/qeglpbuffer_p.h src/platformsupport/input/libinput/qlibinputkeyboard.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/ios/qiosscreen.h src/plugins/platforms/ios/qioswindow.h src/plugins/platforms/ios/quiview.mm src/printsupport/dialogs/qpagesetupdialog_unix_p.h src/printsupport/dialogs/qprintpreviewdialog.cpp src/printsupport/widgets/qcupsjobwidget_p.h src/widgets/widgets/qmenu.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: Iecb4883122efe97ef0ed850271e6c51bab568e9c
| * Adjust screen scale factor for certain screen configurationsVictor-Andrei Variu2017-11-171-2/+16
| | | | | | | | | | | | | | | | | | | | | | Pixel density reported by the screen is sometimes not precise enough, so recalculate it: divide px (physical pixels) by dp (device-independent pixels) for both width and height, and then use the average if it is different from the one initially reported by the screen Task-number: QTBUG-62191 Change-Id: Ia2f485c7ce8849db6e7c1d2ac08f5e008aea2ff8 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Fix spelling issues in qhighdpiscaling.cppTor Arne Vestbø2017-11-131-3/+3
|/ | | | | Change-Id: I4ca5a2e79ff88a664505273d2a9f38b1b499076c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-161-2/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/common/linux-android.conf src/gui/opengl/qopengl.h src/network/socket/qnativesocketengine_winrt.cpp src/network/socket/qnativesocketengine_winrt_p.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/eglfs/api/qeglfsintegration.cpp src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp sync.profile Change-Id: If70aaf2c49df91157b864cf0d7d9513546c9bec4
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-11-151-2/+4
| |\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/plugins/platforms/eglfs/qeglfsintegration.cpp src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp Change-Id: Id2da7c775439adb62646d5b741ee7c638042b34b
| | * Only turn off font hinting when scale is != 1Paul Olav Tvete2016-11-081-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | KDE will set the screen scale factors to 1 by default. Make sure we don't turn off font hinting in that case. Task-number: QTBUG-56797 Change-Id: Ieab18a7cfe4c1cb7087caab4d881932a4a991bc8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-09-211-4/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5971b88e is not needed in new configure. This merge also reverts "fix QMAKE_DEFAULT_*DIRS resolution with apple SDK", 2c9d15d7, because it breaks iOS build with new configure system. Conflicts: mkspecs/features/default_pre.prf mkspecs/features/mac/toolchain.prf mkspecs/features/toolchain.prf src/dbus/qdbusconnection.cpp src/plugins/sqldrivers/mysql/qsql_mysql.cpp src/sql/drivers/mysql/qsql_mysql.cpp src/widgets/widgets/qmenubar.cpp src/widgets/widgets/qmenubar_p.h tools/configure/configureapp.cpp tools/configure/environment.cpp tools/configure/environment.h Change-Id: I995533dd334211ebd25912db05b639d6f908aaec
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-09-161-4/+4
| |\| | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp Change-Id: I0af32ee55936d523cbd259b6fe82eb9c409f9074
| | * Fix typos in highdpi docsFrederik Gladhorn2016-09-151-4/+4
| | | | | | | | | | | | | | | | | | Change-Id: I15fd6859ff777388a229e3cb10de45886fe543fb Reviewed-by: Nico Vertriest <nico.vertriest@theqtcompany.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-161-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/src/qmake-manual.qdoc src/corelib/global/qglobal.cpp src/corelib/tools/qstring.cpp src/network/socket/qabstractsocket.cpp src/network/socket/qnativesocketengine_unix.cpp src/plugins/platforms/eglfs/api/qeglfsglobal.h Change-Id: Id5dfdbd30fa996f9b4b66a0b030b7d3b8c0ef288
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-131-1/+1
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/io/qsettings.cpp src/corelib/itemmodels/qstringlistmodel.cpp tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp Change-Id: I1c6c306ef42c3c0234b19907914b19da706b4a03
| | * Doc: Change instances of '(Mac) OS X' to 'macOS'Topi Reinio2016-08-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of version 10.12 (Sierra), the name of Apple's desktop operating system will be macOS. Change the occurrences where the Mac platform is discussed to use a macro \macos, which expands to 'macOS'. This helps with adapting to future renaming. Update the instructions on mac-specific Q_OS_* macro usage. Add a \target for the old 'Qt for OS X' topic to keep links working for other documentation modules that try to link with the old name. Change-Id: Id33fb0cd985df702a4ae4efb4c5fd428e77d9b85 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | | QtBase: use printf-style qWarning/qDebug where possible (II)Marc Mutz2016-05-031-4/+5
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this second part, replace qWarning() << "" << non-QString with qWarning("..%.", non-QString). QString (and QUrl etc) have special escaping handling when streamed into QDebug, so leave those alone. They also seem to expand to less code than the qPrintable() alternative, so there's no reason to replace them. Saves 2KiB, 3.4KiB, ~750b and ~450b in text size in QtCore, Gui, Network and Widgets, resp., on optimized GCC 5.3 AMD64 builds. Change-Id: Iae6823e543544347e628ca1060d6d51e3b04d3f4 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* | QtGui: eradicate Q_FOREACH loops [rvalues]Marc Mutz2016-02-111-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ... by replacing them with C++11 range-for loops. This is the simplest of the patch series: Q_FOREACH took a copy, so we do, too. Except we don't, since we're just catching the return value that comes out of the function (RVO). We can't feed the rvalues into range-for, because they are non-const and would thus detach. Change-Id: I457942159015ff153bdfc6d5f031a3f0a0f6e9ac Reviewed-by: Gunnar Sletta <gunnar@sletta.org> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* doc: correct documentation of QT_AUTO_SCREEN_SCALE_FACTOR env varShawn Rutledge2016-01-071-1/+1
| | | | | Change-Id: I4fa57279b23911893a615fe8a3ce9854d0fec971 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* Update QHighDpiScaling internal documentationMorten Johan Sørvig2015-12-021-24/+113
| | | | | | | | | | | Expand section on coordinate systems. Document the AA_EnableHighDpiScaling / AA_DisableHighDpiScaling flags added in commit add58ed. Add some notes for platform plugin work. Change-Id: Ie6fe2d818a88ba784c0ee675fabbd3fc04d64bf1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* QtBase: remove explicit function info from qWarning() etcMarc Mutz2015-11-281-1/+1
| | | | | | | | | | | This information is already registered by the QMessageLogger ctor. Where, by dropping the << Q_FUNC_INFO in ostream-style qDebug(), only a string literal remained, converted to printf-style qDebug() on the go. Change-Id: I3f261c98fd7bcfa1fead381a75a82713bb75e6f3 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Update high-DPI scaling enablers.Morten Johan Sørvig2015-11-041-12/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Make it possible to enable and disable both at the environment variable level and at the source code level. This applies to scaling done by Qt using display density information provided by the operating system. Disabling is done with a 'veto' system: both the environment and source code my prevent the other for enabling scaling. This covers use cases of 'my system does not provide correct display metrics' and 'my application needs access to display pixels', respectively. On the environment, scaling is now enabled with QT_AUTO_SCREEN_SCALE_FACTOR=1 and disabled with QT_AUTO_SCREEN_SCALE_FACTOR=0. In source code the corresponding application attributes are AA_EnableHighDpiScaling and AA_DisapleHighDpiScaling. Not setting any of these indicates 'no preference'. The global scale factor set by QT_SCALE_FACTOR is not affected by any if the disablers. Task-number: QTBUG-46615 Change-Id: If18607d4b56ace1914a710e5aa60b2f0968e0010 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
* Print one warning for the new high DPI variables, not fourThiago Macieira2015-09-241-4/+4
| | | | | | | | | | | | | | | | | | | | | For people with non-empty QT_MESSAGE_PATTERNS, the multiple lines would be unreadable. This is what it showed for me when starting Qt Creator: [1442136.587] qtcreator(82762 82762)(?libQt5Gui.so.5?|QGuiApplicationPrivate::createPlatformIntegration|QGuiApplicationPrivate::createEventDispatcher|QCoreApplication::init|QCoreApplication::QCoreApplication|QGuiApplication::QGuiApplication|QApplication::QApplication|?qtcreator?|?qtcreator?|__libc_start_main): Warning: QT_DEVICE_PIXEL_RATIO is deprecated. Instead use: [1442136.592] qtcreator(82762 82762)(?libQt5Gui.so.5?|QGuiApplicationPrivate::createPlatformIntegration|QGuiApplicationPrivate::createEventDispatcher|QCoreApplication::init|QCoreApplication::QCoreApplication|QGuiApplication::QGuiApplication|QApplication::QApplication|?qtcreator?|?qtcreator?|__libc_start_main): QT_AUTO_SCREEN_SCALE_FACTOR to enable platform plugin controlled per-screen factors. [1442136.592] qtcreator(82762 82762)(?libQt5Gui.so.5?|QGuiApplicationPrivate::createPlatformIntegration|QGuiApplicationPrivate::createEventDispatcher|QCoreApplication::init|QCoreApplication::QCoreApplication|QGuiApplication::QGuiApplication|QApplication::QApplication|?qtcreator?|?qtcreator?|__libc_start_main): QT_SCREEN_SCALE_FACTORS to set per-screen factors. [1442136.593] qtcreator(82762 82762)(?libQt5Gui.so.5?|QGuiApplicationPrivate::createPlatformIntegration|QGuiApplicationPrivate::createEventDispatcher|QCoreApplication::init|QCoreApplication::QCoreApplication|QGuiApplication::QGuiApplication|QApplication::QApplication|?qtcreator?|?qtcreator?|__libc_start_main): QT_SCALE_FACTOR to set the application global scale factor. (and imagine it line-broken in a terminal 140 columns wide) Change-Id: I42e7ef1a481840699a8dffff1406f73dc4d44a41 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* Compile-time option for disabling high-DPI scalingPaul Olav Tvete2015-08-061-0/+2
| | | | | | | | | | | | Even if QHighDpiScaling::isActive() returns false, there is a small overhead from calling functions and multiplying with 1.0. This change adds a QT_NO_HIGHDPISCALING #ifdef that replaces all conversion functions with empty inline functions. Task-number: QTBUG-46615 Change-Id: Idf85e1700e3adf7f7174c6fa3f5e1d006d74c826 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* Introduce cross platform high-dpi scalingMorten Johan Sørvig2015-07-301-0/+320
Add a coordinate scaling layer to QtGui, which supports 'devicePixelRatio' type high-dpi on all platforms, in production and also for development and testing purposes. High-DPI scaling is opt-in, by setting environment variables: QT_SCALE_FACTOR - sets a global scale factor QT_AUTO_SCREEN_SCALE_FACTOR - sets per-screen scale factors, where the scale factors are provided by the platform plugin. This QtGui scaling can be used instead of or in addition to scaling done by the window system. This distinction is not visible to applications [when they use Qt API], which will see a change in the value returned by the devicePixelRatio() accessors as usual. Introduce a new (private to Qt) coordinate system: native pixels. The coordinate system stack now looks like: device-independent pixels (app, upper parts of Qt) native pixels (lower parts of Qt Gui, platform plugins) device pixels (backing stores and OpenGL) Add private QHighDpi namespace with scaling functions that convert between device-independent pixels and native pixels: T toNativePixels(T, QWindow *); T fromNativePixels(T, QWindow *); Add scaling calls the QWindow (and friends) cross-platform implementation, around the calls to QPlatformWindow functions. QPlatformWindow now uses native coordinates - platform code remains largely unchanged since native coordinates are window system coordinates. QWindow now uses (possibly) scaled coordinates. This means that platform plugins no longer can rely on QWindow::geometry() and related functions. QPlatformWindow::windowGeometry() and other convenience functions have been added for use when the platform plugin needs to convert scaled geometry to native geometry. Add Qt::AA_NoHighDpiScaling, which can be use to disable any scaling in QtGui, effectively ignoring the environment variables. (Note that this does not disable any scaling done by the window system.) Contributions from Friedemann and Paul. Task-number: QTBUG-46615 Change-Id: I673bbd69c130e73b13cce83be11bfb28f580bf60 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>