summaryrefslogtreecommitdiffstats
path: root/src/widgets
Commit message (Collapse)AuthorAgeFilesLines
* Pass QDate, QTime as value classes, rather than by const referenceEdward Welbourne2019-08-303-62/+62
| | | | | | | | | This can, of course, only be done in private APIs - but comment on public APIs to do the same at Qt 6. Change-Id: I3c79951572be3c37b0b0c5b1b05bced051a40964 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QTree/TableView: Don't emit clicked when releasing after double clickVolker Hilsheimer2019-08-292-0/+2
| | | | | | | | | | | | | | | | | | | | | If an item is double clicked, then without this fix, the views emit the clicked() signal when the mousebutton is released after the double click event. This is unexpected and wrong. QAbstractItemView keeps track of the item the mouse was pressed on, to verify that the release occurred on the same item before emitting clicked, and to make sure we have a valid pressed item before initiating drag'n'drop. By resetting d->pressedItem when a double click has been handled, we can prevent the emission of a clicked signal in the next release event. [ChangeLog][QtWidgets][QTreeView] Don't emit clicked signal after a doubleClicked signal. Fixes: QTBUG-77771 Change-Id: I05988e9e2222157f4216cebc40c22507e8d83b82 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
* 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>
* QGraphicsItem: mark GraphicsItemChange::ItemMatrixChange as deprecatedChristian Ehrlicher2019-08-282-2/+6
| | | | | | | | | | The enum GraphicsItemChange::ItemMatrixChange is deprecated since Qt4 times. The corresponding matrix functions were also marked as deprecated in 5.13 but the enum was forgotten. Therefore also mark it as deprecated so it can be removed with Qt6. Change-Id: I39bec89af14aaefe2e504f5a890ef314574766a1 Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
* 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-2710-46/+85
|\ | | | | | | | | | | | | | | | | | | | | 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
| * Long live QSize(F)::grownBy/shrunkBy()Marc Mutz2019-08-222-19/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These functions tighten the integration of QMargins(F) with the rest of the geometry classes by providing a way to apply margins to sizes (and later, rects). Apply them in a few obvious cases across QtWidgets. [ChangeLog][QtCore][QSize/QSizeF] Added grownBy(QMargin(F))/shrunkBy(QMargin(F)). Change-Id: I8a549436824cdb7fb6125a8cde89d5bf02826934 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| * wasm: Add saveFileContent()Morten Johan Sørvig2019-08-203-0/+51
| | | | | | | | | | | | | | | | Saves a file by file download, where the user can choose the file name and location using a file dialog. Change-Id: I4d2ecc76fc33bb65fdf3d7ca3fcd9566c62547dd Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
| * QWidget: replace manual memory management with unique_ptr [6/N]: extraMarc Mutz2019-08-205-27/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-255-13/+13
| | | | | | | | | | 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>
* | Widget style: Use per-screen DPI in QStyleHelper::dpiScaled()Friedemann Kleint2019-08-238-120/+166
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pass the style option to dpiScaled() in order to get the correct screen DPI. The style option contains the font, which again contains the current DPI value. Add QFontMetrics::fontDpi() accessors to get the DPI from the QFont. This DPI will/should be updated on screen change. Replace hardcoded Q_OS_MAC DPI with hardcoded base DPI. This makes per-screen DPI testable on macOS, too. Task-number: QTBUG-45055 Change-Id: I75f8b37d45eb50c3334b46b8469a546d29712f1b Reviewed-by: Morten Johan Sørvig <morten.sorvig@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>
* | Adapt QCalendarWidget and QDateTimeEdit to support choice of calendarSoroush Rabiei2019-08-225-158/+242
| | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtWidgets][QCalendarWidget] Allow choice of calendar, with Gregorian remaining the default. [ChangeLog][QtWidgets][QDateTimeEdit] Allow choice of calendar, with Gregorian remaining the default. Change-Id: Ia11dd895032393543aee534b177324e643dcfb20 Done-with: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@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-224-212/+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-2049-1661/+73
| | | | | | | | | | | | | | | | | | | | 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>
* Fix build without features.proxymodelTasuku Suzuki2019-08-171-0/+4
| | | | | Change-Id: I9e51ed78d783da999187e7df58ddb83d76e3c7b7 Reviewed-by: Shawn Rutledge <shawn.rutledge@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>