summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
Commit message (Collapse)AuthorAgeFilesLines
* High-DPI: Set the minimum scale factor to 1Morten Johan Sørvig2021-03-021-5/+3
| | | | | | | | | | | | | | | Avoid painting errors with dpr < 1, also for the PassThrough mode. This limits the minimum high-dpi scale factor to 1, for the code path which determines the scale factor based on screen DPI. Pick-to: 6.1 Task-number: QTBUG-89948 Change-Id: I14b3f130f0ae141d5f05c87437f926a9f76d1dec Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Assert that either both or neither pointer are nullptrVolker Hilsheimer2021-02-241-0/+2
| | | | | | | | | | Identical change to qmetatype.cpp Fixes static analyzer warning 0267bc9b3ba521cf8bf0a7fea8981ee5 Pick-to: 6.1 Change-Id: Id6219f5025d703dd43b1742a067aa934d6aacd8c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix handling of virtual/native pixels in QAndroidPlatformWindowAndreas Buhr2021-02-231-15/+22
| | | | | | | | | | | | f92e1953699b2529cc6ea2fd399fe4f2b887e83c made sure a new QAndroidPlatformWindow always has a geometry. However, it did not take into account HiDPI handling. This patch fixes it and introduces proper HiDPI handling. Pick-to: 5.15 6.0 6.1 Fixes: QTBUG-91161 Change-Id: Iddf31b7abfd0a1bada3b051ed4de3bf6c2897d8e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QAbstractFileIconProvider: Use platform theme iconsFriedemann Kleint2021-02-211-0/+3
| | | | | | | | Add code paths to use platform theme icons should icon themes fail. Task-number: QTBUG-66177 Change-Id: I9554637f5230b1f57faaeef6b2c04cf082271edb Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Initialize some uninitialized member variablesHe MingYang2021-02-201-7/+9
| | | | | Change-Id: Ia8e06850a2288f40906602adfbe40abb0faf8057 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix Wacom Art Pen detection on xcbShawn Rutledge2021-02-122-3/+8
| | | | | | Fixes: QTBUG-91102 Change-Id: I6cd7af26153457609c1fa8fb0a9e167939d592fc Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QGuiApplication: use global position to create local position for synthetic ↵Richard Moe Gustavsen2021-02-031-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | mouse events When QWidgetWindow handles a QTouchEvent, it will call updateTouchPointsForWidget() for each widget it tries to deliver the touch event to. This will make sure that the point's position() is updated to be local to the widget being processed. The problem is that we never reset this overwriting of local positions in the event after we're done. So if we later try to synthesize a mouse event from it, the local position in the fake mouse event will be based on the local position inside a random widget, and not the original local position sent from QPA. Rather than trying to store all the original local positions inside the event before going through this delivery logic, and reset it afterwards, we base the local position of the synthesized mouse event on the (unmodified) global position instead. Fixes: QTBUG-90033 Change-Id: I1588351482de7cce9c06d102db3686ea8dd0c118 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Improve and expand QShortcutMap debug outputMitch Curtis2021-02-031-4/+8
| | | | | | | | | | - Replace vague symbols with descriptive words. - Use qScopeGuard() to ensure that removeShortcut prints the number of removed shortcuts for all execution paths. Change-Id: I4d36366445756b41b1dc40bbb1e987dce669a723 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make setSelectionOnFocusObject() take native pixelsMorten Sørvig2021-02-021-5/+9
| | | | | | | | | | | | Change the setSelectionOnFocusObject() to take geometry arguments in native pixels, in order to be consistent with other QPlatformInputContext API. Calling code which pass non-native geometry must be updated (in practice only the Android platform plugin). Change-Id: I1c61b8cf583afe607567d6056ca7ff23cc3de3f3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add geometry accessors to QPlatformInputContextMorten Johan Sørvig2021-02-012-0/+81
| | | | | | | | | | | | | | | | | | | | | | | | | Currently the platform plugins use the public QInputMethod API when querying geometry. However, QInputMethod returns geometry in device independent pixels, while the platform plugins require geometry in native pixels. Add new API to QPlatformInputContext which returns input geometry in the native window coordinate system: QRectF inputItemRectangle() QRectF inputItemClipRectangle() QRectF cursorRectangle() QRectF anchorRectangle() QRectF keyboardRectangle() These make the relevant QHighDpi calls internally, and such calls can then be moved out of the platform plugins. Disambiguate inputItemRectangle() in qandroidinputcontext.cpp by renaming it to screenInputItemRectangle(). Change-Id: I561745b64fb197d64e3dfddcf0751528bb8d0605 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Don't forward-declare non-Qt things with QT_FORWARD_DECLARE_*Mårten Nordheim2021-01-261-1/+1
| | | | | | | As it breaks in namespace builds Change-Id: I1a278330eeea6b2b89c8a57c0df828dff94ebf7a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add QPlatformScreen::colorSpace()Allan Sandfeld Jensen2021-01-251-0/+2
| | | | | | | | Added for macOS and X11 screens Task-number: QTBUG-90535 Change-Id: Ifafe7a07ee2abc3c42cd12785db2d7329878375b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* iOS: Handle keyboard events when using an external keyboardAndy Shaw2021-01-202-1/+43
| | | | | | | | | | | | | | | | | | This enables the two possible approaches for handling external keyboard events. While support still exists for before 13.4 then both approaches are needed. This ensures that all external keyboard events are handled as key events and passed on accordingly. Additionally, this accounts for possible shortcuts too, therefore a new function is added to QShortcutMap to aid that. As a result, code has now moved from QCocoaKeyMapper to be part of the gui/platforms/darwin part to make it easier to reuse this code elsewhere. Fixes: QTBUG-85727 Change-Id: I349af43468b03fd8dcb16adba02669974affe154 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* AA_SynthesizeTouchForUnhandledMouseEvents: keep correct coordinatesShawn Rutledge2021-01-141-1/+1
| | | | | | | | | | | | | | | | | | | | | QGuiApplicationPrivate::processMouseEvent() sends a QWindowSystemInterfacePrivate::TouchEvent if the mouse event is not accepted and AA_SynthesizeTouchForUnhandledMouseEvents is enabled. A QPA TouchEvent always contains native touch points, which is why it calls QWindowSystemInterfacePrivate::fromNativeTouchPoints to translate the QMouseEvent's device-independent position back to the raw position that it would have had if it came from a real touchscreen. Therefore we must give that function touchpoints that are actually in native coordinates. It may be that some of this transformation could be avoided entirely, but here we prove that the existing way works correctly, by adding coordinate checking to the tst_QWindow::mouseToTouchTranslation() test. Pick-to: 6.0 Task-number: QTBUG-86165 Change-Id: I4c9ca2b11e9eb76d79712c187db3eb9865da581a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove the qmake project filesJoerg Bornemann2021-01-071-191/+0
| | | | | | | | | | | | | | | | Remove the qmake project files for most of Qt. Leave the qmake project files for examples, because we still test those in the CI to ensure qmake does not regress. Also leave the qmake project files for utils and other minor parts that lack CMake project files. Task-number: QTBUG-88742 Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Add a platform capability indicating support for QRhi-based renderingLaszlo Agocs2021-01-042-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This attempts to reconcile a minor difference between Qt 5 and Qt 6: Running Qt Quick applications with a platform plugin such as vnc, led to an automatic fallback to the 'software' backend based on the OpenGL capability reported from the platform plugin. In Qt 6.0 this logic is gone from Qt Quick, because we do not have, and wish not to have, individual flags for each and every 3D API on this level. Therefore in Qt 6.0 a Qt Quick application running with the vnc (or linuxfb, or minimal) platform needs an explicit selection of the software backend via QT_QUICK_BACKEND or QQuickWindow::setGraphicsApi(). To keep migration for users of such platform plugins easier, we can still reintroduce a Qt 5-like logic: by having a high level Is-QRhi-Supported type of flag, we can make Qt Quick query that, and trigger the fallback to the software backend when it is reported as false by the platform plugin. As this is the minority case and a conscious choice by platform plugins, the flag can be opt-out (i.e. true by the default hasCapability implementation). When it comes to the existing OpenGL flag, that needs to stay for compatibility reasons, but it is worth noting that the new flag semantically falls in the exact same category: it does not indicate things will really work at run time, but rather serves as an opt-out, "do not even try" type of declaration the platform plugin can make, which then allows modules like Qt Quick to make early, upfront decisions about which rendering paths/backends to take. Change-Id: I8d6fddeb82ca6eece7b7abc1a5b64ebe6d8af29d Task-number: QTBUG-89561 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* State in docs that the BufferQueueingOpenGL cap is deprecatedLaszlo Agocs2021-01-041-2/+2
| | | | | | | | | | There are no queries for this (somewhat dubious) flag in practice. Its usage in Qt Quick is gone since 2014 after 0129887195c7255f41515f72ceb213a38b98f72d. Change-Id: I4fd9cef2705ce13b79ff1dc40a6eda7ce2035e30 Reviewed-by: Andy Nichols <andy.nichols@qt.io> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Add a dedicated QWindow surface type for D3DLaszlo Agocs2021-01-042-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Even though there is no D3D-specific logic in the windows platform plugin, meaning a QWindow with either OpenGLSurface or VulkanSurface (or anything really) is DXGI/D3D-compatible, it now looks like it is beneficial, and more future proof, if there is a dedicated surface type. As the linked report shows, there are OpenGL-specific workarounds accumulated in the platform plugin, while not being clear if these are relevant to non-OpenGL content, or if they are relevant at all still. (and some of these can be difficult/impossible to retest and verify in practice) When D3D-based windows use the same surface type, all these are active for those windows as well, while Vulkan-based windows have their own type and so some of these old workarounds are not active for those. To reduce confusion, having a dedicated surface type for D3D as well allows the logic to skip the old OpenGL workarounds, giving us (and users) a more clear overall behavior when it comes to OpenGL vs. Vulkan vs. D3D. The change is compatible with any existing code in other modules because any code that uses OpenGLSurface for D3D will continue to work, using the new type can be introduced incrementally. Task-number: QTBUG-89715 Change-Id: Ieba86a580bf5a3636730952184dc3a3ab7669b26 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Update QPalette() documentation to not mention the application paletteTor Arne Vestbø2021-01-041-1/+4
| | | | | | | | | | | | | | | | | | It's an implementation detail that the default constructed palette happens to use the d-pointer of the application palette, and as a result has the same colors as the application palette if requested. The palette has an empty resolve mask, and hence all the colors in the palette are undefined. Users should not rely on QPalette() to represent the application palette when for example overriding a parent palette. Task-number: QTBUG-85226 Pick-to: 6.0 5.15 Change-Id: Ia6747887eef6e9a5f21b2002066608c433260de2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Clarify QWindowPrivate::maybeQuitOnLastWindowClosedTor Arne Vestbø2020-12-171-3/+3
| | | | | | | | | | | | | We only need to check QGuiApplication::quitOnLastWindowClosed() at the point where we've actually concluded that the last window was closed. Checking for !q->parent() was redundant, as we were already exiting early when !q->isTopLevel(). Pick-to: 6.0 5.15 Change-Id: I934e186d707361b31d19692c04d2e17b7ba0f49e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* xcb: report wheel events from the correct device instanceShawn Rutledge2020-12-152-0/+21
| | | | | | | | | | | | | | | | | Until now, all wheel events came from one "core pointer". It's useful in Qt Quick to tell the devices apart, because some support smooth scrolling and some don't. Also remove the QHash storing legacy ScrollingDevice structs, and use a subclass of QPointingDevicePrivate instead. Task-number: QTBUG-46412 Task-number: QTBUG-72167 Task-number: QTBUG-69433 Change-Id: Ie6a3d8dd494f981e8706b9a66a1021dfb51baec4 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove the deprecated m_logicalDpi declarationWeng Xuetian2020-12-081-1/+0
| | | | | Change-Id: I8d9d59f010874e5a45084afcf55640078d5eba24 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* doc: Remove dpiawareness command line argumentTor Arne Vestbø2020-12-041-2/+0
| | | | | | | | | We don't want to (officially) expose customizations like this to the user, now that high-DPI is always enabled and should work. Change-Id: I2f0bd7c625b565896b0766586f191ff5001eb60a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QInputDevice: Parent default keyboard to core app singletonFabian Kosmale2020-12-041-1/+1
| | | | | | | | | | | With this we can avoid leaking the QInputDevice which is created when the platform plugin does not provide any. The onwership is solved in a similar way as in the plugins, except that here we have no parent which really fits, so we use QCoreApplication::instance instead. Pick-to: 6.0 Change-Id: I77a212fb592ba3d5a42b2ecd486763e3b4d3410e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Make qDebug output for QTabletEvent similar to that for QMouseEventShawn Rutledge2020-12-041-10/+7
| | | | | | | | | | | | | | | | | | Reuse operator<<(QPointingDevice*) and move the button state right after the event type. Now it's easier to follow when a QTabletEvent is not accepted and a mouse event is synthesized: qt.quick.pointer QQuickWindowPrivate::deliverPointerEvent - delivering QTabletEvent(TabletPress LeftButton pos=100,100 z=3 xTilt=25 yTilt=35 pressure=0.5 dev=QPointingDevice("Wacom Intuos3 6x8 Pen stylus" Stylus id=13 seat=30002 ptrType=Pen caps=Position|Pressure|MouseEmulation|Hover|XTilt|YTilt uniqueId=499602d2)) qt.quick.pointer QQuickWindowPrivate::deliverPointerEvent - delivering QMouseEvent(MouseButtonPress LeftButton pos=100,100 scn=100,100 gbl=3739,1029 dev=QPointingDevice("Wacom Intuos3 6x8 Pen stylus" Stylus id=13 seat=30002 ptrType=Pen caps=Position|Pressure|MouseEmulation|Hover|XTilt|YTilt uniqueId=499602d2)) Change-Id: If22f1c07d32f595d0444513b49635218c08a300d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove QGuiApplicationPrivate::m_fakeTouchDeviceShawn Rutledge2020-12-031-1/+0
| | | | | | | It is no longer in use. Change-Id: I810a79c81fe49d855b31e992bf000166247791a5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QString: plaster more and more [[nodiscard]]Giuseppe D'Angelo2020-12-031-2/+1
| | | | | | | The situation was quite inconsistent. Use the attribute more. Change-Id: If21817b4c2ea1148ad4ad80e7a50fab721a58b65 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix links to Application ExampleVolker Hilsheimer2020-12-021-1/+1
| | | | | | | | | | The example was renamed in 6cb36d825d365988ea7a601218bdd3a329290469. Pick-to: 6.0 Change-Id: Ic9daac60002c9988dfeb5c7dcde74edb69388f37 Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Jason McDonald <macadder1@gmail.com>
* Fix documentation links to High DPI documentationAndreas Buhr2020-12-011-1/+1
| | | | | | | | | | | The documentation on High DPI was recently rewritten, renaming several sections. This patch fixes the links which were broken by this change. Task-number: QTBUG-88533 Pick-to: 6.0 Change-Id: I5e9417554270a6740986d7cec5e3433d043e5560 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPEAndreas Buhr2020-11-304-5/+5
| | | | | | | | | | | | | | Q_MOVABLE_TYPE was conceived before C++ had move semantics. Now, with move semantics, its name is misleading. Q_RELOCATABLE_TYPE was introduced as a synonym to Q_MOVABLE_TYPE. Usage of Q_MOVABLE_TYPE is discouraged now. This patch replaces all usages of Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE in QtBase. As the two are synonymous, this patch should have no impact on users. Pick-to: 6.0 Change-Id: Ie653984363198c1aeb1f70f8e0fa189aae38eb5c Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Update setHighDpiScaleFactorRoundingPolicy docsTor Arne Vestbø2020-11-271-6/+3
| | | | | | | | | | | The default is now passthrough. And let's not mention the environment variable overrides, as they are meant for internal testing. Pick-to: 6.0 Pick-to: 6.0.0 Change-Id: Ie2409e5411d4bdcdf041834cb5ca9e1215aa173a Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Windows QPA: Pass device for synthesized touch/tablet eventsFriedemann Kleint2020-11-272-0/+33
| | | | | | | | | | | Add the overloads for mouse events with device/without timestamp and pass the active tablet or touch device. Task-number: QTBUG-88678 Task-number: QTBUG-46412 Pick-to: 6.0 Change-Id: I8695b493540d0cbf50e9c72afe870a7633de3ab9 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Output source in debug operator of QMouseEventFriedemann Kleint2020-11-251-0/+4
| | | | | | | | Task-number: QTBUG-88678 Task-number: QTBUG-46412 Pick-to: 6.0 Change-Id: If9282f5b845ef16ff7e7ce523f78e3b8adfbef90 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Return subclass type from overrides of QEvent::cloneVolker Hilsheimer2020-11-231-34/+34
| | | | | | | | | | C++ allows overrides to return a covariant type, so if calling code has already cast the callee down to the right type, don't require it to cast the returned clone down as well. Pick-to: 6.0 6.0.0 Change-Id: I802f00a3c78e03047046986d0ed0a479b47573b8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QGuiAppPriv: don't clear target and window for TouchCancelShawn Rutledge2020-11-211-2/+0
| | | | | | | | | | | | | It's nice not to leave garbage in QPointingDevicePrivate::activePoints between events; on the other hand, this garbage doesn't matter, because every press event sets the target and window independently, without caring what was stored there from before. But it was wrong to clear it before we've even delivered the TouchCancel event. Pick-to: 6.0 Pick-to: 6.0.0 Change-Id: I924039a7c7a8ed75f420d1837c63dc19d3cc98b6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Fix documentation warnings for Qt GUITopi Reinio2020-11-193-5/+4
| | | | | | | | | | | | | | | - Remove obsolete dependencies and references. - Restore previously deleted snippet code referenced in richtext.qdoc. - Add widgets snippets path to exampledirs; some classes were moved from QtWidgets to QtGUI and related \snippet commands were broken. - Mark internal functions under QNativeInterface::Private as \internal. Task-number: QTBUG-86295 Change-Id: I9c165c860c7191dac65972d702698a1745bff77f Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Disable copying and assigning of QEventVolker Hilsheimer2020-11-192-12/+41
| | | | | | | | | | | | | | Polymorphic classes should not be copied. However, we do rely on event copying in our propagation logic. So, make the members protected, don't delete them, using a dedicated macro. This way, QMutable*Event classes can be used to make copies. Remove some last usage of copying of QInputMethod(Query)Events. Change-Id: Ia0a8ae4ca9de97dcd7788ca3c6ed930b6460c43a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Consolidate static_asserts for event sizesVolker Hilsheimer2020-11-172-4/+4
| | | | | | | | | | | | The assertion for size of QMouseEvent and Q(Mutable)SinglePointEvent being equal was previously in QtDeclarative; qtbase should already fail to build if they ever diverge. Having the checks in a single translation unit is enough, qevent.cpp is the obvious choice. Change-Id: I80ad24273738dfde8b165323ac1e790c320c707c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Allow QMutableSinglePointEvent to be copy- and default-constructedVolker Hilsheimer2020-11-171-1/+2
| | | | | | | | | | | | | | | | | Since QMutableSinglePointEvent is just an access-helper to QSinglePointEvent, we can safely create one from the other. This covers QMouseEvent as well with the right casting in place. And by making QMSPE default constructable, we can use it in code that needs to frequently copy event data, for example in QtQuick. This allows us to make the copy c'tor and assignment operators for QEvent classes protected, which prevents potentially dangerous (ie. slicing) implicit copies. Change-Id: I815774847cca63896f46c43df683053b3d952b61 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Allow cloning of event objectsVolker Hilsheimer2020-11-171-1/+72
| | | | | | | | | | | | We have use cases for cloning of events, e.g. in the state machine and for event propagation. Provide the means to do so through a virtual method. Adapt QFutureCallOutEvent::clone, which is now an override. No code seems to be using that method. Change-Id: I6864d6597f6de800343c4dc458a7994e84dc6fb4 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Adjust code format, add space after 'if'Zhang Sheng2020-11-166-21/+21
| | | | | | Change-Id: Ice081c891ff7f4b766f49dd4bd5cf18c30237acf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Make QEventPoint an idiomatic value typeVolker Hilsheimer2020-11-163-72/+71
| | | | | | | | | | | | | | | | | | Use atomic ref counting and make type movable. Make a moved-from QEventPoint valid but undefined. Given that the d pointer is anyway loaded into the register, the additional check doesn't cost much, and makes the class more compliant with our guide for value types in Qt. Add a free swap overload via Q_DECLARED_SHARED, which also declares the type as movable. As a drive-by, remove superfluous inline. This also silences some static analyser warnings. Change-Id: I7c4a436fce44556aa37026ac26dc2061e1f01de9 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Inline trivial getters for QEvent subclassesVolker Hilsheimer2020-11-132-51/+27
| | | | | Change-Id: Ic0ee4f3e311e1068d23796cee4fe58008a2a8114 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Clean up and pack data members of QEvent classesVolker Hilsheimer2020-11-122-83/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure all bits reported by sizeof for the most important public event classes are used optimally. QEvent is 24bytes large due to default alignment in C++, so we might just as well use bool instead of bitfields for the most important data members. This generates less (and thus smaller and faster) code, and we still have plenty of bits available for future needs. Default the copy constructor and assignment operator, the assert and tracing seem to be relics from the Qt 3/4 days. Note: QEvent's d-pointer is currently unused, with the exception of a hack in QGraphicsView. Removing that would save another 8 bytes through the entire event hierarchy. For the new classes in the QInputEvent hierarchy, apply the same principle. Allocate bits in QInputEvent and QSinglePointEvent to fill the 8-byte aligned space. Using some of those bits for QMouseEvent and QWheelEvent makes sure we don't increase the size for those in spite of additionally reserved bits. As a result of this, several QInputEvent and subclasses become 8 bytes smaller on clang and gcc (with the exception of QNativeGestureEvent) while at the same we have more space for future extensions. The sizeof's for the various classes on different compilers produce these before and after result: clang +/- gcc +/- msvc +/- QEvent 24 0 24 0 24 0 QInputEvent 56 -8 56 -8 48 0 QPointerEvent 80 -8 80 -8 72 0 QSinglePointEvent 96 -8 96 -8 88 0 QMouseEvent 96 -8 96 -8 88 0 QTabletEvent 112 -8 112 -8 96 -16 QKeyEvent 104 -8 104 -8 96 0 QNativeGestureEvent 120 0 120 0 120 0 QWheelEvent 112 -8 112 -8 112 -8 So, with this change we save 8 bytes on gcc and clang for many event types, esp on Linux systems. As a drive-by: replace ulong with quint64, make QTabletEvent data floating point, and rename some variables for clarity. Change-Id: I4cf81c8283262cbf59ee3fb7064a59837332ced7 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Document physicalDotsPerInch high-DPI behaviorMorten Johan Sørvig2020-11-121-0/+3
| | | | | | | | | The values are in device-independent dots, which may be unexpected. Task-number: QTBUG-62649 Change-Id: I85d0e3dd6bd428dd351ebf22281b1f4d9a1b2dc4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Document physicalDotsPerInch high-DPI behaviorMorten Johan Sørvig2020-11-121-0/+9
| | | | | | | | | Add note to the member function documentation, in addition to the class documentation. Task-number: QTBUG-62649 Change-Id: I5cce6c06b58e70ef6c051d63c2901b219fa6d6b9 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Purge QCoreApplicationPrivate::cloneEvent and overridesVolker Hilsheimer2020-11-123-348/+1
| | | | | | | | Not used anywhere in Qt 6, and if whatever needs this ever comes back, then we won't implement it like this. Change-Id: I99655ba5825644cef3686bbe50ca688b68f5c2a4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Doc: Add missing brief statements for \property documentationTopi Reinio2020-11-121-25/+25
| | | | | | | | ... where applicable. Fixes: QTBUG-88232 Change-Id: I835df434765caededd35d5114965b4a1663e7942 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Replace ushort -> quint16 in event classesShawn Rutledge2020-11-102-6/+6
| | | | | | | | We used quint32 for 32-bit types and ushort for 16-bit ones, but using explicit bit sizes looks more consistent. Change-Id: I3106dd6ecb2367fef6f8012c28266e1b4b1abf4b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Silence "same window" warning when QPA doesn't give touch dest windowShawn Rutledge2020-11-101-6/+4
| | | | | | | | | | | | Platform plugins should dispatch events to specific windows when possible; but eglfs currently doesn't do that, so this warning was printing for many touch events. Now we print it only if the window that the platform plugin says *should* handle a touch move or release is non-null and *different* than the one that actually handled the press. Fixes: QTBUG-88192 Change-Id: Ia3271b5e67902dcf8a1cdae605adec470c3cfd89 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>