summaryrefslogtreecommitdiffstats
path: root/src/widgets/graphicsview
Commit message (Collapse)AuthorAgeFilesLines
* Doc: Clarify QGraphicsItem::stackBefore() documentationDheerendra Purohit2025-06-241-4/+8
| | | | | | | | | | | Add explanation to disambiguate the term before in the context of visual stacking. Clarify that the item will appear behind the sibling when overlapping. Pick-to: 6.10 6.9 Fixes: QTBUG-126523 Change-Id: I8040b045bf67c404ef737a88b8328bc302f29227 Reviewed-by: Volker Hilsheimer <[email protected]>
* Doc: Fix typo in QGraphicsSimpleTextItem class descriptionDheerendra Purohit2025-06-191-1/+1
| | | | | | | | | | | Removed the incorrect word "path" from the description, which mistakenly referred to the item as a "text path item". QGraphicsSimpleTextItem provides a simple text item, not a path item. Fixes: QTBUG-87180 Pick-to: 6.10 6.9 6.8 Change-Id: I977d01c667c65f5d35dc3bc60d5362e681e9b5f1 Reviewed-by: Volker Hilsheimer <[email protected]>
* Doc: Fix auto-links to deprecated functionsDavid Boddie2025-05-311-1/+1
| | | | | Change-Id: Id4456eef3440734add2d804d186966e253335b7c Reviewed-by: Richard Moe Gustavsen <[email protected]>
* Add QPlatformTheme::ScrollSingleStepDistance theme hintTor Arne Vestbø2025-05-181-2/+4
| | | | | | | | | | | | | | | The hard coded value of 20 used in various QAbstractScrollArea subclasses does not represent the default behavior on all of our platforms. On macOS e.g. the native NSScrollView has a default line scroll value of 10 pixels. The default value isn't changed for macOS in this patch, as it has to be done in coordination with other changes to make the behavior change atomic. Task-number: QTBUG-130667 Change-Id: I532dbd3e2e946a00f426475adfa851d35a656c1b Reviewed-by: Shawn Rutledge <[email protected]>
* For qdebug operator<< of pointer types, always check for nullptrDaniel Trevitz2025-05-172-13/+7
| | | | | | | | Also, use a consistent syntax for when the pointer is null. Fixes: QTBUG-135856 Change-Id: I2f5c80a5650b1be6cc0d70cde7cd1e1c1990df9a Reviewed-by: Christian Ehrlicher <[email protected]>
* qgraphicsitem_cast: replace runtime with compile-time checkVolker Hilsheimer2025-04-111-4/+22
| | | | | | | | | | | | | | | Specialize the cast template for QGraphicsItem, where we can skip the runtime comparisons of the type. In addition, replace the runtime check for QGraphicsItem::Type with a compile time check in the main template. We need to do both so that we correctly cast up to QGraphicsItem for custom item types that don't provide their own Type alias. Pick-to: 6.9 6.8 Change-Id: Ic1bff3404fe890747865ce1349cddbcfebb3b77b Reviewed-by: Axel Spoerl <[email protected]>
* QGraphicsView: remove (last remaining?) user of QEvent::op=Marc Mutz2025-04-022-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of aggregating a QMutableSinglePointEvent by value, which depends on the QEvent copy assignment operator, and casting it to a QMouseEvent that it isn't, introduce QEventStorage which is a bit like std::optional, but, by each event subclass befriending it, can store event copies by-value, unlike clone(), which is restricted to the heap. We could have befriended std::optional<QMouseEvent>, too, but by adding our own type in _p.h, we can better control which code uses this dangerous construct. Added a guard to avoid clobbering lastMouseEvent with a copy of itself in storeMouseEvent(). Before, we'd self-assign to lastMouseEvent, which didn't invalidate the reference. Now, a store() is the equivalent of a dtor + copy constructor, so we need to be a bit more careful. Fixes UBSan reports when running tst_qgraphicsview: qgraphicsview/qgraphicsview.cpp:612:27: runtime error: downcast of address 0x61a000035e90 which does not point to an object of type 'QMouseEvent' 0x61a000035e90: note: object is of type 'QMutableSinglePointEvent' 00 00 00 00 30 47 ef 8b 99 7f 00 00 02 00 00 00 00 00 00 e0 d0 91 00 00 20 60 00 00 00 00 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'QMutableSinglePointEvent' #0 0x7f99a27c7a47 in QGraphicsViewPrivate::replayLastMouseEvent() qgraphicsview.cpp:612 qgraphicsview.cpp:653:39: runtime error: member call on address 0x61a0000fe290 which does not point to an object of type 'QMouseEvent' 0x61a0000fe290: note: object is of type 'QMutableSinglePointEvent' 00 00 00 00 30 47 ef 8b 99 7f 00 00 05 00 00 00 00 00 00 e0 d0 91 00 00 20 60 00 00 00 00 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'QMutableSinglePointEvent' #0 0x7f99a27c3609 in QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent*) qgraphicsview.cpp:653 #1 0x7f99a27c7832 in QGraphicsViewPrivate::replayLastMouseEvent() qgraphicsview.cpp:612 qgraphicsview.cpp:654:37: runtime error: member call on address 0x61a0000fe290 which does not point to an object of type 'QMouseEvent' 0x61a0000fe290: note: object is of type 'QMutableSinglePointEvent' 00 00 00 00 30 47 ef 8b 99 7f 00 00 05 00 00 00 00 00 00 e0 d0 91 00 00 20 60 00 00 00 00 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'QMutableSinglePointEvent' #0 0x7f99a27c358b in QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent*) qgraphicsview.cpp:654 #1 0x7f99a27c7832 in QGraphicsViewPrivate::replayLastMouseEvent() qgraphicsview.cpp:612 Pick-to: 6.9 Task-number: QTBUG-99563 Change-Id: Ib642d416b8aef98c7fd8b1fa164ec2449189992a Reviewed-by: Axel Spoerl <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]> Reviewed-by: Shawn Rutledge <[email protected]>
* QSimplex: split QConcreteSimplexVariable from QSimplexVariableMarc Mutz2025-03-153-11/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | The latter was used both as a concrete type as well as a base class, driving Coverity nuts because it couldn't prove that we weren't deleting derived classes (AnchorData) through a QSimplexVariable pointer. This is the same issue that Coverity took with QBrushData (CIDs 218724, 11772), and the solution is the same (cf. 3bbc9e29ef59683351cf35c19a8bd4a030615c64): Split the Janus-headed class into one that acts only as the base class (and has a protected dtor) and one that only acts as a concrete class (and we can mark it final). The protected dtor in the former now statically ensures we don't delete a derived class object through a QSimplexVariable pointer. We don't need to modify AnchorData subclasses, because AnchorData introduces a virtual destructor. Coverity-Id: 390828 Pick-to: 6.9 6.8 6.5 Change-Id: I981c02e69af44ebacd4ba3aec76792e14eb15836 Reviewed-by: Mate Barany <[email protected]>
* Mark QSimplex{,Constraint} final, AnchorData non-copyableMarc Mutz2025-03-142-2/+6
| | | | | | | | | | | | These final touch-ups for CID 390828 make the code easier to understand and safer, because more unsafe operations are now forbidden (subclassing and copying). Coverity-Id: 390828 Pick-to: 6.9 6.8 6.5 Change-Id: I2e43be71d8c3db59d95e69ec16c41c1547a2f180 Reviewed-by: Magdalena Stojek <[email protected]> Reviewed-by: Mate Barany <[email protected]>
* QGraphicsAnchorLayout: make createSlack() return a proper structMarc Mutz2025-03-121-20/+23
| | | | | | | | | | | | | | | | | | | | | | | ... instead of std::pair. This is in preparation of breaking QSimplexVariable up into QSimplexVariable (with protected dtor) and trivial subclass QConcreteSimplexVariable, to statically ensure that we're not deleting derived classes (AnchorData) through QSimplexVariable pointers (which is UB, and subject to a Coverity complaint). This is basically the same program we did for QBrushData, culminating in 3bbc9e29ef59683351cf35c19a8bd4a030615c64. This second patch modernizes the code a bit and, by scoping the variable holding the return value of createSlack() tighter, allows the use of auto and therefore isolates the code from the changes in the final patch of the series. Pick-to: 6.9 6.8 6.5 Coverity-Id: 390828 Change-Id: I15b51a3118c7ef33e8351a3e198abaebf4300d61 Reviewed-by: Mate Barany <[email protected]>
* QSimplex: scope iterators tighter in for loopsMarc Mutz2025-03-122-18/+6
| | | | | | | | | | | | | | | | | | | | | This is in preparation of breaking QSimplexVariable up into QSimplexVariable (with protected dtor) and trivial subclass QConcreteSimplexVariable, to statically ensure that we're not deleting derived classes (AnchorData) through QSimplexVariable pointers (which is UB, and subject to a Coverity complaint). This is basically the same program we did for QBrushData, culminating in 3bbc9e29ef59683351cf35c19a8bd4a030615c64. This first step scopes iterators of for loops in the for-loop, and, as drive-bys, makes them use auto and the shorter cbegin()/cend(), so they fit into a single line, and fixes the extra {} around single-line bodies (only in touched lines). Pick-to: 6.9 6.8 6.5 Coverity-Id: 390828 Change-Id: I439e0a10ebb316a33e92c42c255ee209139d47a2 Reviewed-by: Mate Barany <[email protected]>
* QObjectPrivate: encode the version number in the constructor parametersThiago Macieira2025-01-272-2/+2
| | | | | | | | | | | | | | | | Instead of allowing the code to start and then possibly fail at runtime. This isn't a 100% sure solution because it's a function call. With lazy symbol binding on some OSes, the mistake won't be noticed until the function call is attempted. However, most OSes now resolve *all* calls at load time so they can mark the GOT (or equivalent) pages read-only, meaning the loading of the library will fail. qversiontagging_p.h is a more sure way in OSes / executable formats it works on. Change-Id: If7867a37256b7141001dfffd9bd299bb1bbd7c63 Reviewed-by: Marc Mutz <[email protected]>
* Remove unused qdebug.h include from private headersAhmad Samir2025-01-161-1/+0
| | | | | | Pick-to: 6.9 Change-Id: I03c951d03ab2410298878d0689c0d50bdd4eedf2 Reviewed-by: Mårten Nordheim <[email protected]>
* Replace all QPair/qMakePair with std::pair in qtbase/widgetsIsak Fyksen2025-01-097-67/+71
| | | | | | | | | | As a drive-by replace QList::append and operator<< with emplace_back, to avoid repeating value_type. Task-number: QTBUG-115841 Pick-to: 6.9 6.8 Change-Id: I6fb790f959b41b0feb49e3a0f0b6b3631e24a232 Reviewed-by: Marc Mutz <[email protected]>
* Move QContextMenuEvent synthesis from QWidgetWindow to QWindowShawn Rutledge2024-12-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | ...and only if the original mouse event is not accepted. To that end, QGraphicsView must setAccepted(false) if the graphics scene did not accept the QGraphicsSceneMouseEvent. So a widget or a Qt Quick item or handler can handle the mouse events directly, to provide a consistent context-menu experience across platforms (for example to handle the press-drag-release gesture), but the fallback pattern follows the platform behavior. QWidgetWindow::handleMouseEvent() picks the receiver in its own way: often a leaf widget. It sets qt_last_mouse_receiver, so QWidgetWindow::handleContextMenuEvent() can deliver a mouse-originating QContextMenuEvent to the same receiver. A keyboard-originating QContextMenuEvent is delivered to the focus widget instead, as before. As a drive-by: fix an awkward word in qCDebug output. Task-number: QTBUG-93486 Change-Id: I4c1499120851a899acf2d7d4adaedaf9f42c3126 Reviewed-by: Mitch Curtis <[email protected]> Reviewed-by: Jan Arve Sæther <[email protected]>
* Mark max length work buffers uninitializedAllan Sandfeld Jensen2024-11-301-2/+2
| | | | | | | | | Otherwise the hardening with initializing all buffers causes serious performance regressions Pick-to: 6.8 Change-Id: I3f7a0b7f0e0d08644b1dbb520cf1f6d5e052b270 Reviewed-by: Thiago Macieira <[email protected]>
* Fix ubsan warning of illegal cast and illegal method callAllan Sandfeld Jensen2024-11-131-1/+1
| | | | | | | | | Avoid casting an event to a type it does not have. Instead use a static accessor class. Pick-to: 6.8 Task-number: QTBUG-99563 Change-Id: Ideb11779b1510cd10a27fb8bc40bcc8e4849bf15 Reviewed-by: Marc Mutz <[email protected]>
* QWidget::mapTo/FromGlobal(): Fix transformation in case of ↵Friedemann Kleint2024-11-012-15/+13
| | | | | | | | | | | | QGraphicsItem::ItemIgnoresTransformations Extract a helper returning the transform from QGraphicsViewPrivate::mapToViewRect() and use that. Fixes: QTBUG-128913 Pick-to: 6.8 Change-Id: Idc31f653c23cd7d0e5bbb8af560f010f01ac4d4b Reviewed-by: Axel Spoerl <[email protected]>
* Take Header splitter cursor for QGraphicsProxyWidgetSami Varanka2024-10-311-0/+9
| | | | | | | | | | | | | Strangely when a QTreeview is put in GraphicsView using QGraphicsProxyWidget, QTreeView header splitter cursor does not appears though section can be resized without that. This change forces the QGraphicsProxyWidget to take header splitter cursor from lastwidget. Pick-to: 6.8 Fixes: QTBUG-128912 Change-Id: I783e8357ae8386af70d28a1495e3b2367921df76 Reviewed-by: Eirik Aavitsland <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
* QGraphicsView: Fix clipping bug for rectangular custom itemsEirik Aavitsland2024-10-291-1/+1
| | | | | | | | | | | | | If an item's shape() path described a rectangle not starting at the top left corner, the code setting up clipping would correctly identify and attempt to use it as a rectangle. However the conversion to a QRectF would produce a non-normalized rectangle, which could lead to unexpected clipping results. Fix by ensuring the rect is normalized. Fixes: QTBUG-128488 Pick-to: 6.8 Change-Id: Icbd17a95dde46a1969994f5eac021ac7b8ac5689 Reviewed-by: Paul Olav Tvete <[email protected]>
* QGraphicsSceneBspTreeIndex: port to QBasicTimerAhmad Samir2024-09-202-9/+9
| | | | | | | ... instead of handling timer IDs. Change-Id: Ib87a277abfaf7412b57007affc68b1e1f1f822f4 Reviewed-by: Volker Hilsheimer <[email protected]>
* Remove redundant qtimer.h includesAhmad Samir2024-06-112-2/+0
| | | | | | | | | | | | | | If QTimer isn't used in the file where it's included, remove the include. Fix files that depended on transitive includes. QMacPanGestureRecognizer: drive by change: classes inheriting from QObject should have Q_OBJECT macro in the definition. Change-Id: Ia8d71f4195a1ca643c9fcb14db41877413348d98 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Thiago Macieira <[email protected]> Reviewed-by: Edward Welbourne <[email protected]>
* QGraphicsProxyWidget: use focus abstraction instead of focus_next/prevAxel Spoerl2024-03-181-5/+5
| | | | | | | | | | | Focus abstraction in QWidgetPrivate makes direct access to QWidget::focus_next and focus_prev an antipattern. Remove usage. Task-number: QTBUG-121478 Change-Id: I741e6875e686a9cfb4e6a113e7575c911a38e80c Reviewed-by: Volker Hilsheimer <[email protected]>
* QDoc: Drop default arguments from some \fn documentation stringsPaul Wicking2024-03-131-1/+1
| | | | | | | | | | | | | | | | | | | In the \fn commands for a limited number of methods in the documentation for Testlib and Widgets, `= 0` is passed as default argument instead of `= Qt::KeyboardModifiers()`. Until QDoc with Clang 17, inclusive, QDoc generated the correct signature. However, with Clang 18, QDoc outputs `= 0` in the documentation. While strictly speaking still correct, this change impacts the documentation negatively in terms of readability. Dropping the default argument from the \fn command ensures that QDoc generates the right signature with both Clang 17 and Clang 18. Task-number: QTBUG-123130 Pick-to: 6.7 Change-Id: I94ccec2f2c9a02241095fb5b18feb74aa55f97e1 Reviewed-by: Andreas Eliasson <[email protected]> Reviewed-by: Topi Reiniö <[email protected]>
* Fix -Wimplicit-fallthrough for clangTim Blechmann2024-03-011-0/+1
| | | | | | | | | | | | | | | | | | | Clang's `-Wimplicit-fallthrough` warnings are a little stricter than gcc's interpretation: switch (i) { case 0: foo(); case 4: break; } While gcc accepts the implicit fallthrough, if the following statement is a trivial `break`, clang will warn about it. Pick-to: 6.7 Change-Id: I38e0817f1bc034fbb552aeac21de1516edcbcbb0 Reviewed-by: Volker Hilsheimer <[email protected]>
* Increase precision for QGraphicsView::AnchorUnderMouseThorbjørn Lindeijer2024-01-221-7/+6
| | | | | | | | | | | | | | | | | | * Use a more precise view center for views with odd width/height * Use the QPointF version of mapToScene to avoid rounding * Round instead of truncate when setting scroll bar values These changes increase the precision of AnchorUnderMouse, which is important when for example wheel scrolling is used to change the scale of the view. Without these changes, the view shifts slightly with each change in the transform. [ChangeLog][QtWidgets][QGraphicsView] Increase precision for QGraphicsView::AnchorUnderMouse and QGraphicsView::centerOn Pick-to: 6.6 6.7 Task-number: QTBUG-96879 Change-Id: I8199196c671e4aa96732f382e8057468f676b8d7 Reviewed-by: Eirik Aavitsland <[email protected]>
* Widgets: pass widget to QStyle::pixelMetric()Christian Ehrlicher2024-01-162-3/+3
| | | | | | | | | | | | Make sure to pass the widget to QStyle::pixelMetric() as some styles might use this (e.g. the new windows styles) to determine the correct pixel metric. Pick-to: 6.7 6.6 6.5 6.2 Task-number: QTBUG-1857 Change-Id: I5c32f5af8b284749732b610e56b4e3d8c8ed1946 Reviewed-by: Axel Spoerl <[email protected]> Reviewed-by: David Faure <[email protected]>
* Doc: fix typo in QGraphicsView::rubberBandRect() method documentationDavid Faure2024-01-081-1/+1
| | | | | | | | outise -> outside Pick-to: 6.7 Change-Id: I143430b3c6661cf5259a09ffa64b74a220e2b979 Reviewed-by: Paul Wicking <[email protected]>
* Doc: Fix \fn template arguments for Qt WidgetsTopi Reinio2023-11-181-1/+1
| | | | | | | | | Upcoming changes to QDoc require accurate definition for template arguments in \fn commands. Task-number: QTBUG-118080 Change-Id: I3a193ca69a911ee2f62e7663aaf4c032a35ee5dd Reviewed-by: Luca Di Sera <[email protected]>
* Fix warning for 32bit buildsVolker Hilsheimer2023-11-011-1/+1
| | | | | | | | | | | | When building for 32bit platforms (e.g. Android armv7a), then printing qsizetype value using printf's %lld format generates a warning because qsizetype is just an int. This breaks the build, and can't be fixed by using another placeholder without producing a warning on 64bit builds. So fix it by casting the qsizetype always to 64bit signed int. Change-Id: Ie7c0fa8b3a0fe6366ce6fd5b2947f42a3e67c381 Reviewed-by: Assam Boudjelthia <[email protected]> Reviewed-by: Ivan Solovev <[email protected]>
* QGraphicsAnchorLayout: remove a redundant member containerAhmad Samir2023-10-181-2/+3
| | | | | | | | The m_children container isn't used at all, so remove it. Spotted by Volker Hilsheimer. Change-Id: I79db1f77c0e4caf8ebab1573a82e07396a6a806b Reviewed-by: Christian Ehrlicher <[email protected]>
* QGraphicsAnchorLayout: make a member container constAhmad Samir2023-10-172-3/+3
| | | | | | | | | | The m_edges container isn't changed after it's initialized in the constructor; so make it const. This amends commit 641bccce2a80b2a7268c3b8409bdc957b9a510b5. Change-Id: I387eb2562475bc4910700d48f67303b0a5f80ccd Reviewed-by: Christian Ehrlicher <[email protected]>
* Include what you need: <QPointer>Marc Mutz2023-10-123-0/+6
| | | | | | | | | | | | | | | | | | | | | | | All these TUs relied on transitive includes of qpointer.h, maybe to a large extent via qevent.h, though, given that qevent.h is more or less the only public QtBase header that includes qpointer.h, something else seems to be at play here. Said qevent.h actually needs QPointer in-name-only, so a forward declaration would suffice. Prepare for qevent.h dropping the include. The algorithm I used was: If the TU mentions 'passiveGrabbers', the name of the QEvent function that returns QPointers, and the TU doesn't have qpointer.h included explicitly, include it. That may produce False Positives, but better safe than sorry. Otherwise, in src/, add an include to all source and header files which mention QPointer. Exception: if foo.h of a foo.cpp already includes it, don't include again. Task-number: QTBUG-117670 Change-Id: I3321cccdb41ce0ba6d8a709cea92427aba398254 Reviewed-by: Fabian Kosmale <[email protected]>
* QGraphicsAnchorLayout: compile with QT_NO_FOREACHAhmad Samir2023-10-081-19/+9
| | | | | | | | | | | | | | | The m_edges container isn't changed after it's initialized in the constructor (in a later commit I'll make this container const, so as to keep this commit backport-able), and it isn't changed by the loop. Port all loops over m_edges to ranged-for. Remove "#undef QT_NO_FOREACH" from the source file, as that was the only usage of foreach in it. And remove that source file from NO_PCH_SOURCES. Pick-to: 6.6 6.5 Task-number: QTBUG-115803 Change-Id: I9cfc0c95865cbc7415dbecc82388c64c65ded4be Reviewed-by: Christian Ehrlicher <[email protected]>
* Tidy up qgraphicsview: use nullptr moreAnton Kudryavtsev2023-09-081-1/+1
| | | | | | Change-Id: Ie4d2b64175cba12e884260455814774bce8c8787 Reviewed-by: Mårten Nordheim <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
* QGraphicsScene: use const methods moreAnton Kudryavtsev2023-09-081-1/+1
| | | | | | | Avoid unnecessary detach. Change-Id: I206a7df677119ec309c6c176de881469db057165 Reviewed-by: Volker Hilsheimer <[email protected]>
* Mark QtWidgets as free of Q_FOREACH, except where it isn'tMarc Mutz2023-08-091-0/+2
| | | | | | | | | | | | | | | | | | 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 <[email protected]>
* Doc: Remove duplicate wordsAndreas Eliasson2023-02-282-2/+2
| | | | | | Change-Id: Ia7a38a1035bd34d00f20351a0adc3927e473b2e7 Pick-to: 6.5 6.4 6.2 Reviewed-by: Topi Reiniö <[email protected]>
* QGraphicsView: remove even more vestiges of QtDeclarative1Giuseppe D'Angelo2023-01-183-12/+6
| | | | | | | | The field is never set and thus never used meaningfully. Change-Id: Ia45afa6339d38316d76766a736ba8cb1ce9f58fa Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
* QGraphicsItem: remove QtDeclarative 1 vestigesGiuseppe D'Angelo2023-01-183-127/+0
| | | | | | | This code is completely unused at this point. Change-Id: Id0ecd0125e59b08904ae722ad4319c5ff15620a6 Reviewed-by: Volker Hilsheimer <[email protected]>
* Add resetTransform to see also of setTransform in QGraphicsViewLeon Zhang2023-01-061-1/+1
| | | | | | Pick-to: 6.5 6.4 Change-Id: I4a38d44f2109f8b92069651c23717da02f5b3091 Reviewed-by: Volker Hilsheimer <[email protected]>
* QGraphicsProxyWidget: Don't unnecessarily check focusWidget twiceLu YaNing2022-12-211-1/+1
| | | | | | | Amends commit bf5011815d917e07ae7cf45e5768f1775f70e90d Change-Id: I18a8d26b08b4035d7a76fc51873696590292b181 Reviewed-by: Volker Hilsheimer <[email protected]>
* Support stereoscopic rendering with QGraphicsViewKristoffer Skau2022-12-012-113/+142
| | | | | | | | | | | | | | | | This patch adds a manual test and the required work in graphicsview and qwidget private apis to support stereoscopic rendeing. Basically it works by doing the drawing in QGraphicsView::paintEvent twice, once for each buffer. This way the scene items are rendered to both buffers. There's also an update to resolvement in QOpenGLWidgetPrivate so that multisampling works correctly. [ChangeLog][Widgets][QGraphicsView] Added support for stereoscopic rendering. Task-number: QTBUG-64587 Change-Id: I20650682daa805b64fe7f0d2ba086917d3f12229 Reviewed-by: Laszlo Agocs <[email protected]>
* QGraphicsView: fix jumping graphic items when dragging out of viewTaras Kachmaryk2022-11-261-22/+29
| | | | | | | | | | | | | | | | | | | | | The algorithms for calculating the scene's position within the view did not compensate for scrollbars showing. The scrollbars should be ignored when positioning hte scene within the view, as alignment only cares about the positioning of the scene when the view is larger than the scene anyway. Add a test case that verifies that items don't jump up or down when dragging horizontally, and not left or right when dragging vertically. Mark variables in the modified function as const where applicable to make it easier to follow the code. Done-with: Volker Hilsheimer <[email protected]> Fixes: QTBUG-46757 Change-Id: If205637dfe124e0034f68201b23f174d6863084d Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
* Port from container::count() and length() to size() - V5Marc Mutz2022-11-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Qt CI Bot <[email protected]>
* Replace usages of Q_CLANG_QDOC with Q_QDOCLuca Di Sera2022-10-213-3/+3
| | | | | | | | | | | | | | | | | | | | | | | To allow the user to customize the C++ code that QDoc sees, so as to be able to work-around some limitations on QDoc itself, QDoc defines two symbols: Q_QDOC and Q_CLANG_QDOC, both of which are "true" during an entire execution of QDoc. At a certain point in time, QDoc allowed the user the choice between a custom C++ parser and a Clang based one. The Q_QDOC symbol would always be defined while the Q_CLANG_QDOC symbol would be defined only when the Clang based parser was chosen. In more recent times, QDoc always uses a Clang based parser, such that both Q_CLANG_QDOC and Q_QDOC are always defined, making them equivalent. To avoid using different symbols, and the possible confusion and fragmentation that derives from it, all usages of Q_CLANG_QDOC are now replaced by the equivalent usages of Q_QDOC. Change-Id: I5810abb9ad1016a4c5bbea99acd03381b8514b3f Reviewed-by: Kai Koehne <[email protected]>
* Layouts docs: pass parent widget in the ctorAhmad Samir2022-10-212-6/+13
| | | | | | | | | This is a follow up from commit 1e904ab342c1aaa; changing more documentation to pass a widget * in the ctor of a layout, rather than creating a parent-less layout then calling setLayout(). Change-Id: I4fc59c6cfa46ccd279a153acd67335a6daf22ff9 Reviewed-by: Jan Arve Sæther <[email protected]>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-117-54/+54
| | | | | | | | | | | | | | | | 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 <[email protected]>
* Port from container.count()/length() to size()Marc Mutz2022-10-047-44/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
* QtWidgets: Use the default constructor of QString and appendMate Barany2022-09-271-1/+3
| | | | | | | | | | | | | Addressing a comment from the review of QTBUG-98434: instead of the QL1S constructor use the default constructor and append "Path: "_L1. With the QL1S constructor capacity == size == rhs.capacity and the very next append is guaranteed to reallocate. In the other case the capacity will grow according to the growth strategy. Task-number: QTBUG-103100 Change-Id: Ifcc1c22a59739c6384b363471dbb27d6a978e306 Reviewed-by: Marc Mutz <[email protected]>