summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qscreen.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Make it possible to know when a screen is being removedAleix Pol2014-07-021-0/+10
| | | | | | | | | | | | | | | | | So far, we had to listen to the QObject::destroyed signal from the QScreen class to figure out whether a screen was removed. Often, this is already too late, given that most of the QWindows have been moved by then and we don't get to react before the windows are being set to the primary screen. This patch introduces a new signal that will notify about a screen removal before the screen is started to be destroyed, so that the application gets to decide what to do with the screens before Qt decides to move things around. [ChangeLog][QtGui][QGuiApplication] Added QGuiApplication::screenRemoved signal to inform that a screen has been removed, before Qt reacts to it. Change-Id: I99304179f4d345cae581a87baac6cff7b8773dea Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Extend the documentation for orientation in QScreenFabian Bumberger2014-02-141-3/+8
| | | | | | | | I find the current description of primaryOrientation and orientation a bit confusing. Change-Id: I25d77cff2c27c481607903bc1aeb54eacf616718 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-081-4/+4
| | | | | | | | | | | | | | | | | Default values should have mark-up to denote that they are code. This commit changes: -"property is true" to "property is \c true". -"Returns true" to "Returns \c true". -"property is false" to "property is \c false". -"returns true" to "returns \c true". -"returns false" to "returns \c false". src/3rdparty and non-documentation instances were ignored. Task-number: QTBUG-33360 Change-Id: Ie87eaa57af947caa1230602b61c5c46292a4cf4e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Make nativeOrientation available in the public APIPaul Olav Tvete2013-09-131-0/+17
| | | | | | | | | | | The QtSensors module defines the coordinate system relative to QPlatformScreen::nativeOrientation(). However, that is not part of the public Qt API. Task-number: QTBUG-32144 Change-Id: I6941c5b8589219064749f18880775b803f23fbbd Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Doc: Fix documentation for devicePixelRatio() functionsTopi Reinio2013-01-171-4/+3
| | | | | | | | Fix Incorrect use of \sa, missing markup for comment block and typos. Change-Id: I1b7e477b7429ace30ca3ab25c4814c8cba659a65 Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Basic high-dpi "retina" support for Qt 5.Morten Johan Sørvig2012-12-011-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | Bring Qt 5 on par with Qt 4, prepare for more comprehensive support later on. Introduce device independent pixels (dips), device pixels, and devicePixelRatio. Add high-dpi support to QPainter, QGLWidget, the cocoa platform plugin, mac and fusion styles. Dips are similar to CSS pixels, Apple points and Android density-independent pixels. Device pixels are pixels in the backing store/physical pixels on screen. devicePixelRatio is the ratio between them, which is 1.0 on standard displays and 2.0 on "retina" displays. New API: QImage::devicePixelRatio() and setDevicePixelRatio() QPixmap::devicePixelRatio() and setDevicePixelRatio() QWindow::devicePixelRatio() QScreen::devicePixelRatio() QGuiApplicaiton::devicePixelRatio() Change-Id: If98c3ca9bfdf0e1bdbcf7574cd5b912c9ff63856 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Fix QScreen::orientation() not always being updated after changing the ↵Simon Hausmann2012-09-261-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | update orientation mask The back-end might report screen orientation changes at any point and we record it in screen.d->orientation. However QScreen::orientation() returns the orientation filtered according to the mask. Changing the mask sends a notification to the back-end, which might send another update as a result of a possible subscription to system services (accelerometer). However on platforms where no subscription is required, where the platform plugin ignores the mask and always sends the latest orientation, we should "simulate" the update by updating the filtered orientation according to the new mask. The function is cheap to call as it won't emit any signals unless the orientation actually changes. This patch also adds missing flush() calls after handleScreenOrientationChange calls in the tests to ensure that the (synthetic) window system events are actually delivered to QScreen/QGuiApplication. Change-Id: Iebdd050f947e658ff5bc388629aa4cb31ab497fe Reviewed-by: Samuel Rødal <samuel.rodal@digia.com> Reviewed-by: Laszlo Papp <lpapp@kde.org>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* X11 (xcb) support for QScreen-per-output and runtime changesShawn Rutledge2012-09-181-1/+13
| | | | | | | | | | | | | QScreen has notifiers for its properties, but they were not being emitted when one changes the resolution or arrangement of individual outputs, e.g. via xrandr. Also there should be one QScreen per "output", e.g. laptop LCD + external monitor means 2 QScreens which will be siblings, rather than just 1 QScreen to represent the whole desktop. Change-Id: Ia61bbc5e6a3506f813ab11f87c03d14cf7f4ce85 Reviewed-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Fix doc errors in QScreen.Jason Barron2012-09-031-15/+13
| | | | | | | | | - Ensure all args are documented - Remove signals from \sa tag - Ensure return values are documented Change-Id: I1db111d082ee47f046598695bc3fa53d67798333 Reviewed-by: aavit <qt_aavit@ovi.com>
* Doc: Fixes for several doc errorsaavit2012-08-311-2/+1
| | | | | Change-Id: I5be9c8e9ff9c17fae0fbbe468f34439411aca06b Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
* Doc: Fix various errorsaavit2012-08-301-10/+5
| | | | | Change-Id: I07503dd379779148b674ab0f806f6eeac5d7d4b7 Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
* Get started with patching up the Qt GUI docsGunnar Sletta2012-06-281-0/+1
| | | | | | | | Primary goal, make the front page of the Qt GUI module a bit more clarifying and avoid downstream references inside the Qt GUI docs. Change-Id: Icbcfbb64b93963add889bf83711daa9575885c02 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Added QScreen::setOrientationUpdateMask().Samuel Rødal2012-06-061-1/+35
| | | | | | | | | | | | It might be too expensive to always have an accelerometer sensor running, so introduce API so that the application has to explictly ask to get the orientation updates it's interested in. Change-Id: Ib7dc5ad8807718409f744ebef53f4476aa05175d Reviewed-by: Ian Monroe <ian.monroe@nokia.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com> Reviewed-by: Kevin Ottens <kevin.ottens.qnx@kdab.com>
* Added QScreen::refreshRate() to get the vertical refresh rate.Samuel Rødal2012-05-081-0/+10
| | | | | | | | | | | | To give applications that want it the option to use a fixed timestep for animations, and to avoid having values of 60 hard-coded (we have a couple of those in qtdeclarative/src/quick already), we need to know the refresh rates of the screens we are rendering to. Change-Id: Ife49162e830440ad7eab563a27e8aebbbafc5fc5 Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Expose QPA API under qpa/*Girish Ramakrishnan2012-05-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main reasons for doing this are: 1. _qpa.h end up in the master QtGui include file. QtGui is meant for userland applications. qpa code is neither binary nor source compatible. Inadvertant use of QPA api makes the user code binary-incompatible. 2. syncqt creates forwarding headers for non-private header files. This gives people the impression that this is public API. As discussed on the mailing list, even though QPA api is internal and subject to change, it needs to treated differently from private headers since they will be used by in-qtbase and out-of-qtbase plugins. This commit does the following: 1. The _qpa in QPA header files is dropped. 2. syncqt now treats any file with qplatform prefix as a special file and moves it to qpa/ directory. The recommended way of using QPA API in plugins is: #include <qpa/qplatformfoo.h>. This allows the user include QPA API from multiple modules (for example, qplatformfoo might be in QtPrintSupport) 3. The user needs to explicitly add QT += <module>-private to get access to the qpa api. 4. Creates compat headers for the olden style qplatformfoo_qpa.h and QPlatformFoo includes. This commit does not change the cpp filenames. This requires a more careful merging of existing non qpa cpp files and existing cpp files on a case by case basis. This can be done at anytime. The following files are not renamed as part of this changed but will be fixed as part of a future change: src/gui/kernel/qgenericpluginfactory_qpa.h src/gui/kernel/qgenericplugin_qpa.h src/gui/kernel/qwindowsysteminterface_qpa.h files were renamed using for x in `find . -name "qplatform*_qpa.h"`; do git mv $x "${x/_qpa.h/.h}"; done for x in `find . -name "qplatform*_qpa_p.h"`; do git mv $x "${x/_qpa_p.h/_p.h}"; done includes were renamed using script for file in `find . -name "*.h" -or -name "*.cpp" -or -name "*.mm"`; do sed -i -e 's,.*#.*include.*<\(Qt.*/\)\?\(QPlatform.*\)>,#include <qpa/\L\2.h>,g' \ -e 's,.*#.*include.*"\(Qt.*/\)\?\(QPlatform.*\)",#include <qpa/\L\2.h>,g' \ -e 's,.*#.*include.* "\(qplatform.*\)_qpa.h",#include <qpa/\L\1.h>,g' \ -e 's,.*#.*include.*"\(qplatform.*\)_qpa_p.h",#include <qpa/\L\1_p.h>,g' \ -e 's,.*#.*include.*<\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)>,#include <qpa/\2\3>,g' \ -e 's,.*#.*include.*"\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)",#include <qpa/\2\3>,g' \ $file done Change-Id: I04a350314a45746e3911f54b3b21ad03315afb67 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
* api: Fix const correctness of api in QScreenGirish Ramakrishnan2012-04-171-6/+6
| | | | | | | | | const was missing in many convenience functions. grabWindow should not be const since it actually does something. Change-Id: I0ffa718878d4251c4fb5c34789cf58ebb85cff37 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Remove redundant \since 5.0Debao Zhang2012-03-221-1/+0
| | | | | | | | | | \since 5.0 has been add to the class section, so member functions and properties donot need this any more. see SHA: 5728c8a8e7c994b931d340315c241350d646f62a Change-Id: I4e67461373dda99ee1fbfdeb6477fde1dcfec116 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Added missing \since 5.0 and tweaked some docs in QtGui.Samuel Rødal2012-03-151-0/+1
| | | | | Change-Id: I91564f7a61962f97b9fb78c96d94d5695a3924db Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Introduce QScreen::grabWindow(), deprecate QPixmap::grabWindow().Friedemann Kleint2012-02-091-0/+48
| | | | | | | WId can be local to a screen. Change-Id: I09ca71313836a34dbf33289b254c80207a956bb1 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Made QWindow::currentOrientation() a property.Samuel Rødal2012-01-261-0/+2
| | | | | | | | | | | | | | To match the previous QWindow::orientation() property which can be useful to access from QML. Also, removed the automatic translation of Qt::PrimaryOrientation to QScreen::primaryOrientation() on the QWindow level, as it leads to a lot of complexity regarding the QWindow::contentOrientationChanged() signal, and makes it hard to distinguish between the case where the window's orientation follows that of the screen, and the case where the orientation just happens to be set to that of the screen. Change-Id: I6950d1337b7f929815eff1328181855090d8066b Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Made window orientation API more flexible.Samuel Rødal2012-01-241-25/+86
| | | | | | | | | | | | | | | Previously we only had QWindow::setOrientation() which was a hint about the orientation the window's contents were rendered in. However, it's necessary to separate between the orientation corresponding to the window buffer layout and orientation of the contents. A game for example might typically want to use a landscape buffer even on a portrait device. Thus, we replace QWindow::orientation() with QWindow::reportContentOrientationChange() and QWindow::requestWindowOrientation(). Change-Id: I1f07362192daf36c45519cb05b43ac352f1945b5 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Made it possible to report screen changes through QWindowSystemInterface.Samuel Rødal2012-01-121-25/+13
| | | | | | | | | | This makes it possible for platform plugin independent code (such as generic plugins) to report changes to screen properties. An example would be an accelerometer plugin that reports orientation changes without knowing anything about the windowing system. Change-Id: I984984b6d064327772c264bc942269422451da37 Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Made more QScreen properties NOTIFY and added average DPI properties.Samuel Rødal2011-11-301-2/+42
| | | | | | | | | The physicalDotsPerInch() is the average of the horizontal and vertical physical dots per inch, and likewise logicalDotsPerInch() is the average of the horizontal and vertical logical dots per inch. Change-Id: I18aa610dc9a63efe062f78c823ba29f90b2712f4 Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
* Add a note in the QScreen documentation about logical vs physical DPI.Samuel Rødal2011-11-241-0/+11
| | | | | Change-Id: I1d536711cbbc0ea8a21c6917e5e0066c1ad4ccae Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
* Fixed regression in tst_qscreen.Samuel Rødal2011-11-231-1/+18
| | | | | | | | | The ScreenOrientation enum was changed so that the values are power of twos, angleBetween() needed to be fixed in order to reflect this. Task-number: QTBUG-22554 Change-Id: Ia45dd6643b40b14204abf967b00c0d04834736a3 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Add Q_PROPERTY declarations to QScreen.Samuel Rødal2011-11-011-19/+46
| | | | | | | | This means we can expose the API to QML in a simple way. Change-Id: Ibc36711071d288ed78ce833a64d6be2f22fc4b62 Reviewed-by: Leonardo Sobral Cunha <leo.cunha@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove stale documentation.Casper van Donderen2011-10-181-1/+1
| | | | | Change-Id: I85139e0334b648bee0d18129cef9387dcc6c3222 Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
* Added Orientation API to QScreen and QWindow.Samuel Rødal2011-10-071-0/+118
| | | | | | | | | | | | QScreen now has a primary and current orientation, and a QWindow can set its orientation as well. The current screen orientation is just a hint to the application. Change-Id: I4635982cfac2d16634d4edd5c6ab78e9d0ac55a4 Reviewed-on: http://codereview.qt-project.org/5988 Reviewed-by: Paul Olav Tvete <paul.tvete@nokia.com> Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Improved logical and physical DPI APIs.Samuel Rødal2011-10-061-0/+69
| | | | | | | | | | | | | | Made physicalSize() return QSizeF instead, to prevent rounding errors. Added logicalSize() as the base to compute font pixel sizes instead, and added convenience functions in QScreen to access the logical and physical sizes and DPI metrics. Task-number: QTBUG-21736 Task-number: QTBUG-21737 Change-Id: Ic705dc98eb3632617659e65a0c9a552673dc0c65 Reviewed-on: http://codereview.qt-project.org/5888 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Fix stale license headers from refactor branchJason McDonald2011-09-151-17/+17
| | | | | | Change-Id: I38cd941202641f50bf632af35165a944d03a20e3 Reviewed-on: http://codereview.qt-project.org/4848 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Compile fix.Samuel Rødal2011-07-251-0/+212
Added missing qscreen.cpp. Change-Id: Id79a6a12aca0758fdb1a168d63969940111f03dd Reviewed-on: http://codereview.qt.nokia.com/2119 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>