summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidgetrepaintmanager.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Decouple rate-limiting of paint-on-screen widgets from top level widgetTor Arne Vestbø2024-04-041-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As part of eacd58d4e78e7238ba5fcca90ba960aaf3ebd263, a mechanism was added to prevent posting redundant UpdateRequest events to the top level widget, managed by QWidgetRepaintManager. The mechanism relied on a boolean that was set when posting an update request event, and reset when processing the event for the top level widget, as part of QWidgetRepaintManager::sync(). However, for paint-on-screen widgets, we don't post an update request to the top level, we post it to the paint-on-screen widget directly. And when processing that event, we don't paint the widget though the normal QWidgetRepaintManager machinery, but instead call the paint event via QWidgetPrivate::paintOnScreen(). As a result, an update() on a paint-on-screen widget would result in never receiving updates for non-paint-on-screen widgets, as we assumed there was no reason to send further update requests. We could fix this by clearing the updateRequestSent flag as part of the paintOnScreen() code path, but that's incorrect as the flag represents whether the top level QWidgetRepaintManager needs an update request event or not, and would lead to missed updates to normal widgets until the paint-on-screen widget finishes its update. Instead, we only set updateRequestSent if we're posting update requests for non-paint-on-screen widgets, which in practice means the top level widget. The paint on screen logic in QWidgetRepaintManager::markDirty still takes care of rate-limiting the update requests to the paint-on-screen widget, by comparing the dirty area of the widget. There is definite room for improvement here, especially in the direction of handling update requests via QWindow::requestUpdate instead of manually posted events, but for now this will have to do. Fixes: QTBUG-80167 Pick-to: 6.7 6.6 6.5 6.2 5.15 Change-Id: Ib5685de7ca2fd7cd7883a25bb7bc0255ea242d30 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Remove QWindowPrivate::compositingTor Arne Vestbø2024-03-011-2/+0
| | | | | | | | | | | It was added for Android in a4f50269f82695fbd0dd344f87b4b355feff4333, for the case of QSurface::RasterGLSurface, but since 6.4 we no longer use QSurface::RasterGLSurface for composition. And the Android usage was removed in 2020ce5fd2478389c56f34742fdeee9cd24ca8a5. Pick-to: 6.7 6.6 6.5 Change-Id: I8dafe959c54e09b3a974253e15d184365141d559 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QWidgetRepaintManager: Use textureChildSeen to determine deferred updateTor Arne Vestbø2024-02-271-3/+3
| | | | | | | | | | | | We want to get rid of the QWindowPrivate::compositing member, as it is no longer needed for the Android backingstore, which it was first added for in a4f50269f82695fbd0dd344f87b4b355feff4333. We can use textureChildSeen instead to check if we're compositing. Pick-to: 6.7 Change-Id: If85b21f92c8253bf89543a7e81e03730023f8095 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Add QPlatformIntegration::BackingStoreStaticContents capabilityTor Arne Vestbø2024-02-131-5/+3
| | | | | | | | | | | | | | This was a feature in Qt 4, but the only platform that carried it over to Qt 5 was Windows, in ab76593f18396e693f24066592244ca95e135ea2, and that's still the situation. As a first step in possibly implementing this on more platforms, lets replace the hard-coded check in QWidgetRepaintManager::hasStaticContents with a proper QPlatformIntegration capability check in the only call site. Pick-to: 6.7 Change-Id: I2067109f45116cd8c62facf7224cd748f19e845b Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QWidgetRepaintManager: port Q_FOREACH to ranged-forAhmad Samir2023-10-131-3/+1
| | | | | | | | | | | | | The loop body doesn't change the QHash, so use asKeyValueRange() and ranged-for. Un-blacklist the file, by removing "#undef QT_NO_FOREACH", and removing the source file from NO_PCH_SOURCES. Task-number: QTBUG-115803 Change-Id: I22924d2addeed75867edf9f6cac53f1c6f266dcc Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Mark QtWidgets as free of Q_FOREACH, except where it isn'tMarc Mutz2023-08-091-0/+1
| | | | | | | | | | | | | | | | | | The density of Q_FOREACH uses is high here, too high for this author to tackle in a short amount of time. But they're concentrated in just a few TUs, so pick a different strategy: Mark the whole library with QT_NO_FOREACH, to prevent new uses from creeping in, and whitelist the affected TUs by #undef'ing QT_NO_FOREACH locally, at the top of each file. For TUs that are part of a larger executable, this requires these files to be compiled separately, so add them to NO_PCH_SOURCES (which implies NO_UNITY_BUILD_SOURCES, too). Created QTBUG-115803 to keep track of this. Task-number: QTBUG-115803 Change-Id: Ib5d6192632d98bdcc6625a9a14e05d13bb7f759b Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Refine the rhi-based flush logicLaszlo Agocs2023-06-011-1/+30
| | | | | | | | | | | | Amends 244daf4cfc44587c8c7c87e481688e840cc21c77 Fixes: QTBUG-113557 Fixes: QTBUG-113652 Task-number: QTBUG-108277 Pick-to: 6.5 Change-Id: I9e369b0e1261ea37eb2dedd80083f82f5df97b30 Reviewed-by: Andy Nichols <andy.nichols@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Handle device loss for texture widgetsDavid Redondo2023-03-171-0/+4
| | | | | | | | | | | | Previously the widget stayed black and we printed "QBackingStoreDefaultCompositor: the QRhi has changed unexpectedly, this should not happen". To make it work the compositor is recreated in addition to the rhi and the widgets are informed with the internal events. Change-Id: I982d08bd3530478fe0f827080154c008a92a812e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add support for stereoscopic content in QOpenGLWidgetKristoffer Skau2022-11-281-1/+2
| | | | | | | | | | | | | | | | | Need to add the plumbing necessary to support two textures in QOpenGLWidget and use these in the backing store. The changes required on the RHI level is already done in an earlier patch. Then paintGL() needs to be called twice, once for each buffer. Also add overloads for the other functions of QOopenGLWidget where it makes sense to query for left or right buffer. Then finally create an example. [ChangeLog][Widgets][QOpenGLWidget] Added support for stereoscopic rendering. Fixes: QTBUG-64587 Change-Id: I5a5c53506dcf8a56442097290dceb7eb730d50ce Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix rhi flush eval perf. and native window problemsLaszlo Agocs2022-11-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This effectively reverts a4a51f6a641f4bf0a863251d6d3e026d81de6280 while solving the problem that change intended to fix by an alternative approach: Swap the order of checks for rhi-based flushing. Checking the widgets' wishes first was a mistake. We should first check what is forced, e.g. via the env.vars. Then only move on investigating the child widget hierarchy if there was nothing specific requested. This way having a QOpenGLWidget in a window and running with QT_WIDGETS_RHI=1 QT_WIDGETS_RHI_BACKEND=vulkan will prioritize the forced request (Vulkan) and so the QOpenGLWidget will gracefully not render anything while printing the expected warning to tell what's going on. The expensive recursion plaguing the construction of larger widget hierarchies is now avoided, that should no longer take seconds due to walking the entire widget hierarchy of the top-level window every time a new widget is added to it. However, this then uncovered a set of problems concerning native child widgets. The repaint manager seems to have an obvious mistake where the usage of rhi (and so textures and whatnot) is decided based on 'widget' (which is either a top-level or a native child) instead of 'tlw' (which is the top-level with the backingstore). The usesRhiFlush flag only really matters for a real top-level, not for native child widgets. The rhi-based flushing is tied to the backingstore, and the backingstore comes from the top-level widget. Finally, make the qopenglwidget autotest to actually exercise something when it comes to QOpenGLWidgets (or their ancestors) turned native. The original code from a long time ago does not really test native child widgets, because it turns the top-level into native which is quite superfluous since the toplevel is backed by a native window (and a backingstore) anyway. Pick-to: 6.4 Task-number: QTBUG-105017 Fixes: QTBUG-108344 Fixes: QTBUG-108277 Change-Id: I1785b0ca627cf151aad06a5489f63874d787f087 Reviewed-by: Andy Nichols <andy.nichols@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Port from container::count() and length() to size() - V5Marc Mutz2022-11-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that the on() matcher has been replaced by one that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache, to avoid porting calls that explicitly test count(). Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add missing repaintManager checkLaszlo Agocs2022-10-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This is likely a problem only after the 6.4 changes to move QQuickWidget composition from OpenGL to QRhi. Add an extra check to the condition when bailing out. In QWidgetPrivate (qwidget.cpp) all similar calls into the repaintManager are guarded by if (tlwExtra && tlwExtra->backingStore && tlwExtra->repaintManager) therefore it makes sense to perform the same check in the other file too. The assumption is that the check was not added here due to being outside of qwidget.cpp. Change-Id: Ic94d4e5153f4a194a997cd669b0f7c48c7932d97 Fixes: QTBUG-107166 Pick-to: 6.4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-111-1/+1
| | | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace, with manual unstaging of the actual definition and documentation in dist/, src/corelib/doc/ and src/corelib/global/. Task-number: QTBUG-99313 Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Replace qExchange with std::exchangeMarc Mutz2022-10-071-1/+1
| | | | | | | | | | | | | None of these users require C++20 constexpr or C++23 noexcept, the only remaining difference between std::exchange and qExchange. This leaves a single qExchange() user, in QScopedValueRollback, that requires the constexpr version, only available from C++20, and thus remains unported. Task-number: QTBUG-99313 Change-Id: Iea46f6ed61d6bd8a5b2fd9d9ec4d70c980b443a2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Port from container.count()/length() to size()Marc Mutz2022-10-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make rhiFlush() support custom source DPRMorten Sørvig2022-06-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | The rhiFlush() implementation currently assumes that QWindow->devicePixelRatio() is the correct scale factor for transforming device independent window geometry to source geometry. However, this assumption does not hold if/when we add support for drawing to a rounded-up DPR, with a downscale later in the rhiFlush implementation. Fix this by adding a sourceDevicePixelRatio argument to rhiFlush(), which is set to either QWindow::devicePixelRatio() or QWidget::devicePixelRatio(), depending on from where it is used. Change deviceRect() and friends in qbackingstoredefualtcompositor.cpp to be scale*() functions instead which take a scale factor instead of a QWindow. Update call sites to use srouceDevicePixelRatio where that makes sense. Pick-to: 6.4 Change-Id: Idb7b1e2f36816a201e00f0defe100d2dc079cb17 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Widgets: Use effect region bounds when drawing with repaint managerAntti Määttä2022-05-171-1/+2
| | | | | | | | | | | | When drawing widgets with graphics effect using repaint manager, if we do not combine the effect region some child widgets are not affected by the graphics effect since they are not included in the dirty region. However always using region bounds breaks the referenced bug use case. Fixes: QTBUG-102374 Pick-to: 6.3 6.2 5.15 Change-Id: Iaf4eaba34db863500a0600b344e5062f2b36b9bf Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | 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>
* QtWidgets: includemocs v2022Marc Mutz2022-04-291-0/+1
| | | | | | | | | | | | | | | This makes mocs_compilation.cpp empty again, removing those moc files that were added after the last sweep in 2016, 0e6ad275498dc8cc60a7d163bac9ed0add8e48d5. Including moc files directly into their classes' TU tends to improve codegen and enables extended compiler warnings, e.g. about unused private functions or fields. Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-102886 Change-Id: Iee35e82d18690469ad889f9b4a7394e706fe037d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Compose render-to-texture widgets through QRhiLaszlo Agocs2022-03-111-74/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Code tidies: improve variable naming and add const where possibleVolker Hilsheimer2021-12-081-19/+17
| | | | | | | | | Remove obsolete check for valid sourceRect, we never get into the accelerated code path if it's not. Pick-to: 6.2 Change-Id: I872685fca8cba3a09ed856d727d5baafddee161b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix incorrect rendering when moving widget into screenVolker Hilsheimer2021-12-081-1/+1
| | | | | | | | | | | | When the widget we are moving in was previously outside of its parent's clip rect, then we cannot use the accelerated move code path, as there are no pixels to bitBlt from the previous to the new area. Pick-to: 6.2 Task-number: QTBUG-26269 Task-number: QTBUG-98151 Change-Id: I324c6111de27cdd14cf8de8632a980aa351cc123 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Revert optimizations and fixes for moving/scrolling overlapped widgetsVolker Hilsheimer2021-12-071-80/+27
| | | | | | | | | | | | | | | | | This reverts the QtWidgets changes made in commits 22634e00794e72d68e7578e1962f9f2023870749 and 5b09346cf4322704a866f253b911d467c40df3ba while keeping the auto tests introduced in the former commit. Both commits introduced rendering errors when moving widgets out of or into areas in which they are obscured. Before we apply any further optimizations to this code we need thorough auto test coverage. Task-number: QTBUG-98151 Task-number: QTBUG-26269 Pick-to: 6.2 Change-Id: I9cb82b73776daed59ea0e9f51ff7ddef1c7265b6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Make sure we paint overlapped children and siblings when moving farVolker Hilsheimer2021-11-151-11/+13
| | | | | | | | | | | | | | | | | | | | In paintAndFlush, QWidgetRepaintManager subtracts opaque children if the target isn't overlapped and isMoved is set to true. So in moveRect, set isMoved to true after the blitting of movable areas, and reset it to false if we have overlapped sibling or child regions. Otherwise, moving so far that sourceRect is invalid (none of the original pixels are visible after the move) we end up in a code path that sets isMoved to true even with overlapping children or siblings, which then breaks paintAndFlush's assumptions. Reuse the test case written by Sergiy Korobov <tiamatenko@gmail.com> in earlier attempts to fix this bug. Fixes: QTBUG-26269 Pick-to: 6.2 Change-Id: If7443863f5eee79a80220cd587522122f42a21e4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Don't render widget to backing store if its parent has graphics effectAntti Määttä2021-10-191-1/+14
| | | | | | | | | | | | If widget parent has graphics effect, it can't render directly to the backing store, because the backing store needs to be updated from the parents effect drawing instead of the widget drawing. Pick-to: 6.2 5.15 Fixes: QTBUG-96240 Change-Id: Ib9b55547f9e5538f32837ec9df45d29fa68d7c1b Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Replace qt_make_unique with std::make_uniqueAllan Sandfeld Jensen2020-11-231-3/+1
| | | | | | | We can depend on C++14 now. Change-Id: Iee9796cd22dbfbb70d4bdb25f0eee1662a026d6d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Rename local variables masking parametersDimitrios Apostolou2020-07-101-6/+6
| | | | | | | As found by LGTM.com. Change-Id: I9a237899dc50009da5643c49c590f3b15bb817bf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use QList instead of QVector in widgetsJarek Kobus2020-07-021-8/+10
| | | | | | Task-number: QTBUG-84469 Change-Id: I3007734f8e4f164ece9dd8850ef007cbef9e12ef Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* widgets: Clarify backingstore resize logic by removing cruftTor Arne Vestbø2020-03-191-8/+6
| | | | | Change-Id: I0a449068a0d4557b7bd6581ddf71c590b72d76a1 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* widgets: Remove unused member QTLWExtra::inTopLevelResizeTor Arne Vestbø2020-03-191-11/+4
| | | | | | | | | It was introduced in Qt 4.4 (e150f6a6e619) to work around slow resizes on Windows and X11 due to excessive painting, but has since been removed when old dead code never ported to QPA was removed in a2337f79ffd229. Change-Id: Ic14e714a02edb4194a445a6bb0759b601799fdc6 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-8/+8
| | | | | | | | | | | 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>
* Fix some qdoc warnings in 5.14Friedemann Kleint2019-09-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mark QCalendarBackend as internal since it is in a private header and fix some issues in the QCalendar related classes. src/corelib/time/qcalendar.cpp:201: (qdoc) warning: clang found diagnostics parsing \fn int QCalendarBackend::daysInMonth(int month, int year) const error: incomplete type 'QCalendarBackend' named in nested name specifier (repeats) src/corelib/time/qdatetime.cpp:1426: (qdoc) warning: Unknown command '\override' (repeats) src/corelib/time/qcalendar.cpp:642: (qdoc) warning: Undocumented enum item 'Last' in QCalendar::System src/corelib/time/qcalendar.cpp:642: (qdoc) warning: Undocumented enum item 'User' in QCalendar::System src/corelib/time/qcalendar.cpp:744: (qdoc) warning: Undocumented parameter 'year' in QCalendar::isLeapYear() src/corelib/time/qcalendar.cpp:923: (qdoc) warning: Can't link to 'dateTimeString()' (repeats) src/corelib/time/qcalendar.cpp:893: (qdoc) warning: No such parameter 'year' in QCalendar::partsFromDate() src/corelib/time/qcalendar.cpp:893: (qdoc) warning: No such parameter 'month' in QCalendar::partsFromDate() src/corelib/time/qcalendar.cpp:893: (qdoc) warning: No such parameter 'day' in QCalendar::partsFromDate() src/corelib/time/qdatetime.cpp:1425: (qdoc) warning: Undocumented parameter 'nmonths' in QDate::addMonths() src/corelib/time/qdatetime.cpp:1467: (qdoc) warning: Undocumented parameter 'nyears' in QDate::addYears() src/corelib/statemachine/qstatemachine.cpp:2522: (qdoc) warning: Undocumented enum item 'StateMachineChildModeSetToParallelError' in QStateMachine::Error src/corelib/kernel/qtimer.cpp:602: (qdoc) warning: Undocumented parameter 'connectionType' in QTimer::callOnTimeout() src/corelib/time/qcalendar.cpp:159: (qdoc) warning: Undocumented parameter 'name' in QCalendarBackend::QCalendarBackend() src/corelib/time/qcalendar.cpp:159: (qdoc) warning: Undocumented parameter 'id' in QCalendarBackend::QCalendarBackend() src/corelib/time/qcalendar.cpp:529: (qdoc) warning: Can't link to 'registerCalendar()' src/corelib/time/qcalendar.cpp:529: (qdoc) warning: Can't link to 'fromName()' src/corelib/time/qcalendar.cpp:178: (qdoc) warning: Can't link to 'QCalendar::fromEnum()' src/corelib/time/qcalendar.cpp:405: (qdoc) warning: Undocumented parameter 'jd' in QCalendarBackend::dayOfWeek() src/corelib/time/qcalendar.cpp:405: (qdoc) warning: Can't link to 'weekDayName()' src/corelib/time/qcalendar.cpp:405: (qdoc) warning: Can't link to 'standaloneWeekDayName()' src/corelib/time/qcalendar.cpp:268: (qdoc) warning: Can't link to 'daysInMonth()' src/corelib/time/qcalendar.cpp:268: (qdoc) warning: Can't link to 'isLeapYear()' src/corelib/time/qcalendar.cpp:295: (qdoc) warning: Can't link to 'daysInMonth()' src/corelib/time/qcalendar.cpp:313: (qdoc) warning: Can't link to 'isLuniSolar()' src/corelib/time/qcalendar.cpp:313: (qdoc) warning: Can't link to 'isSolar()' src/corelib/time/qcalendar.cpp:313: (qdoc) warning: Can't link to 'isLunar()' src/corelib/time/qcalendar.cpp:340: (qdoc) warning: Can't link to 'daysInMonth()' src/corelib/time/qcalendar.cpp:357: (qdoc) warning: Can't link to 'daysInMonth()' src/corelib/time/qcalendar.cpp:544: (qdoc) warning: Can't link to 'fromName()' Change-Id: Ia2fabefb917f8e4cfa361044d9b754717276f4aa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* widgets: Mark widgets as needing flush during paintingTor Arne Vestbø2019-08-281-10/+2
| | | | | | | | | | | | | | | | Except for the case of syncing in response to an expose event, where the platform asked us to flush a specific region, we should strive to only flush parts that have been repainted. And we should flush those parts to their nearest native child, instead of unconditionally flushing the root/top level widget as well. By allowing drawWidget to schedule the flush we automatically flush the minimal region, to the right widgets. Change-Id: I73c143761d4a0da6991433b41dea0a0bc83a448a Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* widgets: Add logging for widget paintingTor Arne Vestbø2019-08-281-0/+24
| | | | | Change-Id: I551ec290812369e3848c1096fed7e813cd9e1cd6 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* widgets: Simplify QWidgetRepaintManager::flushTor Arne Vestbø2019-08-281-9/+4
| | | | | Change-Id: Icba88fa068aac2ac5d8bb04e46a3e3f34e279a48 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* widgets: Clarify QWidgetRepaintManager::sync of specific widgetTor Arne Vestbø2019-08-281-3/+6
| | | | | Change-Id: Ifa2a8245decfcb2b36c1952a39ec60b7eeca6e43 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* widgets: Rename QWidgetPrivate::repaint_sys to paintOnScreenTor Arne Vestbø2019-08-251-2/+2
| | | | | Change-Id: Ic853e42cbed9b770bef0e1d7c7376c861bceb891 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* widgets: Handle all flush tracking via markNeedsFlushTor Arne Vestbø2019-08-251-2/+5
| | | | | Change-Id: I3652c09012e36468ef90870637988b3fe8c5e735 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* widgets: Merge QWidgetRepaintManager::topLevelRect into callsiteTor Arne Vestbø2019-08-251-1/+1
| | | | | Change-Id: Ia9bb0c396b8175f644e337ca73086208c637ed2d Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* widgets: Remove unused QWidgetRepaintManager::dirtyRegionTor Arne Vestbø2019-08-251-50/+0
| | | | | | | It is no longer needed after qt_dirtyRegion was removed in e2a1fb901. Change-Id: I120df76b08808842b304cb8de10de23ccd0e2845 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* widgets: Clarify how widgets needing flush is trackedTor Arne Vestbø2019-08-251-13/+14
| | | | | Change-Id: Ia2c2c4b830e4441e50c66dd3fef5bc060f76551e Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* widgets: Clarify top level flush region in QWidgetRepaintManagerTor Arne Vestbø2019-08-251-8/+8
| | | | | Change-Id: I9a8d11569d33bf580bd50b710cf072952ea3626b Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* widgets: Use single return in QWidgetRepaintManager::markNeedsFlushTor Arne Vestbø2019-08-251-16/+11
| | | | | Change-Id: Ia21c5c57e4c642af2aa87b0539c4af51500a4827 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* widgets: Simplify QWidgetRepaintManager::syncTor Arne Vestbø2019-08-251-4/+2
| | | | | Change-Id: Ifd0cdcd7f4c03112fd93c24707e43273e211f688 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* widgets: Rename markDirtyOnScreen to markNeedsFlushTor Arne Vestbø2019-08-251-15/+15
| | | | | | | | Including renaming the member touched by this function. This leaves the logic for appendDirtyOnScreenWidget, which still needs investigating. Change-Id: I405a5e3757f0a79992f88d9f70867aeb7b9764d8 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* widgets: Share more code in appendDirtyOnScreenWidgetTor Arne Vestbø2019-08-251-16/+11
| | | | | Change-Id: I0ed936c7d8b004d498a8956b1ba246ade41ce43d Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* widgets: Class initialize QWidgetRepaintManager membersTor Arne Vestbø2019-08-251-5/+1
| | | | | Change-Id: Icc06ae8f5f542810d651e4834055cbcd1c1a4e2e Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* widgets: Rename a few missed uses of QWidgetRepaintManagerTor Arne Vestbø2019-08-251-10/+10
| | | | | Change-Id: Ie28d5dea6fdf1c8728a68d419b487bc5e3e3ee16 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* widgets: Merge QPlatformTextureListWatcher into implementation fileTor Arne Vestbø2019-08-251-34/+39
| | | | | | Change-Id: Icf177a5b559bd1c108a66ee14a51fb23cd36e083 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* widgets: Clean up and reorder QWidgetRepaintManager implementationTor Arne Vestbø2019-08-221-312/+392
| | | | | | | | Group functions by related areas and order them roughly by their flow in a normal app repaint cycle. Change-Id: I7a963f612134b3fdbaf748e0432606825b8db64e Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>