summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
Commit message (Collapse)AuthorAgeFilesLines
...
* | | widgets: Mark widgets as needing flush during paintingTor Arne Vestbø2019-08-282-15/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-284-1/+36
| | | | | | | | | | | | | | | Change-Id: I551ec290812369e3848c1096fed7e813cd9e1cd6 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | widgets: Simplify QWidgetRepaintManager::flushTor Arne Vestbø2019-08-282-10/+5
| | | | | | | | | | | | | | | Change-Id: Icba88fa068aac2ac5d8bb04e46a3e3f34e279a48 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | widgets: Simplify markNeedsFlush in QWidgetPrivate::drawWidgetTor Arne Vestbø2019-08-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | QWidgetRepaintManager::markNeedsFlush already ignores paintOnScreen widgets. Change-Id: I8b5d6f79c8fd60115f77d65aef05cc4baf840bdd 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>
* | | Merge remote-tracking branch 'origin/dev' into 5.14Liang Qi2019-08-274-21/+19
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/widgets/kernel/qwidget.cpp src/widgets/kernel/qwidget_p.h src/widgets/kernel/qwidgetrepaintmanager.cpp src/widgets/kernel/qwidgetwindow.cpp tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp Change-Id: Ifae457d0427be8e2465e474b055722e11b3b1e5c
| * | | QWidget: replace manual memory management with unique_ptr [6/N]: extraMarc Mutz2019-08-204-21/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Had to port a lot of caching temporaries, too. Decided to leave them as crefs to unique_ptr to catch any mischief users may be doing with the raw pointer instead (like deleting it). Also fixed a use of 0 as nullptr (by standardizing on pointer-to-bool conversion, as is done everywhere else in qwidget.cpp), and made one impregnable if condition readable. Change-Id: Ifdc240bf352c52de0bc3c186fa7a5f4cb2882dd0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
| * | | Get rid of QWidgetBackingStoreTrackerTor Arne Vestbø2019-08-194-152/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was added for Symbian almost 10 years ago (d7057e7c1f1a), for a somewhat dubious use-case. The Symbian code is since long gone (ae30d7141), so the remaining pieces are just adding complexity to the already intricate workings of the QtWidgets backingstore/painting logic. Task-number: QTBUG-8697 Change-Id: I82af610a8ac26719c588ac63f06b4501f59b400d Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | | widgets: Rename QWidgetPrivate::repaint_sys to paintOnScreenTor Arne Vestbø2019-08-254-12/+12
| | | | | | | | | | | | | | | | | | | | 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-252-3/+1
| | | | | | | | | | | | | | | | | | | | Change-Id: Ia9bb0c396b8175f644e337ca73086208c637ed2d Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | | widgets: Remove unused QWidgetRepaintManager::dirtyRegionTor Arne Vestbø2019-08-252-51/+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-252-15/+16
| | | | | | | | | | | | | | | | | | | | Change-Id: Ia2c2c4b830e4441e50c66dd3fef5bc060f76551e Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | | widgets: Clarify top level flush region in QWidgetRepaintManagerTor Arne Vestbø2019-08-252-9/+9
| | | | | | | | | | | | | | | | | | | | 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-253-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-252-17/+12
| | | | | | | | | | | | | | | | | | | | Change-Id: I0ed936c7d8b004d498a8956b1ba246ade41ce43d Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | | widgets: Class initialize QWidgetRepaintManager membersTor Arne Vestbø2019-08-252-11/+12
| | | | | | | | | | | | | | | | | | | | 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: Remove unused member in QWidgetRepaintManagerTor Arne Vestbø2019-08-251-1/+0
| | | | | | | | | | | | | | | | | | | | Change-Id: I2f7eac2916bdcd9101e96e78a3d7c3c6c395dde7 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | | widgets: Merge QPlatformTextureListWatcher into implementation fileTor Arne Vestbø2019-08-252-53/+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-223-438/+460
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | QWidget: two small fixesMarc Mutz2019-08-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Use QPointer::data() instead of a C-style cast - Remove an abuse of Q_UNLIKELY. Q_UNLIKELY is for error code. Using it for conditions that have a good chance of being true in normal operations just caused all the error handling code to be paged in needlessly. Change-Id: I542a5b938b032ca84f2cf1f78fbc45049a12ad1a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | | | widgets: Merge QWidgetRepaintManager::begin/endPaint into callsiteTor Arne Vestbø2019-08-222-24/+7
| | | | | | | | | | | | | | | | | | | | Change-Id: Iff5f78dcc8124bcecf53d42d920e74467937412a Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | | widgets: Rename QWidgetRepaintManager::doSync to paintAndFlushTor Arne Vestbø2019-08-222-4/+5
| | | | | | | | | | | | | | | | | | | | Change-Id: Ie41bb76d33d59f70eb418f845defc212396d3915 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | | widgets: Don't rely on QWidget friending QWidgetRepaintManagerTor Arne Vestbø2019-08-222-56/+55
| | | | | | | | | | | | | | | | | | | | Change-Id: Id9fc28eb62103d38eaa51261f61a2294db85e0d6 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | | widgets: Simplify QWidgetRepaintManager::qt_flushTor Arne Vestbø2019-08-222-90/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | No longer static, so we can access the members directly instead of passing them as arguments. Renamed to flush() while we're at it. Otherwise no changes to the code, just moved the function. Change-Id: Id491a8628c8cecf7cf3b33d3458e7427f5bcd22e Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | | Goodbye showYellowThingTor Arne Vestbø2019-08-223-206/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code hasn't been working for at least 5 years, and is just making the repaint manager more complex. We can always re-introduce the feature at a later point. Change-Id: Ib07c782c821f3e653f9452f6fbfe2f87effccc92 Fixes: QTBUG-36435 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | | Add screen() accessor to QWidgetFriedemann Kleint2019-08-214-3/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Base it on QWidgetPrivate::associatedScreen(), but make a larger effort to find a screen in case the widget is not shown yet. Rename QDesktopScreenWidget::screen() to something else to avoid clashes. Task-number: QTBUG-62094 Task-number: QTBUG-53022 Change-Id: I36ba5ef5f0645a4ac89da0b38a391f7057b2f49c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | | Remove dead code from Qt 4 timesTor Arne Vestbø2019-08-206-649/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The benefit of keeping this code around was to inspire or inform changes in the areas to take into account possibly missing features in Qt 5, but at this point that benefit is questionable. We can always use the history to learn about missing pieces if needed. Change-Id: I87a02dc451e9027be9b97554427bf8a1c6b2c025 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | | | widgets: Remove stale documentation of QWidgetRepaintManager::flushTor Arne Vestbø2019-08-201-1/+0
| | | | | | | | | | | | | | | | | | | | Change-Id: I5c4df4a8694bc56014beaec34a81219d91332fec Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | | widgets: Remove unused arguments from QWidgetRepaintManager::beginPaintTor Arne Vestbø2019-08-202-8/+3
| | | | | | | | | | | | | | | | | | | | Change-Id: I3720d8ef31e623e514fc2e382192d3c4f99fb4ed Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | | widgets: Remove unused function qt_dirtyRegionTor Arne Vestbø2019-08-203-19/+0
| | | | | | | | | | | | | | | | | | | | Change-Id: I7e6dbc4fb777a2323d65b73164d8645d6efc95a4 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | | widgets: Remove dead members from BeginPaintInfoTor Arne Vestbø2019-08-202-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The flags haven't been used since 2011 (6ce6b8a37) and is dead code. Change-Id: Ic5c47b30326ff70534bbf1aa37b25bae666b6b96 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | | Remove dead macOS specific code from QWidgetPaintManagerTor Arne Vestbø2019-08-201-12/+0
| | | | | | | | | | | | | | | | | | | | Change-Id: I8fdde17d32f20407aed44e4708f30db21555b81a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | | | Widgets: Simplify discardSyncRequestTor Arne Vestbø2019-08-202-9/+8
| | | | | | | | | | | | | | | | | | | | Change-Id: I3bc66a0f958fed44eac5fee6642ef1b00d45a2c4 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | | | Upgrade QWidgetPrivate::DrawWidgetFlag to QFlagsTor Arne Vestbø2019-08-203-13/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Allows for easier debugging of the paint cycle. Change-Id: Iab85bccb99198a02f33c0beeccd4e3914375358d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | | | Rename QWidgetBackingStore to QWidgetRepaintManagerTor Arne Vestbø2019-08-207-129/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Quoting a blog from 2009, "this class is responsible for figuring out which parts of the window surface needs to be updated prior to showing it to screen, so it's really a repaint manager." https://blog.qt.io/blog/2009/12/16/qt-graphics-and-performance-an-overview/ What better time to do the rename than 10 years later! Change-Id: Ibf3c3bc8c7df64ac03d72e1f71d296b62d832fee Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | | | Get rid of QWidgetBackingStoreTrackerTor Arne Vestbø2019-08-194-152/+13
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was added for Symbian almost 10 years ago (d7057e7c1f1a), for a somewhat dubious use-case. The Symbian code is since long gone (ae30d7141), so the remaining pieces are just adding complexity to the already intricate workings of the QtWidgets backingstore/painting logic. Task-number: QTBUG-8697 Change-Id: I82af610a8ac26719c588ac63f06b4501f59b400d Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit 2e0b0be2ce30394269559590b42c81de27301ee6) Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | | QWidgetBackingStore: clean up around dirtyOnScreenWidgetsMarc Mutz2019-08-172-50/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QVector dirtyOnScreenWidgets was aggregated by pointer, which makes no sense, as a QVector is just as large as a pointer (and even in Qt 6, when it will be larger, it's not going to be horrible). But this complicated the code quite a bit. Aggregate by value instead (it's just one of three such vectors now). Drive-by fixes: - use QVector::removeAll() instead of rolling your own - port two indexed loops to ranged ones. In the first case, it's safe, as the loop body clearly doesn't touch the iteratee (it's just a std::accumulate). In the second, the question no longer applies, as we're now using a consume loop. Change-Id: Icd4ac13bb4a6f9a783f0adf2fb6a5bdfacd1f91a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | | QWidget: unbreak QT_NO_OPENGL buildsMarc Mutz2019-08-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Amends 94d7603d5114eacaf648e0b0d2dcae5e161e0217. The port from QVector<QPlatformTextureList*> to a container of unique_ptr<QPlatformTextureList> uncovered that QPlatformTextureList isn't defined for QT_NO_OPENGL builds. Some unguarded forward-declarations made the old declaration compile by accident. The new code caught this, so add the #ifdef that had been missing all along. Change-Id: If3b14fc24007b1c917a41ab83343c2e5e65fc643 Reviewed-by: Martin Storsjö <martin@martin.st> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Tasuku Suzuki <tasuku.suzuki@qbc.io>
* | | QWidget: replace manual memory management with unique_ptr [5/N]: extra->topextraMarc Mutz2019-08-162-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is a bit frustrating that all the initialization and cleanup code are not in the QTLWExtra ctor and dtor. But that is for another patch. Change-Id: I0e45f89c1a53eb2f9a5699d3fbbef1a628b55432 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | QWidget: replace manual memory management with unique_ptr [4/N]: extra->cursMarc Mutz2019-08-162-14/+4
| | | | | | | | | | | | | | | | | | | | | Change-Id: Id65ead5563321b8edbe0055ad1531c2442d4d597 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | QWidget: replace manual memory management with unique_ptr [3/N]: ↵Marc Mutz2019-08-162-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | topextra->shareContext Despite the name, it's fully owned by an individual QWidget object. Also make the member mutable, so we can remove the const_cast hack in QWidgetPrivate::shareContext(), and protect QT_NO_OPENGL builds, since the naked pointer compiled by chance due to some unguarded forward declarations while a unique_ptr will somewhere want to call the dtor, which doesn't compile on an object of merely forward-declared type. Change-Id: If8027b55d303822236fcdc1a79e4f3010967b4d2 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | QWidget: replace manual memory management with unique_ptr [2/N]: topextra->iconMarc Mutz2019-08-142-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | I wonder whether a QIcon could be aggregated here by value, as it has a null state and its default ctor sets d = nullptr. Change-Id: I7a0f46e9fdd51a93afb5db768d46d93b08f307ec Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | QWidget: replace manual memory management with unique_ptr [1/N]: widgetTexturesMarc Mutz2019-08-143-14/+17
| | | | | | | | | | | | | | | | | | | | | | | | Use a vector<unique_ptr> (QVector cannot hold move-only classes), adapt to different API. Change-Id: Iece4b1bfcb35a02aac05935963e1e7f8c986b18d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-08-131-9/+15
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/win32-clang-msvc/qmake.conf src/corelib/tools/qlist.h src/gui/painting/qcompositionfunctions.cpp src/gui/painting/qtriangulator_p.h src/gui/text/qfontengine_p.h src/network/kernel/qhostinfo_p.h src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp Done-With: Allan Sandfeld Jensen <allan.jensen@qt.io> Change-Id: Ib8a0308cf77224c4fbdcf56778fdac4a43e37798
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-08-081-9/+15
| |\| | | | | | | | | | Change-Id: I4c0fd501db974fb8339944b8df845336776d80a9
| | * Don't rely on QWidget::internalWinId in QWidgetBackingStoreTor Arne Vestbø2019-08-071-9/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QWidget does not handle QWindow and QPlatformWindow being destroyed behind its back, and the QWidget state for internalWinId and the Qt::WA_WState_Created attribute can easily get out of sync with reality. To avoid QWidgetBackingStore mistakenly thinking that a widget does not have a platform window it can operate on we use the QWindow and QPlatformWindow handles directly, instead of relying on the winId. This is a stop gap until we can teach QWidget to deal with dynamic changes to its underlying window handles. Change-Id: Ib09bea2ad62c42e9667a20ca6b5faf0f957288da Fixes: QTBUG-74559 Reviewed-by: Lars Knoll <lars.knoll@qt.io>