summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qcoreevent.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Mention QChronoTimer in API docsAhmad Samir2024-03-031-2/+2
| | | | | Change-Id: Iaf9fb31994f1580b2051dbd0b1b8eef2a218aa39 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move QDeferredDeleteEvent loop level/scope handling into deleteLater()Tor Arne Vestbø2023-12-191-3/+3
| | | | | | | | | | | | | | | | | | | We have all the information we need when deleteLater() is called, so there's no point in deferring it until the event is posted, which requires friended access into the QDeferredDeleteEvent's members. Moving the code focuses QCoreApplication::postEvent() on its primary task, posting of the event (adding to the event list, waking up the event dispatcher). It's also easier to reason about how the action of deleteLater on an object relates to the event loop and scope level when the information is resolved up front. Task-number: QTBUG-120124 Change-Id: If38f601ff653111763004b98915b01ffe8ddc837 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add dedicated child and parent events for QWindow reparentingTor Arne Vestbø2023-11-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | When a QWindow is parented into another window, either via its constructor, or via setParent(), we also update the QObject parent of the window. This in turn sends ChildAdded and ChildRemoved events to the new and old parent of the window, as well as ParentAboutToChange and ParentChange to the window itself. But at the point when these events are sent, the QWindow parent relationship has not been fully established. We have not updated d->parentWindow, nor have we propagated the parent relationship to the platform window. This is problematic because clients can not use these events to react to window parent changes synchronously. For example. trying to raise a child window when added to a parent is not going to work, because at that point the child window isn't a native child of the parent. Instead of re-using the QObject events for QWindow, like QWidget does, by delaying the events or sending them manually at a point when the window parent relationship has been fully formed, we opt to add new dedicated events. Change-Id: I019c14eba444861f537e4f68ab3a82297f843cf7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Doc: Mark QEvent::DevicePixelRatioChange as new in 6.6Kai Köhne2023-09-101-1/+2
| | | | | | | Fixes: QTBUG-116872 Pick-to: 6.6 Change-Id: I5094a0c0f3deed1e4f6b59e577367c220be8774e Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Allow QObjects to opt in to receiving ParentAboutToChange/ParentChangeTor Arne Vestbø2023-08-301-2/+4
| | | | | | | | | | | | | | | | | | | QWidget already handles this, but it might be useful for non-Widget object hierarchies as well, such as in Qt Quick. The flag is opt in, and as QWidget already handles these events by itself (without checking any flags), we assert that we don't end up in this code path, instead of enabling it for QWidget. The latter would mean refactoring the QWidget code, with possible regressions. Docs and header comments have been updated to reflect that this event is not widget specific. (This is an issue with other events as well, that are documented to say "widget", since they came from a time when there was only QWidget, but nowadays apply to e.g. QWindow as well. That's something for another fix though). Change-Id: Ib71962131d6011c17dcce8c01bd8adcdaa58d798 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QThreadPipe & QEvent: use a simpler atomic operationThiago Macieira2023-07-241-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This causes modern compilers (i.e., not MSVC) to emit a single bit-test-and-set instruction instead of a cmpxchg. It's still an atomic operation, so it's not that much faster (if at all), but it has simpler encoding. Previous: 000000000026bca0 <QEventDispatcherUNIX::wakeUp()>: 26bca0: mov 0x8(%rdi),%rdx 26bca4: xor %eax,%eax 26bca6: mov $0x1,%ecx 26bcab: lock cmpxchg %ecx,0x98(%rdx) 26bcb3: jne 26bcc5 <QEventDispatcherUNIX::wakeUp()+0x25> 26bcb5: mov 0x90(%rdx),%edi 26bcbb: mov $0x1,%esi 26bcc0: jmp c01d0 <eventfd_write@plt> 26bcc5: ret Now: 26b3a0: mov 0x8(%rdi),%rax 26b3a4: lock btsl $0x0,0x98(%rax) 26b3ad: jae 26b3b0 <QEventDispatcherUNIX::wakeUp()+0x10> 26b3af: ret 26b3b0: mov 0x90(%rax),%edi 26b3b6: mov $0x1,%esi 26b3bb: jmp c11d0 <eventfd_write@plt> Change-Id: I53335f845a1345299031fffd176fa8ac1de3ad13 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix sending deferred delete events when posted before outermost loopMikolaj Boc2023-06-091-9/+1
| | | | | | | | | | | | | | | | | | | | | QDeferredDeleteEvent has the loopLevel field, which is a sum of scope and loop levels found at posting. In sendPostedEvents however, it is impossible to only use this information to find delete events posted before the outermost loop (which should be handled by any loop) based solely on this information, as the scope level essentialy removes the information on loop level. Break the loopLevel in two, storing both loop and scope levels in QDeferredDeleteEvent, so that we can check whether an event was posted before the outermost event loop (for which we need to compare only the loop level). QDeferredDeleteEvent was also made private as it should - it is an implementation detail that wasn't hidden properly. Change-Id: I0a607a0bd3a2deb5024acad67f740dbf4338574c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
* Introduce events for Window device pixel ratio changesDavid Edmundson2023-02-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | There is a mix between screen device pixel ratio. Currently we store the property on a per-window basis, but the change notifications are still on a per screen basis which can fall apart on edge cases. On wayland we are getting per window DPR changes without as useful screen change events so it's important to fix. It also has potential to clean up the Windows backend in the future where the backend is currently papering over the two concepts. This patch introduces two new events: A QWindowSystemInterface to trigger a window DPR change independently of a screen change. An event to notify windows the new DPR rather than needing to track signals on the screen. This happens either when the window dpr changes or implicitly through a screen change. This can deprecate an existing event ScreenChangeInternal so the value is reused and renamed for clarity. Change-Id: I637a07fd4520ba3184ccc2c987c29d8d23a65ad3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Trace: Convert qtcore module to use tracepointgen toolAntti Määttä2023-02-101-0/+3
| | | | | | | | Pick-to: 6.5 Change-Id: I379896280a16cd0b94d7ee9d0cfcca4afe64b9fe Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
* Add tracing metadata to QEvent and QImageFormatAntti Määttä2023-01-131-1/+1
| | | | | | | | | | | Modify qtcore and qtwidgets to use the new tracing metadata features. This allows showing the event types and image formats used in traces as text instead of just numbers. Task-number: QTBUG-106399 Pick-to: 6.5 Change-Id: I267d03a696dc95e8b1d36657d7339dd09d92de3b Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
* Convert Since ... comments on \value lines to [since ...] parametersEdward Welbourne2022-05-311-3/+3
| | | | | | | | The \value command supports a [since ...] parameter. We might as well use it, to standardize how we document when enum members were added. Change-Id: I68a101e8101f780d0e6607a63723aa1bd837bb56 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-39/+3
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QEvent: start to de-inline copy ctor and clone() of all subclassesMarc Mutz2022-04-141-23/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's no advantage to them being inline: Absent de-virtualisation, clone() is only supposed to be called through the vtable, and the copy ctor is only supposed to be used in the implementation of clone(). And when the compiler de-virtualises, we don't want the code duplication associated with inlining. Enforce this by introducing new macros to hide the boilerplate. This fixes missing out-of-line dtors in: - QSinglePointEvent - QApplicationStateChangeEvent - QFutureCallOutEvent Wrong covariant return in: - QFutureCallOutEvent And missing clone() reimplementations in: - QCloseEvent - QIconDragEvent - QShowEvent - QHideEvent - QDragEnterEvent - QDragLeaveEvent While these don't carry extra data or members, a dynamic_cast of the result of clone() as well as using the expected covariant return value would fail: QShowEvent *e = ~~~; QShowEvent *e2 = e->clone(); // ERROR: converting QEvent* to QShowEvent* Check that reimplementing clone() is binary compatible (covariant returns may change the numerical pointer value returned, cf. https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B). The copy-assignment operator stays inline for the time being, as the goal is to = delete it in the future. This patch covers, roughly, QtCore and QtGui. [ChangeLog][QtGui][QEvent subclasses] Fixed missing clone() reimplementations on QCloseEvent, QIconDragEvent, QShowEvent, QHideEvent, QDragEnterEvent, and QDragLeaveEvent. Task-number: QTBUG-45582 Task-number: QTBUG-97601 Change-Id: Ib8a0519dbe85a7a8da61050d48be338004dfa69a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Apply Q_CONSTINIT across the codebaseMarc Mutz2022-03-291-1/+1
| | | | | | | | | Still not complete. Just grepping for static and thread_local. Task-number: QTBUG-100486 Change-Id: I90ca14e8db3a95590ecde5f89924cf6fcc9755a3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Compose render-to-texture widgets through QRhiLaszlo Agocs2022-03-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QPlatformTextureList holds a QRhiTexture instead of GLuint. A QPlatformBackingStore now optionally can own a QRhi and a QRhiSwapChain for the associated window. Non-GL rendering must use this QRhi everywhere, whereas GL (QOpenGLWidget) can choose to still rely on resource sharing between contexts. A widget tells that it wants QRhi and the desired configuration in a new virtual function in QWidgetPrivate returning a QPlatformBackingStoreRhiConfig. This is evaluated (among a top-level's all children) upon create() before creating the repaint manager and the QWidgetWindow. In QOpenGLWidget what do request is obvious: it will request an OpenGL-based QRhi. QQuickWidget (or a potential future QRhiWidget) will be more interesting: it needs to honor the standard Qt Quick env.vars. and QQuickWindow APIs (or, in whatever way the user configured the QRhiWidget), and so will set up the config struct accordingly. In addition, the rhiconfig and surface type is (re)evaluated when (re)parenting a widget to a new tlw. If needed, this will now trigger a destroy - create on the tlw. This should be be safe to do in setParent. When multiple child widgets report an enabled rhiconfig, the first one (the first child encountered) wins. So e.g. attempting to have a QOpenGLWidget and a Vulkan-based QQuickWidget in the same top-level window will fail one of the widgets (it likely won't render). RasterGLSurface is no longer used by widgets. Rather, the appropriate surface type is chosen. The rhi support in the backingstore is usable without widgets as well. To make rhiFlush() functional, one needs to call setRhiConfig() after creating the QBackingStore. (like QWidget does to top-level windows) Most of the QT_NO_OPENGL ifdefs are eliminated all over the place. Everything with QRhi is unconditional code at compile time, except the actual initialization. Having to plumb the widget tlw's shareContext (or, now, the QRhi) through QWindowPrivate is no longer needed. The old approach does not scale: to implement composeAndFlush (now rhiFlush) we need more than just a QRhi object, and this way we no longer pollute everything starting from the widget level (QWidget's topextra -> QWidgetWindow -> QWindowPrivate) just to send data around. The BackingStoreOpenGLSupport interface and the QtGui - QtOpenGL split is all gone. Instead, there is a QBackingStoreDefaultCompositor in QtGui which is what the default implementations of composeAndFlush and toTexture call. (overriding composeAndFlush and co. f.ex. in eglfs should continue working mostly as-is, apart from adapting to the texture list changes and getting the native OpenGL texture id out of the QRhiTexture) As QQuickWidget is way too complicated to just port as-is, an rhi manual test (rhiwidget) is introduced as a first step, in ordewr to exercise a simple, custom render-to-texture widget that does something using a (not necessarily OpenGL-backed) QRhi and acts as fully functional QWidget (modeled after QOpenGLWidget). This can also form the foundation of a potential future QRhiWidget. It is also possible to force the QRhi-based flushing always, regardless of the presence of render-to-texture widgets. To exercise this, set the env.var. QT_WIDGETS_RHI=1. This picks a platform-specific default, and can be overridden with QT_WIDGETS_RHI_BACKEND. (in sync with Qt Quick) This can eventually be extended to query the platform plugin as well to check if the platform plugin prefers to always do flushes with a 3D API. QOpenGLWidget should work like before from the user's perspective, while internally it has to do some things differently to play nice and prevent regressions with the new rendering architecture. To exercise this better, the qopenglwidget example gets a new tab-based view (that could perhaps replace the example's main window later on?). The openglwidget manual test is made compatible with Qt 6, and gets a counterpart in form of the dockedopenglwidget manual test, which is a modified version of the cube example that features dock widgets. This is relevant in particular because render-to-texture widgets within a QDockWidget has its own specific quirks, with logic taking this into account, hence testing is essential. For existing applications there are two important consequences with this patch in place: - Once the rhi-based composition is enabled, it stays active for the lifetime of the top-level window. - Dynamically creating and parenting the first render-to-texture widget to an already created tlw will destroy and recreate the tlw (and the underlying window). The visible effects of this depend on the platform. (e.g. the window may disappear and reappear on some, whereas with other windowing systems it is not noticeable at all - this is not really different from similar situtions with reparenting or when moving windows between screens, so should be acceptable in practice) - On iOS raster windows are flushed with Metal (and rhi) from now on (previously this was through OpenGL by making flush() call composeAndFlush(). Change-Id: Id05bd0f7a26fa845f8b7ad8eedda3b0e78ab7a4e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QEvent: initialize the static userEventTypeRegistry constexprlyThiago Macieira2022-01-291-1/+3
| | | | | | | | The {} is the difference. Pick-to: 5.15 6.2 6.3 Change-Id: I6fcda969a9e9427198bffffd16ce8dabd213393e Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* corelib: Fix typos in documentationJonas Kvinge2021-10-121-2/+2
| | | | | | Pick-to: 5.15 6.2 Change-Id: I64d63af708bc6ddaabd12450eb3089e5077f849e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Add QEvent::Quit to the list of enum valuesVenugopal Shivashankar2021-07-011-0/+1
| | | | | | Fixes: QTBUG-92122 Change-Id: I3d23c9ea50011bb6f8fdaba8aed7c940300813ed Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add missing since to QEvent::copy docsNicolas Fella2021-01-191-0/+1
| | | | | | Pick-to: 6.0 Change-Id: Idfadc1801b0e97a5030d2784a65ae658900efd12 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Disable copying and assigning of QEventVolker Hilsheimer2020-11-191-2/+2
| | | | | | | | | | | | | | 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>
* Allow cloning of event objectsVolker Hilsheimer2020-11-171-0/+5
| | | | | | | | | | | | 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>
* Drop the d-pointer of QEventVolker Hilsheimer2020-11-121-2/+0
| | | | | | | | | | | | | It's not been used ever since it was added in the Qt 2 days, other than a hack in QGraphicsView that could be solved more elegantly. With this change, QEvent is only 16 bytes large, which is nicely aligned with C++'s default operator new alignment, and we still have plenty of bits (plus an unused bool) left for extensions. Change-Id: If9376d90b92983db7fc12575f3893064a1797adf Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Clean up and pack data members of QEvent classesVolker Hilsheimer2020-11-121-27/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Doc: Add missing brief statements for \property documentationTopi Reinio2020-11-121-1/+1
| | | | | | | | ... where applicable. Fixes: QTBUG-88232 Change-Id: I835df434765caededd35d5114965b4a1663e7942 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix QGraphicsView's abuse of QEvent's d-pointer in Leave event handlingVolker Hilsheimer2020-11-111-0/+1
| | | | | | | | | | | | | | QGraphicsSceneEvent carries a widget pointer, and we can add a new event type. Assert that QGraphicsScene doesn't get Leave events from elsewhere. This was the only "usage" of QEvent's d-pointer in Qt, so with this gone we can reduce the size of QEvent by 8 bytes. Change-Id: I0513daf742de9084d0469d55b7a7f41b667e8081 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Rename remaining QEvent variables to m_ convention; init m_reservedShawn Rutledge2020-11-101-7/+9
| | | | | Change-Id: I08694657b7c9d2713d0cb33519698dbba3bfdffa Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Introduce QEvent::isSinglePointEvent()Shawn Rutledge2020-11-071-2/+20
| | | | | | | | | | | | This makes high-level event dispatching easier: for example we often need to cast an event to access getters like button() and buttons(). We can so far assume that any QPointerEvent that is not a QTouchEvent is a QSinglePointEvent; but more explicit type-checking looks safer. Implemented in a similar way as c7f727996909338c3689396160f3060480521846. Change-Id: I980d759e2a7538b6b30fd3bdc3be0c351ec6c246 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make QEvent::setAccepted() virtual; set QEventPoints state the sameShawn Rutledge2020-10-221-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | In Qt Quick, when we deliver an item-specific QTouchEvent that contains only the subset of eventpoints that are inside the Item's bounds, traditionally the Item can accept the event to tell the delivery logic that the event is handled and doesn't need to be delivered further. But an Item cannot be expected to have total scene awareness; so now, the delivery is "done" only when all eventpoints in the original event are accepted. This behavior has been working well enough already due to logic in QQuickWindow that iterates the points and accepts them if the event is accepted; but it seems appropriate to move this enforcement into QPointerEvent itself. Making setAccepted() virtual gives us a useful degree of freedom. Event-handling code should alternatively use QEventPoint:setAccepted() or QPointerEvent::setExclusiveGrabber() to take resonsibility for only a subset of the touchpoints. Another way to put it is that we treat QPointerEvent::setAccepted() as a convenience method: accepting the QEventPoints is what counts (at least in Qt Quick). Change-Id: Icec42dc980f407bb5116f5c0852c051a4521105a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QEvent copy constructor: copy the type flags tooShawn Rutledge2020-10-211-6/+3
| | | | | | | | | | | | | Failure to copy m_inputEvent and m_pointerEvent actually left them uninitialized, and resulted in random behavior in Qt Quick when Flickable clones a pointer event for later replay. Remove the comment about copying events being a "bad idea" in Qt 4, while we're at it. Copying became more common in Qt 5, and we probably won't be able to stop doing it now. Change-Id: I40b6ba5ad696e7aaafbeefbca86eca00cab40616 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* macOS: Remove dead event type MacGLClearDrawableTor Arne Vestbø2020-10-061-1/+0
| | | | | Change-Id: If35f3e2a67b94e403210c564bf337b54d621f8c5 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Introduce QWindow::paintEvent with QPA plumbingTor Arne Vestbø2020-08-261-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The explicit paint event on QtGui and QPA level allows us to untangle the expose event, which today has at least 3 different meanings. It also allows us to follow the platform more closely in its semantics of when painting can happen. On some platforms a paint can come in before a window is exposed, e.g. to prepare the first frame. On others a paint can come in after a window has been de-exposed, to save a snapshot of the window for use in an application switcher or similar. The expose keeps its semantics of being a barrier signaling that the application can now render at will, for example in a threaded render loop. There are two compatibility code paths in this patch: 1. For platform plugins that do not yet report the PaintEvents capability, QtGui will synthesize paint events on the platform's behalf, based on the existing expose events coming from the platform. 2. For applications that do not yet implement paintEvent, QtGui will send expose events instead, ensuring the same behavior as before. For now none of the platform plugins deliver paint events natively, so the first compatibility code path is always active. Task-numnber: QTBUG-82676 Change-Id: I0fbe0d4cf451d6a1f07f5eab8d376a6c8a53ce8c Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Introduce QEvent::isPointerEvent()Shawn Rutledge2020-08-251-2/+19
| | | | | | | | | | This makes high-level event dispatching easier: for example in Qt Quick, all pointer events should eventually be delivered to items in a similar way. Implemented in a similar way as d1111632e29124531d5b4512e0492314caaae396. Change-Id: I2f0c4914bab228162f3b932dda8a88051ec2a4d7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Introduce QEvent::isInputEventVolker Hilsheimer2020-08-171-1/+17
| | | | | | | | | | | | | This makes it easier to reliably maintain input-event related states in widgets, in particluar the state of keyboard modifiers. Instead of testing for all possible event types, code can just test the flag before safely static_cast'ing to QInputEvent to access the modifiers. Simplify the code in QAbstractItemView accordingly. Task-number: QTBUG-73829 Change-Id: Idc7c08e2f3f1e8844f5c6693c195153038ee6490 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-1/+1
| | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Port from QAtomic::load() to loadRelaxed()Giuseppe D'Angelo2019-06-201-3/+3
| | | | | | | | | | | | | | | Semi-automated, just needed ~20 manual fixes: $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)load\(\)/$1loadRelaxed\(\)/g' -i \{\} + $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)store\(/$1storeRelaxed\(/g' -i \{\} + It can be easily improved (e.g. for store check that there are no commas after the opening parens). The most common offender is QLibrary::load, and some code using std::atomic directly. Change-Id: I07c38a3c8ed32c924ef4999e85c7e45cf48f0f6c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Replace Q_DECL_NOEXCEPT with noexcept in corelibAllan Sandfeld Jensen2019-04-031-4/+4
| | | | | | | In preparation of Qt6 move away from pre-C++11 macros. Change-Id: I44126693c20c18eca5620caab4f7e746218e0ce3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge branch '5.11' into devEdward Welbourne2018-07-311-0/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/library/qmakebuiltins.cpp src/plugins/platforms/windows/qwindowstabletsupport.h src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/widgets/styles/qstylesheetstyle.cpp tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp Done-With: Gatis Paeglis <gatis.paeglis@qt.io> Change-Id: I000b0eb3cea2a5c7a99b95732bfdd41507cf916e
| * Doc: Extend description of ShortcutOverride eventPaul Wicking2018-07-191-0/+6
| | | | | | | | | | | | | | | | | | | | Better late than never. Task-number: QTBUG-533 Change-Id: Ieb68d510f75553a6aa0a6e9046c11e3a34b8815f Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Tracepoints: add tracing for QEventsGiuseppe D'Angelo2018-06-281-1/+7
|/ | | | | | | | | | | | | | | | | | | Add tracepoints in all the main codepaths for event handling: * QEvent ctors/dtor * QCoreApplication::postEvent, sendEvent and sendSpontaneousEvent * QCoreApplication / QApplication::notify, and around the handling of event filters as well I'm switching the name of the tracepoints themselves to have the very same casing of the functions in Qt's own source code, this improves readability a lot. The pre-existing ones will be changed in an upcoming patch. Change-Id: Iae2ba2bfdd76a82c85445bb5b86434e910427a70 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
* document that QueryWhatsThis is a QHelpEventSergio Martins2018-03-111-1/+1
| | | | | Change-Id: I4240c32287530df6162c07a27b865fb4176103db Reviewed-by: Martin Smith <martin.smith@qt.io>
* Documentation: Add missing event type for non-client mouse eventsKrzysztof Kawa2017-10-071-4/+4
| | | | | | | | | | Documentation is missing the specialized event type names in the non-client mouse event enum description. Task-number: QTBUG-55018 Change-Id: Ica35994e13fc9a637a52eeca361898f8669fdbd1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* QtCore: include mocsThiago Macieira2017-05-051-0/+2
| | | | | | | | | | | | | | | | | | | Compilation and link times in CPU seconds with GCC 7, using precompiled headers (not including moc, rcc, uic, etc. steps or headersclean): Before After Debug -O0 198,1 180,3 Debug -Og 240,7 229,2 Release -O3 267,1 249,2 Release LTO 239,4 229,8 QtCore required a little manual adjusting because some files are bootstrapped into moc itself and into qmake. Change-Id: I84e363d735b443cb9beefffd14b8b57c10e7da36 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Add documentation for TabletTrackingChange enum valueShawn Rutledge2017-03-271-0/+1
| | | | | | | | Amends 6aaf8532222759226a9b406bfe6c57787236cbf1 Change-Id: I2c264db235ea552ce6b4eb003d7daeeb2cecde6f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Doc: Remove references to Windows CE in Qt CoreVenugopal Shivashankar2016-08-231-1/+1
| | | | | | | | The platform is not supported since Qt 5.7 Task-number: QTBUG-55331 Change-Id: I98b90d574d9a76c4281852d93818620b5f489117 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-131-2/+2
|\ | | | | | | | | | | | | | | | | | | 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-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Fix some documentation warnings.Friedemann Kleint2016-03-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qtbase/src/corelib/io/qnoncontiguousbytedevice.cpp:87: warning: Cannot find 'atEnd(...)' in '\fn' virtual bool QNonContiguousByteDevice::atEnd() qtbase/src/corelib/io/qnoncontiguousbytedevice.cpp:107: warning: Cannot find 'size(...)' in '\fn' virtual qint64 QNonContiguousByteDevice::size() qtbase/src/corelib/io/qsettings.cpp:2387: warning: Unexpected '\endlist' qtbase/src/corelib/kernel/qcoreevent.cpp:90: warning: Undocumented enum item 'Pointer' in QEvent::Type qtbase/src/corelib/kernel/qmetaobject.cpp:346: warning: No documentation for 'QMetaObject::inherits(const QMetaObject *metaObject)' qtbase/src/corelib/statemachine/qsignaltransition.cpp:154: warning: No such parameter 'sourceSate' in QSignalTransition::QSignalTransition() qtbase/src/corelib/global/qglobal.cpp:945: warning: Undocumented parameter 'memberFunctionPointer' in qConstOverload() qtbase/src/corelib/global/qglobal.cpp:956: warning: Undocumented parameter 'memberFunctionPointer' in qNonConstOverload() qtbase/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc:519: warning: Command '\snippet (//! [96])' failed at end of file 'code/doc_src_stylesheet.cpp' Change-Id: I7da69b9b535f484e10ca030dbf64b6007dce0df3 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Add Intel copyright to files that Intel has had non-trivial contributionThiago Macieira2016-01-211-0/+1
| | | | | | | | | | | | | | | | | | I wrote a script to help find the files, but I reviewed the contributions manually to be sure I wasn't claiming copyright for search & replace, adding Q_DECL_NOTHROW or adding "We mean it" headers. Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842 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: added QQuickItem also uses UngrabMouseNico Vertriest2015-11-301-1/+1
| | | | | | Task-number: QTBUG-37311 Change-Id: I8beac262d92ddb16c225da65aa8a3f80da59074f Reviewed-by: Michael Brasser <michael.brasser@live.com>